@@ -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