Skip to content

Commit a6e403e

Browse files
authored
Hotfix : 파티 생성시 선택값들이 존재할 경우만 넣도록 수정 (#55)
hotfix : 선택 값들이 존재할때만 넣도록 수정
1 parent ca901b5 commit a6e403e

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ out/
3939
.env
4040
.terraform
4141
*.pem
42+
/src/main/resources/firebase

src/main/java/ita/tinybite/domain/party/entity/Party.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public class Party {
7676
private LocalDateTime createdAt; // 등록시간
7777

7878
@UpdateTimestamp
79-
@Column(nullable = false)
8079
private LocalDateTime updatedAt;
8180

8281
private LocalDateTime closedAt;

src/main/java/ita/tinybite/domain/party/service/PartyService.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,11 @@ public Long createParty(Long userId, PartyCreateRequest request) {
6161
.maxParticipants(request.getMaxParticipants())
6262
.pickupLocation(PickupLocation.builder()
6363
.place(request.getPickupLocation().getPlace())
64-
// .pickupLatitude(request.getPickupLocation().getPickupLatitude())
65-
// .pickupLongitude(request.getPickupLocation().getPickupLongitude())
6664
.build())
67-
.image(request.getImages().get(0))
68-
.thumbnailImage(thumbnailImage)
69-
.link(request.getProductLink())
70-
.description(request.getDescription())
65+
.image(getImageIfPresent(request.getImages()))
66+
.thumbnailImage(getThumbnailIfPresent(request.getImages(), request.getCategory()))
67+
.link(getLinkIfValid(request.getProductLink(), request.getCategory()))
68+
.description(getDescriptionIfPresent(request.getDescription()))
7169
.currentParticipants(1)
7270
.status(PartyStatus.RECRUITING)
7371
.isClosed(false)
@@ -601,5 +599,29 @@ private void checkAndCloseIfFull(Party party) {
601599
party.close();
602600
}
603601
}
602+
603+
// 헬퍼 메서드들
604+
private String getImageIfPresent(List<String> images) {
605+
return (images != null && !images.isEmpty()) ? images.get(0) : null;
606+
}
607+
608+
private String getThumbnailIfPresent(List<String> images, PartyCategory category) {
609+
if (images != null && !images.isEmpty()) {
610+
return images.get(0);
611+
}
612+
return null;
613+
}
614+
615+
private String getLinkIfValid(String link, PartyCategory category) {
616+
if (link != null && !link.isBlank()) {
617+
validateProductLink(category, link);
618+
return link;
619+
}
620+
return null;
621+
}
622+
623+
private String getDescriptionIfPresent(String description) {
624+
return (description != null && !description.isBlank()) ? description : null;
625+
}
604626
}
605627

0 commit comments

Comments
 (0)