Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaguriee committed Aug 10, 2024
2 parents 9158eda + f7c0ac2 commit 4361c77
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI/CD with Git Actions & Docker Hub

# 워크플로우 트리거: 브랜치에 대한 push 이벤트 발생 시 실행.
# 워크플로우 트리거: 브랜치에 대한 push 이벤트 발생 시 실행
on:
push:
branches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public ResponseEntity<ApiResponse<PostGetForUpdateResponse>> getSupportForUpdate

@Operation(summary = "후원하기 게시글 수정",
description = "후원하기 게시글을 수정합니다.")
@PatchMapping("/{supportId}")
@PutMapping("/{supportId}")
public ResponseEntity<ApiResponse<PostGetResponse>> updateSupportPost(
Principal principal,
@PathVariable(value = "supportId") Long supportId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class PostCreateRequest {
@Size(max = 100, message = "후원 물품 명은 최대 100자까지 입력 가능합니다.")
private String item;

@Schema(description = "구매 URL", required = true, example = "https://example.com/product/1")
@Schema(description = "구매 URL", example = "https://example.com/product/1")
@NotBlank(message = "구매 URL은 필수입니다.")
@URL(message = "유효한 URL 형식이어야 합니다.")
private String purchaseUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class PostUpdateRequest {
@Size(max = 100, message = "후원 물품 명은 최대 100자까지 입력 가능합니다.")
private String item;

@Schema(description = "구매 URL", required = true, example = "https://example.com/product/1")
@Schema(description = "구매 URL", example = "https://example.com/product/1")
@NotBlank(message = "구매 URL은 필수입니다.")
@URL(message = "유효한 URL 형식이어야 합니다.")
private String purchaseUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Getter
@Schema(description = "후원하기 게시글 수정 시 기존 데이터 조회 DTO")
Expand Down Expand Up @@ -41,8 +42,8 @@ public class PostGetForUpdateResponse {
@Schema(description = "후원 물품 가격", example = "500000")
private int price;

@Schema(description = "후원 물품 이미지 리스트", example = "WEEKLY")
private List<String> images;
@Schema(description = "후원 물품 이미지 리스트", example = "PresignedUrl과 ImagePathUrl")
private List<Map<String, String>> images;

@Schema(description = "후원자와의 약속 타입")
private String promise;
Expand Down Expand Up @@ -73,7 +74,7 @@ public class PostGetForUpdateResponse {
@Schema(description = "우편번호", example = "06123")
private String zip;

public PostGetForUpdateResponse(Long supportPostId, String supportCategory, String supportPostStatus, Long memberId, String nickname, String title, String reason, String item, String purchaseUrl, int price, List<String> images, String promise, LocalDate expirationDate, String bank, String account, String recipientName, String phone, String address, String detailAddress, String zip) {
public PostGetForUpdateResponse(Long supportPostId, String supportCategory, String supportPostStatus, Long memberId, String nickname, String title, String reason, String item, String purchaseUrl, int price, List<Map<String, String>> images, String promise, LocalDate expirationDate, String bank, String account, String recipientName, String phone, String address, String detailAddress, String zip) {
this.supportPostId = supportPostId;
this.supportCategory = supportCategory;
this.supportPostStatus = supportPostStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ public SupportPost(Member member, PostCreateRequest postCreateRequest) {
this.promise = Promise.valueOf(postCreateRequest.getPromise());
this.supportCategory = SupportCategory.valueOf(postCreateRequest.getSupportCategory());

if ("MEDICAL".equals(supportCategory.name()) || "LEGAL_AID".equals(supportCategory.name())) {
if ("MEDICAL".equals(supportCategory.name())
|| "LEGAL_AID".equals(supportCategory.name())
|| "EDUCATION".equals(supportCategory.name())
) {
this.bank = postCreateRequest.getBank();
this.account = postCreateRequest.getAccount();
this.recipientName = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -186,9 +187,16 @@ public PostGetForUpdateResponse getSupportForUpdate(Long supportId, Long memberI
String item = supportPost.getItem();
String purchaseUrl = supportPost.getPurchaseUrl();
int price = supportPost.getPrice();
List<String> images = supportPost.getImages().stream()
.map(supportImage -> fileService.getDownloadPresignedUrl(supportImage.getImageUrl()))

List<Map<String, String>> images = supportPost.getImages().stream()
.map(supportImage -> {
Map<String, String> imageMap = new HashMap<>();
imageMap.put("originalUrl", supportImage.getImageUrl());
imageMap.put("presignedUrl", fileService.getDownloadPresignedUrl(supportImage.getImageUrl())); // 변환된 URL
return imageMap; // Map 반환
})
.toList();

String promise = String.valueOf(supportPost.getPromise());
LocalDate expirationDate = supportPost.getExpirationDate();

Expand All @@ -202,7 +210,7 @@ public PostGetForUpdateResponse getSupportForUpdate(Long supportId, Long memberI
String detailAddress = null;
String zip = null;

if (supportCategory == SupportCategory.MEDICAL || supportCategory == SupportCategory.LEGAL_AID) {
if (supportCategory == SupportCategory.MEDICAL || supportCategory == SupportCategory.LEGAL_AID || supportCategory == SupportCategory.EDUCATION) {
bank = supportPost.getBank();
account = supportPost.getAccount();
} else {
Expand Down

0 comments on commit 4361c77

Please sign in to comment.