Skip to content

Commit 4458952

Browse files
fix: 파일 충돌 해결
2 parents 175de7e + 4904f89 commit 4458952

18 files changed

+357
-17
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ name: deploy
33
on:
44
push:
55
branches: [ "develop" ]
6+
<<<<<<< HEAD
67
pull_request:
78
branches: [ "develop" ]
89
types: [closed]
10+
=======
11+
# pull_request:
12+
# branches: [ "develop" ]
13+
# types: [closed]
14+
>>>>>>> 4904f89120c9db955ca9d1633e441ec857129ab3
915

1016
permissions:
1117
contents: read
@@ -22,7 +28,11 @@ jobs:
2228
# Gradlew 실행 허용
2329
- name: Run chmod to make gradlew executable
2430
run: chmod +x ./gradlew
31+
<<<<<<< HEAD
2532
# JDK 11 세팅
33+
=======
34+
# JDK 21 세팅
35+
>>>>>>> 4904f89120c9db955ca9d1633e441ec857129ab3
2636
- name: Set up JDK 21
2737
uses: actions/setup-java@v3
2838
with:
@@ -31,11 +41,18 @@ jobs:
3141
# 환경 변수 설정
3242
- name: Set environment values
3343
run: |
44+
<<<<<<< HEAD
3445
cd ./src/main/resources
3546
mkdir -p ./gcp
3647
touch ./application.yml
3748
echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./application.yml
3849
echo "${{ secrets.GCP_SERVICE_KEY }}" | base64 --decode > ./gcp/service-key.json
50+
=======
51+
mkdir -p src/main/resources/{gcp,ocr}
52+
echo "${{ secrets.APPLICATION_PROPERTIES }}" > src/main/resources/application.yml
53+
echo "${{ secrets.GCP_SERVICE_KEY }}" | base64 --decode > src/main/resources/gcp/service-key.json
54+
echo "${{ secrets.OCR_SERVICE_KEY }}" | base64 --decode > src/main/resources/ocr/service-key.json
55+
>>>>>>> 4904f89120c9db955ca9d1633e441ec857129ab3
3956
shell: bash
4057
# Gradle build (Test 제외)
4158
- name: Build with Gradle

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
HELP.md
22
.gradle
33
build/
4+
.DS_Store
45
!gradle/wrapper/gradle-wrapper.jar
56
!**/src/main/**/build/
67
!**/src/test/**/build/
78
**/application.yml
89
**/application-test.yml
910
**/resources/gcp/
11+
**/resources/ocr/
1012

1113
### STS ###
1214
.apt_generated
@@ -38,3 +40,5 @@ out/
3840

3941
### VS Code ###
4042
.vscode/
43+
src/main/resources/ocr/service-key.json
44+

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ dependencies {
7878

7979
// swagger
8080
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
81+
82+
// Google Cloud Vision API
83+
implementation 'com.google.cloud:google-cloud-vision:3.22.0'
8184
}
8285

8386
tasks.named('test') {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.weve.controller;
2+
3+
import com.weve.common.api.payload.BasicResponse;
4+
import com.weve.dto.request.PostAppreciateRequest;
5+
import com.weve.dto.response.GetAppreciateListResponse;
6+
import com.weve.dto.response.GetAppreciateResponse;
7+
import com.weve.service.AppreciateService;
8+
import io.swagger.v3.oas.annotations.tags.Tag;
9+
import lombok.RequiredArgsConstructor;
10+
import lombok.extern.slf4j.Slf4j;
11+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
12+
import org.springframework.security.core.userdetails.UserDetails;
13+
import org.springframework.validation.annotation.Validated;
14+
import org.springframework.web.bind.annotation.*;
15+
16+
@RestController
17+
@RequiredArgsConstructor
18+
@Validated
19+
@Slf4j
20+
@RequestMapping("/api/appreciate")
21+
@Tag(name = "Appreciate", description = "Appreciate 관련 API입니다.")
22+
public class AppreciateController {
23+
24+
private final AppreciateService appreciateService;
25+
26+
// 감사인사 작성하기
27+
@PostMapping
28+
public BasicResponse<?> postAppreciate(@AuthenticationPrincipal UserDetails userDetails, @RequestBody PostAppreciateRequest request) {
29+
30+
String username = userDetails.getUsername();
31+
appreciateService.postAppreciate(username, request);
32+
return BasicResponse.onSuccess(null);
33+
}
34+
35+
// 감사편지 상세 조회 (어르신용)
36+
@GetMapping("/details")
37+
public BasicResponse<GetAppreciateResponse.SeniorVer> getAppreciate(@AuthenticationPrincipal UserDetails userDetails, @RequestParam Long worryId) {
38+
39+
String username = userDetails.getUsername();
40+
GetAppreciateResponse.SeniorVer response = appreciateService.getAppreciate(username, worryId);
41+
return BasicResponse.onSuccess(response);
42+
}
43+
44+
// 감사편지 목록 조회
45+
@GetMapping
46+
public BasicResponse<GetAppreciateListResponse> getAppreciateList(@AuthenticationPrincipal UserDetails userDetails) {
47+
48+
String username = userDetails.getUsername();
49+
GetAppreciateListResponse response = appreciateService.getAppreciateList(username).getResult();
50+
return BasicResponse.onSuccess(response);
51+
}
52+
}

src/main/java/com/weve/controller/AuthController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.weve.common.api.payload.BasicResponse;
44
import com.weve.common.api.payload.code.status.ErrorStatus;
5+
import com.weve.dto.request.LoginRequestDto;
56
import com.weve.dto.request.UserRequestDto;
67
import com.weve.service.AuthService;
78
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -43,7 +44,7 @@ public BasicResponse<String> register(@RequestBody UserRequestDto request) {
4344

4445
// 로그인
4546
@PostMapping("/login")
46-
public BasicResponse<?> login(@RequestBody UserRequestDto request) {
47+
public BasicResponse<?> login(@RequestBody LoginRequestDto request) {
4748

4849
// 전화번호 및 이름 필수 체크
4950
if (request.getPhoneNumber() == null || request.getPhoneNumber().isBlank()) {

src/main/java/com/weve/controller/GcsController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
import io.swagger.v3.oas.annotations.tags.Tag;
88
import lombok.RequiredArgsConstructor;
99
import lombok.extern.slf4j.Slf4j;
10+
<<<<<<< HEAD
11+
=======
12+
import org.springframework.http.MediaType;
13+
>>>>>>> 4904f89120c9db955ca9d1633e441ec857129ab3
1014
import org.springframework.validation.annotation.Validated;
1115
import org.springframework.web.bind.annotation.PostMapping;
1216
import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,7 +30,7 @@ public class GcsController {
2630

2731
private final GcsService gcsService;
2832

29-
@PostMapping("/upload")
33+
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
3034
@Operation(summary = "파일 업로드", description = "파일을 업로드하여 URL을 생성합니다.")
3135
public BasicResponse<UploadFileResponse> uploadFile(@RequestPart(value = "file") MultipartFile multipartFile) throws IOException {
3236

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.weve.controller;
2+
3+
import com.weve.common.api.payload.BasicResponse;
4+
import com.weve.domain.User;
5+
import com.weve.service.ImageService;
6+
import io.swagger.v3.oas.annotations.tags.Tag;
7+
import lombok.RequiredArgsConstructor;
8+
import org.springframework.jdbc.support.CustomSQLErrorCodesTranslation;
9+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
10+
import org.springframework.security.core.userdetails.UserDetails;
11+
import org.springframework.web.bind.annotation.*;
12+
import org.springframework.web.multipart.MultipartFile;
13+
14+
import java.io.IOException;
15+
16+
17+
@RestController
18+
@RequestMapping("/api/image")
19+
@RequiredArgsConstructor
20+
@Tag(name = "OCR", description = "OCR 관련 API입니다.")
21+
public class ImageController {
22+
23+
private final ImageService imageService;
24+
25+
@PostMapping
26+
public BasicResponse<String> postOcrText(@AuthenticationPrincipal UserDetails userDetails, @RequestParam("imageFile") MultipartFile imageFile) throws IOException {
27+
28+
String username = userDetails.getUsername();
29+
return imageService.postOcrTextByFile(username, imageFile);
30+
}
31+
}

src/main/java/com/weve/domain/Appreciate.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ public class Appreciate extends BaseEntity {
2323
private String audioUrl;
2424

2525
private boolean isRead;
26+
public void setAsRead(){
27+
this.isRead = true;
28+
}
2629
}

src/main/java/com/weve/dto/gemini/GeminiResponse.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public static class Content {
3030

3131
@Getter
3232
@Builder
33+
@NoArgsConstructor // 기본 생성자 추가 (역직렬화 오류 해결)
34+
@AllArgsConstructor
3335
public static class Part {
3436
private String text;
3537
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.weve.dto.request;
2+
3+
import lombok.Getter;
4+
5+
@Getter
6+
public class PostAppreciateRequest {
7+
8+
private Long worryId;
9+
private String content; // 감사인사 내용
10+
}

0 commit comments

Comments
 (0)