Skip to content

Commit

Permalink
refactor: 매퍼 매핑 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonyworld committed Jan 21, 2025
1 parent 6f2ef2a commit b170b64
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
import org.sopt.makers.crew.main.entity.lightning.enums.LightningTimingType;
import org.sopt.makers.crew.main.entity.meeting.vo.ImageUrlVO;
import org.sopt.makers.crew.main.global.util.Time;
import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyWithoutWelcomeMessageDto;
import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForLightningResponseDto;

@Mapper(componentModel = "spring")
public interface LightningMapper {

@Mapping(source = "lightningBody.files", target = "imageURL", qualifiedByName = "getImageURL")
@Mapping(source = "lightningBody.activityStartDate", target = "activityStartDate", qualifiedByName = "getActivityStartDate")
@Mapping(source = "lightningBody.activityEndDate", target = "activityEndDate", qualifiedByName = "getActivityEndDate")
@Mapping(source = "lightningBody.lightningPlaceType", target = "lightningPlaceType", qualifiedByName = "getLightningPlaceType")
@Mapping(source = "lightningBody.lightningTimingType", target = "lightningTimingType", qualifiedByName = "getLightningTimingType")
@Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.files", target = "imageURL", qualifiedByName = "getImageURL")
@Mapping(target = "startDate", expression = "java(time.now())")
@Mapping(source = "lightningBody.activityStartDate", target = "endDate", qualifiedByName = "getActivityStartDate")
Lightning toLightningEntity(LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody,
@Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.activityStartDate", target = "endDate", qualifiedByName = "getActivityStartDate")
@Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.activityStartDate", target = "activityStartDate", qualifiedByName = "getActivityStartDate")
@Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.activityEndDate", target = "activityEndDate", qualifiedByName = "getActivityEndDate")
@Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.lightningPlaceType", target = "lightningPlaceType", qualifiedByName = "getLightningPlaceType")
@Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.lightningTimingType", target = "lightningTimingType", qualifiedByName = "getLightningTimingType")
Lightning toLightningEntity(
MeetingV2CreateMeetingForLightningResponseDto meetingV2CreateMeetingForLightningResponseDto,
Integer createdGeneration, Integer leaderUserId, Time time);

@Named("getImageURL")
Expand All @@ -47,7 +47,6 @@ static LocalDateTime getActivityStartDate(String date) {
@Named("getActivityEndDate")
static LocalDateTime getActivityEndDate(String date) {
return LocalDateTime.parse(date + DAY_END_TIME, DateTimeFormatter.ofPattern(DAY_TIME_FORMAT));

}

@Named("getLightningPlaceType")
Expand Down

0 comments on commit b170b64

Please sign in to comment.