From 96ebe1fb553c19a84aa1ae8a5401b0b04707e9a8 Mon Sep 17 00:00:00 2001 From: DongHoon Lee <125895298+hoonyworld@users.noreply.github.com> Date: Sat, 25 Jan 2025 12:34:37 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EB=B2=88=EC=A9=8D=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20lightning=20?= =?UTF-8?q?->=20flash=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#544)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 환경 설정 관련 도메인 네이밍 변경 * chore: 서비스 로직 관련 도메인 네이밍 변경 * chore: 모임 관련 번쩍 네이밍 변경 * chore: 태그 관련 번쩍 네이밍 변경 * chore: 에러메시지 관련 번쩍 네이밍 변경 * chore: enum value에 공백 추가 * refactor: 반환 변수 네이밍 변경 --- .../Lightning.java => flash/Flash.java} | 52 ++++++++-------- .../main/entity/flash/FlashRepository.java | 9 +++ .../converter/FlashPlaceTypeConverter.java | 20 +++++++ .../converter/FlashTimingTypeConverter.java | 20 +++++++ .../entity/flash/enums/FlashPlaceType.java | 25 ++++++++ .../entity/flash/enums/FlashTimingType.java | 24 ++++++++ .../entity/lightning/LightningRepository.java | 9 --- .../LightningPlaceTypeConverter.java | 20 ------- .../LightningTimingTypeConverter.java | 20 ------- .../lightning/enums/LightningPlaceType.java | 25 -------- .../lightning/enums/LightningTimingType.java | 24 -------- .../crew/main/entity/meeting/Meeting.java | 4 +- .../entity/meeting/enums/MeetingCategory.java | 4 +- .../sopt/makers/crew/main/entity/tag/Tag.java | 16 ++--- .../crew/main/entity/tag/TagRepository.java | 2 +- .../crew/main/entity/tag/enums/TagType.java | 2 +- .../v2/FlashV2Api.java} | 18 +++--- .../crew/main/flash/v2/FlashV2Controller.java | 48 +++++++++++++++ .../main/flash/v2/dto/mapper/FlashMapper.java | 59 +++++++++++++++++++ .../request/FlashV2CreateFlashBodyDto.java} | 8 +-- ...ateFlashBodyWithoutWelcomeMessageDto.java} | 14 ++--- .../FlashV2CreateFlashResponseDto.java | 15 +++++ ...lashV2GetFlashByMeetingIdResponseDto.java} | 54 ++++++++--------- .../main/flash/v2/service/FlashV2Service.java | 12 ++++ .../v2/service/FlashV2ServiceImpl.java} | 56 +++++++++--------- .../crew/main/global/config/ImageSetting.java | 2 +- .../global/config/ImageSettingConfig.java | 8 +-- .../main/global/exception/ErrorStatus.java | 2 +- .../lightning/v2/LightningV2Controller.java | 48 --------------- .../v2/dto/mapper/LightningMapper.java | 59 ------------------- ...LightningV2CreateLightningResponseDto.java | 15 ----- .../v2/service/LightningV2Service.java | 12 ---- ...ngV2CreateMeetingForFlashResponseDto.java} | 40 ++++++------- .../meeting/v2/service/MeetingV2Service.java | 8 +-- .../v2/service/MeetingV2ServiceImpl.java | 28 ++++----- .../TagV2CreateFlashTagResponseDto.java | 15 +++++ .../response/TagV2CreateTagResponseDto.java | 15 ----- .../main/tag/v2/service/TagV2Service.java | 6 +- .../main/tag/v2/service/TagV2ServiceImpl.java | 24 ++++---- main/src/main/resources/application-dev.yml | 4 +- main/src/main/resources/application-local.yml | 2 +- main/src/main/resources/application-prod.yml | 2 +- main/src/main/resources/application-test.yml | 2 +- 43 files changed, 426 insertions(+), 426 deletions(-) rename main/src/main/java/org/sopt/makers/crew/main/entity/{lightning/Lightning.java => flash/Flash.java} (65%) create mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/flash/FlashRepository.java create mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashPlaceTypeConverter.java create mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashTimingTypeConverter.java create mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashPlaceType.java create mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashTimingType.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/lightning/LightningRepository.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningPlaceTypeConverter.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningTimingTypeConverter.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningPlaceType.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningTimingType.java rename main/src/main/java/org/sopt/makers/crew/main/{lightning/v2/LightningV2Api.java => flash/v2/FlashV2Api.java} (61%) create mode 100644 main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Controller.java create mode 100644 main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/mapper/FlashMapper.java rename main/src/main/java/org/sopt/makers/crew/main/{lightning/v2/dto/request/LightningV2CreateLightningBodyDto.java => flash/v2/dto/request/FlashV2CreateFlashBodyDto.java} (56%) rename main/src/main/java/org/sopt/makers/crew/main/{lightning/v2/dto/request/LightningV2CreateLightningBodyWithoutWelcomeMessageDto.java => flash/v2/dto/request/FlashV2CreateFlashBodyWithoutWelcomeMessageDto.java} (75%) create mode 100644 main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2CreateFlashResponseDto.java rename main/src/main/java/org/sopt/makers/crew/main/{lightning/v2/dto/response/LightningV2GetLightningByMeetingIdResponseDto.java => flash/v2/dto/response/FlashV2GetFlashByMeetingIdResponseDto.java} (77%) create mode 100644 main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2Service.java rename main/src/main/java/org/sopt/makers/crew/main/{lightning/v2/service/LightningV2ServiceImpl.java => flash/v2/service/FlashV2ServiceImpl.java} (60%) delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Controller.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/mapper/LightningMapper.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2CreateLightningResponseDto.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2Service.java rename main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/{MeetingV2CreateMeetingForLightningResponseDto.java => MeetingV2CreateMeetingForFlashResponseDto.java} (61%) create mode 100644 main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateFlashTagResponseDto.java delete mode 100644 main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateTagResponseDto.java diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/Lightning.java b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/Flash.java similarity index 65% rename from main/src/main/java/org/sopt/makers/crew/main/entity/lightning/Lightning.java rename to main/src/main/java/org/sopt/makers/crew/main/entity/flash/Flash.java index 6b852110..0220113a 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/Lightning.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/Flash.java @@ -1,14 +1,14 @@ -package org.sopt.makers.crew.main.entity.lightning; +package org.sopt.makers.crew.main.entity.flash; import java.time.LocalDateTime; import java.util.List; import org.hibernate.annotations.Type; import org.sopt.makers.crew.main.entity.common.BaseTimeEntity; -import org.sopt.makers.crew.main.entity.lightning.converter.LightningPlaceTypeConverter; -import org.sopt.makers.crew.main.entity.lightning.converter.LightningTimingTypeConverter; -import org.sopt.makers.crew.main.entity.lightning.enums.LightningPlaceType; -import org.sopt.makers.crew.main.entity.lightning.enums.LightningTimingType; +import org.sopt.makers.crew.main.entity.flash.converter.FlashPlaceTypeConverter; +import org.sopt.makers.crew.main.entity.flash.converter.FlashTimingTypeConverter; +import org.sopt.makers.crew.main.entity.flash.enums.FlashPlaceType; +import org.sopt.makers.crew.main.entity.flash.enums.FlashTimingType; import org.sopt.makers.crew.main.entity.meeting.enums.EnMeetingStatus; import org.sopt.makers.crew.main.entity.meeting.vo.ImageUrlVO; @@ -30,8 +30,8 @@ @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@Table(name = "lightning") -public class Lightning extends BaseTimeEntity { +@Table(name = "flash") +public class Flash extends BaseTimeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @@ -52,10 +52,10 @@ public class Lightning extends BaseTimeEntity { @Column(name = "desc", columnDefinition = "TEXT") private String desc; - @Column(name = "lightningTimingType") + @Column(name = "flashTimingType") @NotNull - @Convert(converter = LightningTimingTypeConverter.class) - private LightningTimingType lightningTimingType; + @Convert(converter = FlashTimingTypeConverter.class) + private FlashTimingType flashTimingType; @Column(name = "startDate") @NotNull @@ -73,13 +73,13 @@ public class Lightning extends BaseTimeEntity { @NotNull private LocalDateTime activityEndDate; - @Column(name = "lightningPlaceType") + @Column(name = "flashPlaceType") @NotNull - @Convert(converter = LightningPlaceTypeConverter.class) - private LightningPlaceType lightningPlaceType; + @Convert(converter = FlashPlaceTypeConverter.class) + private FlashPlaceType flashPlaceType; - @Column(name = "lightningPlace") - private String lightningPlace; + @Column(name = "flashPlace") + private String flashPlace; @Column(name = "minimumCapacity") @NotNull @@ -98,38 +98,38 @@ public class Lightning extends BaseTimeEntity { private List imageURL; @Builder - public Lightning(Integer leaderUserId, Integer meetingId, String title, String desc, - LightningTimingType lightningTimingType, + public Flash(Integer leaderUserId, Integer meetingId, String title, String desc, + FlashTimingType flashTimingType, LocalDateTime startDate, LocalDateTime endDate, - LocalDateTime activityStartDate, LocalDateTime activityEndDate, LightningPlaceType lightningPlaceType, - String lightningPlace, int minimumCapacity, int maximumCapacity, Integer createdGeneration, + LocalDateTime activityStartDate, LocalDateTime activityEndDate, FlashPlaceType flashPlaceType, + String flashPlace, int minimumCapacity, int maximumCapacity, Integer createdGeneration, List imageURL) { this.leaderUserId = leaderUserId; this.meetingId = meetingId; this.title = title; this.desc = desc; - this.lightningTimingType = lightningTimingType; + this.flashTimingType = flashTimingType; this.startDate = startDate; this.endDate = endDate; this.activityStartDate = activityStartDate; this.activityEndDate = activityEndDate; - this.lightningPlaceType = lightningPlaceType; - this.lightningPlace = lightningPlace; + this.flashPlaceType = flashPlaceType; + this.flashPlace = flashPlace; this.minimumCapacity = minimumCapacity; this.maximumCapacity = maximumCapacity; this.createdGeneration = createdGeneration; this.imageURL = imageURL; } - public boolean checkLightningMeetingLeader(Integer userId) { + public boolean checkFlashMeetingLeader(Integer userId) { return this.leaderUserId.equals(userId); } - public int getLightningMeetingStatusValue(LocalDateTime now) { - return getLightningMeetingStatus(now).getValue(); + public int getFlashMeetingStatusValue(LocalDateTime now) { + return getFlashMeetingStatus(now).getValue(); } - public EnMeetingStatus getLightningMeetingStatus(LocalDateTime now) { + public EnMeetingStatus getFlashMeetingStatus(LocalDateTime now) { if (now.isBefore(startDate)) { return EnMeetingStatus.BEFORE_START; } diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/flash/FlashRepository.java b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/FlashRepository.java new file mode 100644 index 00000000..7626dbb5 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/FlashRepository.java @@ -0,0 +1,9 @@ +package org.sopt.makers.crew.main.entity.flash; + +import java.util.Optional; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface FlashRepository extends JpaRepository { + Optional findByMeetingId(Integer meetingId); +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashPlaceTypeConverter.java b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashPlaceTypeConverter.java new file mode 100644 index 00000000..6b9c5bc3 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashPlaceTypeConverter.java @@ -0,0 +1,20 @@ +package org.sopt.makers.crew.main.entity.flash.converter; + +import org.sopt.makers.crew.main.entity.flash.enums.FlashPlaceType; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class FlashPlaceTypeConverter implements AttributeConverter { + + @Override + public String convertToDatabaseColumn(FlashPlaceType flashPlaceType) { + return flashPlaceType.getValue(); // FlashPlaceType의 값을 반환 + } + + @Override + public FlashPlaceType convertToEntityAttribute(String dbData) { + return FlashPlaceType.ofValue(dbData); // dbData에 해당하는 FlashPlaceType 객체를 반환 + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashTimingTypeConverter.java b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashTimingTypeConverter.java new file mode 100644 index 00000000..be089689 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/converter/FlashTimingTypeConverter.java @@ -0,0 +1,20 @@ +package org.sopt.makers.crew.main.entity.flash.converter; + +import org.sopt.makers.crew.main.entity.flash.enums.FlashTimingType; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class FlashTimingTypeConverter implements AttributeConverter { + + @Override + public String convertToDatabaseColumn(FlashTimingType flashTimingType) { + return flashTimingType.getValue(); // FlashTimingType의 값을 반환 + } + + @Override + public FlashTimingType convertToEntityAttribute(String dbData) { + return FlashTimingType.ofValue(dbData); // dbData에 해당하는 FlashTimingType 객체를 반환 + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashPlaceType.java b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashPlaceType.java new file mode 100644 index 00000000..b9d75446 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashPlaceType.java @@ -0,0 +1,25 @@ +package org.sopt.makers.crew.main.entity.flash.enums; + +import lombok.Getter; + +@Getter +public enum FlashPlaceType { + OFFLINE("오프라인"), + ONLINE("온라인"), + AFTER_DISCUSSION("협의 후 결정"); + + private final String value; + + FlashPlaceType(String value) { + this.value = value; + } + + public static FlashPlaceType ofValue(String dbData) { + for (FlashPlaceType place : FlashPlaceType.values()) { + if (place.getValue().equals(dbData)) { + return place; + } + } + throw new IllegalArgumentException("Invalid FlashPlaceType value: " + dbData); + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashTimingType.java b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashTimingType.java new file mode 100644 index 00000000..68caf564 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/flash/enums/FlashTimingType.java @@ -0,0 +1,24 @@ +package org.sopt.makers.crew.main.entity.flash.enums; + +import lombok.Getter; + +@Getter +public enum FlashTimingType { + IMMEDIATE("당일"), + AFTER_DISCUSSION("예정 기간 (협의 후 결정)"); + + private final String value; + + FlashTimingType(String value) { + this.value = value; + } + + public static FlashTimingType ofValue(String dbData) { + for (FlashTimingType timing : FlashTimingType.values()) { + if (timing.getValue().equals(dbData)) { + return timing; + } + } + throw new IllegalArgumentException("Invalid FlashTimingType value: " + dbData); + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/LightningRepository.java b/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/LightningRepository.java deleted file mode 100644 index dd6fee97..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/LightningRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.crew.main.entity.lightning; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -public interface LightningRepository extends JpaRepository { - Optional findByMeetingId(Integer meetingId); -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningPlaceTypeConverter.java b/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningPlaceTypeConverter.java deleted file mode 100644 index b82794ac..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningPlaceTypeConverter.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.sopt.makers.crew.main.entity.lightning.converter; - -import org.sopt.makers.crew.main.entity.lightning.enums.LightningPlaceType; - -import jakarta.persistence.AttributeConverter; -import jakarta.persistence.Converter; - -@Converter -public class LightningPlaceTypeConverter implements AttributeConverter { - - @Override - public String convertToDatabaseColumn(LightningPlaceType lightningPlaceType) { - return lightningPlaceType.getValue(); // LightningPlaceType의 값을 반환 - } - - @Override - public LightningPlaceType convertToEntityAttribute(String dbData) { - return LightningPlaceType.ofValue(dbData); // dbData에 해당하는 LightningPlaceType 객체를 반환 - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningTimingTypeConverter.java b/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningTimingTypeConverter.java deleted file mode 100644 index 7b33f456..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/converter/LightningTimingTypeConverter.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.sopt.makers.crew.main.entity.lightning.converter; - -import org.sopt.makers.crew.main.entity.lightning.enums.LightningTimingType; - -import jakarta.persistence.AttributeConverter; -import jakarta.persistence.Converter; - -@Converter -public class LightningTimingTypeConverter implements AttributeConverter { - - @Override - public String convertToDatabaseColumn(LightningTimingType lightningTimingType) { - return lightningTimingType.getValue(); // LightningTimingType의 값을 반환 - } - - @Override - public LightningTimingType convertToEntityAttribute(String dbData) { - return LightningTimingType.ofValue(dbData); // dbData에 해당하는 LightningTimingType 객체를 반환 - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningPlaceType.java b/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningPlaceType.java deleted file mode 100644 index 629a218f..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningPlaceType.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.sopt.makers.crew.main.entity.lightning.enums; - -import lombok.Getter; - -@Getter -public enum LightningPlaceType { - OFFLINE("오프라인"), - ONLINE("온라인"), - AFTER_DISCUSSION("협의 후 결정"); - - private final String value; - - LightningPlaceType(String value) { - this.value = value; - } - - public static LightningPlaceType ofValue(String dbData) { - for (LightningPlaceType place : LightningPlaceType.values()) { - if (place.getValue().equals(dbData)) { - return place; - } - } - throw new IllegalArgumentException("Invalid LightningPlaceType value: " + dbData); - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningTimingType.java b/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningTimingType.java deleted file mode 100644 index 1d7770ce..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/lightning/enums/LightningTimingType.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.sopt.makers.crew.main.entity.lightning.enums; - -import lombok.Getter; - -@Getter -public enum LightningTimingType { - IMMEDIATE("당일"), - AFTER_DISCUSSION("예정 기간(협의 후 결정)"); - - private final String value; - - LightningTimingType(String value) { - this.value = value; - } - - public static LightningTimingType ofValue(String dbData) { - for (LightningTimingType timing : LightningTimingType.values()) { - if (timing.getValue().equals(dbData)) { - return timing; - } - } - throw new IllegalArgumentException("Invalid LightningTimingType value: " + dbData); - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/Meeting.java b/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/Meeting.java index c2b362c3..b14e93a6 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/Meeting.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/Meeting.java @@ -195,7 +195,7 @@ public Meeting(User user, Integer userId, String title, MeetingCategory category this.joinableParts = joinableParts; } - public static Meeting createLightningMeeting(User user, Integer userId, String title, + public static Meeting createFlashMeeting(User user, Integer userId, String title, List imageURL, LocalDateTime startDate, LocalDateTime endDate, Integer capacity, String desc, LocalDateTime mStartDate, LocalDateTime mEndDate, @@ -205,7 +205,7 @@ public static Meeting createLightningMeeting(User user, Integer userId, String t .user(user) .userId(userId) .title(title) - .category(MeetingCategory.LIGHTNING) + .category(MeetingCategory.FLASH) .imageURL(imageURL) .startDate(startDate) .endDate(endDate) diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/enums/MeetingCategory.java b/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/enums/MeetingCategory.java index 8bdf0522..4fbac67a 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/enums/MeetingCategory.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/enums/MeetingCategory.java @@ -7,7 +7,7 @@ public enum MeetingCategory { STUDY("스터디"), LECTURE("강연"), - LIGHTNING("번쩍"), + FLASH("번쩍"), EVENT("행사"), SEMINAR("세미나"); @@ -26,4 +26,4 @@ public static MeetingCategory ofValue(String dbData) { public String getValue() { return value; } -} \ No newline at end of file +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/tag/Tag.java b/main/src/main/java/org/sopt/makers/crew/main/entity/tag/Tag.java index f247d23e..17e9d8cf 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/tag/Tag.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/tag/Tag.java @@ -34,7 +34,7 @@ public class Tag extends BaseTimeEntity { /** * @implSpec : 모임태그 or 번쩍태그 구분 - * @implNote : 모임태그일 경우, lightningId == null + * @implNote : 모임태그일 경우, flashId == null * @implNote : 번쩍태그일 경우, meetingId == null * */ @Enumerated(EnumType.STRING) @@ -45,18 +45,18 @@ public class Tag extends BaseTimeEntity { @Column(name = "meetingId") private Integer meetingId; - @Column(name = "lightningId") - private Integer lightningId; + @Column(name = "flashId") + private Integer flashId; @Column(name = "welcomeMessageTypes", columnDefinition = "jsonb") @Type(JsonBinaryType.class) private List welcomeMessageTypes; @Builder - private Tag(TagType tagType, Integer meetingId, Integer lightningId, List welcomeMessageTypes) { + private Tag(TagType tagType, Integer meetingId, Integer flashId, List welcomeMessageTypes) { this.tagType = tagType; this.meetingId = meetingId; - this.lightningId = lightningId; + this.flashId = flashId; this.welcomeMessageTypes = welcomeMessageTypes; } @@ -65,17 +65,17 @@ public static Tag createGeneralMeetingTag(TagType tagType, Integer meetingId, return Tag.builder() .tagType(tagType) .meetingId(meetingId) - .lightningId(null) + .flashId(null) .welcomeMessageTypes(welcomeMessageTypes) .build(); } - public static Tag createLightningMeetingTag(TagType tagType, Integer lightningId, + public static Tag createFlashMeetingTag(TagType tagType, Integer flashId, List welcomeMessageTypes) { return Tag.builder() .tagType(tagType) .meetingId(null) - .lightningId(lightningId) + .flashId(flashId) .welcomeMessageTypes(welcomeMessageTypes) .build(); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/tag/TagRepository.java b/main/src/main/java/org/sopt/makers/crew/main/entity/tag/TagRepository.java index 5a519390..f356fee6 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/tag/TagRepository.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/tag/TagRepository.java @@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository; public interface TagRepository extends JpaRepository { - Optional findByLightningId(Integer lightningId); + Optional findByFlashId(Integer flashId); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/tag/enums/TagType.java b/main/src/main/java/org/sopt/makers/crew/main/entity/tag/enums/TagType.java index 7bcf5d57..2d2e575d 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/tag/enums/TagType.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/tag/enums/TagType.java @@ -2,5 +2,5 @@ public enum TagType { MEETING, - LIGHTNING + FLASH } diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Api.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Api.java similarity index 61% rename from main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Api.java rename to main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Api.java index 4fcdd87b..a2c8d00c 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Api.java +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Api.java @@ -1,10 +1,10 @@ -package org.sopt.makers.crew.main.lightning.v2; +package org.sopt.makers.crew.main.flash.v2; import java.security.Principal; -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2CreateLightningResponseDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2GetLightningByMeetingIdResponseDto; +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2CreateFlashResponseDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2GetFlashByMeetingIdResponseDto; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -17,15 +17,15 @@ import jakarta.validation.Valid; @Tag(name = "번쩍 모임") -public interface LightningV2Api { +public interface FlashV2Api { @Operation(summary = "번쩍 모임 생성") @ApiResponses(value = { - @ApiResponse(responseCode = "201", description = "lightningId: 10"), + @ApiResponse(responseCode = "201", description = "meetingId: 10"), @ApiResponse(responseCode = "400", description = "VALIDATION_EXCEPTION", content = @Content), }) - ResponseEntity createLightning( - @Valid @RequestBody LightningV2CreateLightningBodyDto requestBody, + ResponseEntity createFlash( + @Valid @RequestBody FlashV2CreateFlashBodyDto requestBody, Principal principal); @Operation(summary = "번쩍 모임 상세 조회") @@ -33,7 +33,7 @@ ResponseEntity createLightning( @ApiResponse(responseCode = "200", description = "번쩍 모임 상세 조회 성공"), @ApiResponse(responseCode = "400", description = "번쩍 모임이 없습니다.", content = @Content), }) - ResponseEntity getLightningByMeetingId( + ResponseEntity getFlashByMeetingId( @PathVariable Integer meetingId, Principal principal); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Controller.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Controller.java new file mode 100644 index 00000000..3af7111e --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/FlashV2Controller.java @@ -0,0 +1,48 @@ +package org.sopt.makers.crew.main.flash.v2; + +import java.security.Principal; + +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2CreateFlashResponseDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2GetFlashByMeetingIdResponseDto; +import org.sopt.makers.crew.main.flash.v2.service.FlashV2Service; +import org.sopt.makers.crew.main.global.util.UserUtil; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; + +@RestController +@RequestMapping("/flash/v2") +@RequiredArgsConstructor +public class FlashV2Controller implements FlashV2Api { + private final FlashV2Service flashV2Service; + + @Override + @PostMapping + public ResponseEntity createFlash( + @Valid @RequestBody FlashV2CreateFlashBodyDto requestBody, + Principal principal + ) { + Integer userId = UserUtil.getUserId(principal); + return ResponseEntity.status(HttpStatus.CREATED).body(flashV2Service.createFlash(requestBody, userId)); + } + + @Override + @GetMapping("{meetingId}") + public ResponseEntity getFlashByMeetingId( + @PathVariable Integer meetingId, + Principal principal + ) { + Integer userId = UserUtil.getUserId(principal); + + return ResponseEntity.ok(flashV2Service.getFlashByMeetingId(meetingId, userId)); + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/mapper/FlashMapper.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/mapper/FlashMapper.java new file mode 100644 index 00000000..b1755cd0 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/mapper/FlashMapper.java @@ -0,0 +1,59 @@ +package org.sopt.makers.crew.main.flash.v2.dto.mapper; + +import static org.sopt.makers.crew.main.global.constant.CrewConst.*; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.stream.IntStream; + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Named; +import org.sopt.makers.crew.main.entity.flash.Flash; +import org.sopt.makers.crew.main.entity.flash.enums.FlashPlaceType; +import org.sopt.makers.crew.main.entity.flash.enums.FlashTimingType; +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.meeting.v2.dto.response.MeetingV2CreateMeetingForFlashResponseDto; + +@Mapper(componentModel = "spring") +public interface FlashMapper { + @Mapping(source = "meetingV2CreateMeetingForFlashResponseDto.files", target = "imageURL", qualifiedByName = "getImageURL") + @Mapping(target = "startDate", expression = "java(time.now())") + @Mapping(source = "meetingV2CreateMeetingForFlashResponseDto.activityStartDate", target = "endDate", qualifiedByName = "getActivityStartDate") + @Mapping(source = "meetingV2CreateMeetingForFlashResponseDto.activityStartDate", target = "activityStartDate", qualifiedByName = "getActivityStartDate") + @Mapping(source = "meetingV2CreateMeetingForFlashResponseDto.activityEndDate", target = "activityEndDate", qualifiedByName = "getActivityEndDate") + @Mapping(source = "meetingV2CreateMeetingForFlashResponseDto.flashPlaceType", target = "flashPlaceType", qualifiedByName = "getFlashPlaceType") + @Mapping(source = "meetingV2CreateMeetingForFlashResponseDto.flashTimingType", target = "flashTimingType", qualifiedByName = "getFlashTimingType") + Flash toFlashntity( + MeetingV2CreateMeetingForFlashResponseDto meetingV2CreateMeetingForFlashResponseDto, + Integer createdGeneration, Integer leaderUserId, Time time); + + @Named("getImageURL") + static List getImageURL(List files) { + return IntStream.range(0, files.size()) + .mapToObj(index -> new ImageUrlVO(index, files.get(index))) + .toList(); + } + + @Named("getActivityStartDate") + static LocalDateTime getActivityStartDate(String date) { + return LocalDateTime.parse(date + DAY_START_TIME, DateTimeFormatter.ofPattern(DAY_TIME_FORMAT)); + } + + @Named("getActivityEndDate") + static LocalDateTime getActivityEndDate(String date) { + return LocalDateTime.parse(date + DAY_END_TIME, DateTimeFormatter.ofPattern(DAY_TIME_FORMAT)); + } + + @Named("getFlashPlaceType") + static FlashPlaceType getFlashPlaceType(String placeType) { + return FlashPlaceType.ofValue(placeType); + } + + @Named("getFlashTimingType") + static FlashTimingType getFlashTimingType(String timingType) { + return FlashTimingType.ofValue(timingType); + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/request/LightningV2CreateLightningBodyDto.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/request/FlashV2CreateFlashBodyDto.java similarity index 56% rename from main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/request/LightningV2CreateLightningBodyDto.java rename to main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/request/FlashV2CreateFlashBodyDto.java index 1ecfcaa3..d244eca2 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/request/LightningV2CreateLightningBodyDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/request/FlashV2CreateFlashBodyDto.java @@ -1,4 +1,4 @@ -package org.sopt.makers.crew.main.lightning.v2.dto.request; +package org.sopt.makers.crew.main.flash.v2.dto.request; import java.util.List; @@ -6,12 +6,12 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; -@Schema(name = "LightningV2CreateLightningBodyDto", description = "번쩍 모임 생성 및 수정 request body dto") -public record LightningV2CreateLightningBodyDto( +@Schema(name = "FlashV2CreateFlashBodyDto", description = "번쩍 모임 생성 및 수정 request body dto") +public record FlashV2CreateFlashBodyDto( @Schema(description = "번쩍 모임 생성 및 수정 request body") @NotNull @Valid - LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody, + FlashV2CreateFlashBodyWithoutWelcomeMessageDto flashBody, @Schema(example = "[\"YB 환영\", \"OB 환영\"]", description = "환영 메시지 타입 리스트") List welcomeMessageTypes diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/request/LightningV2CreateLightningBodyWithoutWelcomeMessageDto.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/request/FlashV2CreateFlashBodyWithoutWelcomeMessageDto.java similarity index 75% rename from main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/request/LightningV2CreateLightningBodyWithoutWelcomeMessageDto.java rename to main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/request/FlashV2CreateFlashBodyWithoutWelcomeMessageDto.java index 27249c6c..7bb2c0b2 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/request/LightningV2CreateLightningBodyWithoutWelcomeMessageDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/request/FlashV2CreateFlashBodyWithoutWelcomeMessageDto.java @@ -1,4 +1,4 @@ -package org.sopt.makers.crew.main.lightning.v2.dto.request; +package org.sopt.makers.crew.main.flash.v2.dto.request; import java.util.List; @@ -8,8 +8,8 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; -@Schema(name = "LightningV2CreateLightningBodyWithoutWelcomeMessageDto", description = "번쩍 모임 생성 및 수정 request body dto (환영 메시지 타입 제외)") -public record LightningV2CreateLightningBodyWithoutWelcomeMessageDto( +@Schema(name = "FlashV2CreateFlashBodyWithoutWelcomeMessageDto", description = "번쩍 모임 생성 및 수정 request body dto (환영 메시지 타입 제외)") +public record FlashV2CreateFlashBodyWithoutWelcomeMessageDto( @Schema(example = "알고보면 쓸데있는 개발 프로세스", description = "번쩍 모임 제목") @Size(min = 1, max = 30) @NotNull String title, @@ -19,9 +19,9 @@ public record LightningV2CreateLightningBodyWithoutWelcomeMessageDto( @NotNull String desc, - @Schema(example = "예정 기간(협의 후 결정)", description = "번쩍 일정 결정 방식") + @Schema(example = "예정 기간 (협의 후 결정)", description = "번쩍 일정 결정 방식") @NotNull - String lightningTimingType, + String flashTimingType, @Schema(example = "2025.10.29", description = "번쩍 활동 시작 날짜", name = "activityStartDate") @NotNull @@ -33,10 +33,10 @@ public record LightningV2CreateLightningBodyWithoutWelcomeMessageDto( @Schema(example = "오프라인", description = "모임 장소 Tag") @NotNull - String lightningPlaceType, + String flashPlaceType, @Schema(example = "잠실역 5번 출구", description = "모임 장소") - String lightningPlace, + String flashPlace, @Schema(example = "1", description = "최소 모집 인원") @Min(1) diff --git a/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2CreateFlashResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2CreateFlashResponseDto.java new file mode 100644 index 00000000..d3e62f2b --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2CreateFlashResponseDto.java @@ -0,0 +1,15 @@ +package org.sopt.makers.crew.main.flash.v2.dto.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; + +@Schema(name = "FlashV2CreateFlashResponseDto", description = "번쩍 모임 생성 응답 Dto") +public record FlashV2CreateFlashResponseDto( + @Schema(description = "모임 id - 번쩍 카테고리", example = "1") + @NotNull + Integer meetingId +) { + public static FlashV2CreateFlashResponseDto from(Integer meetingId) { + return new FlashV2CreateFlashResponseDto(meetingId); + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2GetLightningByMeetingIdResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2GetFlashByMeetingIdResponseDto.java similarity index 77% rename from main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2GetLightningByMeetingIdResponseDto.java rename to main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2GetFlashByMeetingIdResponseDto.java index 6c8f4ca4..9e731dc0 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2GetLightningByMeetingIdResponseDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/dto/response/FlashV2GetFlashByMeetingIdResponseDto.java @@ -1,9 +1,9 @@ -package org.sopt.makers.crew.main.lightning.v2.dto.response; +package org.sopt.makers.crew.main.flash.v2.dto.response; import java.time.LocalDateTime; import java.util.List; -import org.sopt.makers.crew.main.entity.lightning.Lightning; +import org.sopt.makers.crew.main.entity.flash.Flash; import org.sopt.makers.crew.main.entity.meeting.enums.MeetingCategory; import org.sopt.makers.crew.main.entity.meeting.vo.ImageUrlVO; import org.sopt.makers.crew.main.entity.tag.enums.WelcomeMessageType; @@ -16,8 +16,8 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; -@Schema(description = "번쩍 상세 조회 dto") -public record LightningV2GetLightningByMeetingIdResponseDto( +@Schema(name = "FlashV2GetFlashByMeetingIdResponseDto", description = "번쩍 상세 조회 dto") +public record FlashV2GetFlashByMeetingIdResponseDto( @Schema(description = "모임 id", example = "2") @NotNull @@ -71,17 +71,17 @@ public record LightningV2GetLightningByMeetingIdResponseDto( @NotNull LocalDateTime activityEndDate, - @Schema(description = "번쩍 일시 타입", example = "예정 기간(협의 후 결정)") + @Schema(description = "번쩍 일시 타입", example = "예정 기간 (협의 후 결정)") @NotNull - String timingType, + String flashTimingType, @Schema(description = "번쩍 장소 타입", example = "온라인") @NotNull - String placeType, + String flashPlaceType, @Schema(description = "번쩍 장소", example = "Zoom 링크") @NotNull - String place, + String flashPlace, @Schema(description = "개설 기수", example = "36") @NotNull @@ -117,9 +117,9 @@ public record LightningV2GetLightningByMeetingIdResponseDto( List appliedInfo ) { - public static LightningV2GetLightningByMeetingIdResponseDto of( + public static FlashV2GetFlashByMeetingIdResponseDto of( Integer meetingId, - Lightning lightning, + Flash flash, List welcomeMessageTypes, long approvedCount, boolean isHost, @@ -130,29 +130,29 @@ public static LightningV2GetLightningByMeetingIdResponseDto of( LocalDateTime now ) { - int lightningMeetingStatus = lightning.getLightningMeetingStatusValue(now); + int flashMeetingStatus = flash.getFlashMeetingStatusValue(now); List welcomeMessageTypeValues = welcomeMessageTypes.stream() .map(WelcomeMessageType::getValue) .toList(); - return new LightningV2GetLightningByMeetingIdResponseDto( + return new FlashV2GetFlashByMeetingIdResponseDto( meetingId, - lightning.getLeaderUserId(), - lightning.getTitle(), - MeetingCategory.LIGHTNING.getValue(), - lightning.getImageURL(), - lightning.getEndDate(), - lightning.getMinimumCapacity(), - lightning.getMaximumCapacity(), + flash.getLeaderUserId(), + flash.getTitle(), + MeetingCategory.FLASH.getValue(), + flash.getImageURL(), + flash.getEndDate(), + flash.getMinimumCapacity(), + flash.getMaximumCapacity(), welcomeMessageTypeValues, - lightning.getDesc(), - lightning.getActivityStartDate(), - lightning.getActivityEndDate(), - lightning.getLightningTimingType().getValue(), - lightning.getLightningPlaceType().getValue(), - lightning.getLightningPlace(), - lightning.getCreatedGeneration(), - lightningMeetingStatus, + flash.getDesc(), + flash.getActivityStartDate(), + flash.getActivityEndDate(), + flash.getFlashTimingType().getValue(), + flash.getFlashPlaceType().getValue(), + flash.getFlashPlace(), + flash.getCreatedGeneration(), + flashMeetingStatus, approvedCount, isHost, isApply, diff --git a/main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2Service.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2Service.java new file mode 100644 index 00000000..72ff50bc --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2Service.java @@ -0,0 +1,12 @@ +package org.sopt.makers.crew.main.flash.v2.service; + +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2CreateFlashResponseDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2GetFlashByMeetingIdResponseDto; + +public interface FlashV2Service { + FlashV2CreateFlashResponseDto createFlash( + FlashV2CreateFlashBodyDto requestBody, Integer userId); + + FlashV2GetFlashByMeetingIdResponseDto getFlashByMeetingId(Integer meetingId, Integer userId); +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2ServiceImpl.java b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2ServiceImpl.java similarity index 60% rename from main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2ServiceImpl.java rename to main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2ServiceImpl.java index c8ff375a..cc6885ea 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2ServiceImpl.java +++ b/main/src/main/java/org/sopt/makers/crew/main/flash/v2/service/FlashV2ServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.crew.main.lightning.v2.service; +package org.sopt.makers.crew.main.flash.v2.service; import static org.sopt.makers.crew.main.entity.apply.enums.EnApplyStatus.*; import static org.sopt.makers.crew.main.global.constant.CrewConst.*; @@ -8,21 +8,21 @@ import org.sopt.makers.crew.main.entity.apply.Applies; import org.sopt.makers.crew.main.entity.apply.ApplyRepository; -import org.sopt.makers.crew.main.entity.lightning.Lightning; -import org.sopt.makers.crew.main.entity.lightning.LightningRepository; +import org.sopt.makers.crew.main.entity.flash.Flash; +import org.sopt.makers.crew.main.entity.flash.FlashRepository; import org.sopt.makers.crew.main.entity.tag.enums.WelcomeMessageType; import org.sopt.makers.crew.main.entity.user.User; import org.sopt.makers.crew.main.entity.user.UserReader; +import org.sopt.makers.crew.main.flash.v2.dto.mapper.FlashMapper; +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2CreateFlashResponseDto; +import org.sopt.makers.crew.main.flash.v2.dto.response.FlashV2GetFlashByMeetingIdResponseDto; import org.sopt.makers.crew.main.global.dto.MeetingCreatorDto; import org.sopt.makers.crew.main.global.exception.BadRequestException; import org.sopt.makers.crew.main.global.exception.NotFoundException; import org.sopt.makers.crew.main.global.util.Time; -import org.sopt.makers.crew.main.lightning.v2.dto.mapper.LightningMapper; -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2CreateLightningResponseDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2GetLightningByMeetingIdResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.ApplyWholeInfoDto; -import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForLightningResponseDto; +import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForFlashResponseDto; import org.sopt.makers.crew.main.meeting.v2.service.MeetingV2Service; import org.sopt.makers.crew.main.tag.v2.service.TagV2Service; import org.sopt.makers.crew.main.user.v2.service.UserV2Service; @@ -34,7 +34,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class LightningV2ServiceImpl implements LightningV2Service { +public class FlashV2ServiceImpl implements FlashV2Service { private static final int INTRO_IMAGE_LIST_SIZE = 1; @@ -42,62 +42,62 @@ public class LightningV2ServiceImpl implements LightningV2Service { private final TagV2Service tagV2Service; private final MeetingV2Service meetingV2Service; - private final LightningRepository lightningRepository; + private final FlashRepository flashRepository; private final ApplyRepository applyRepository; private final UserReader userReader; - private final LightningMapper lightningMapper; + private final FlashMapper flashMapper; private final Time realTime; @Override @Transactional - public LightningV2CreateLightningResponseDto createLightning( - LightningV2CreateLightningBodyDto requestBody, Integer userId) { + public FlashV2CreateFlashResponseDto createFlash( + FlashV2CreateFlashBodyDto requestBody, Integer userId) { User user = userV2Service.getUserByUserId(userId); if (user.getActivities() == null) { throw new BadRequestException(VALIDATION_EXCEPTION.getErrorCode()); } - if (requestBody.lightningBody().files().size() > INTRO_IMAGE_LIST_SIZE) { + if (requestBody.flashBody().files().size() > INTRO_IMAGE_LIST_SIZE) { throw new BadRequestException(VALIDATION_EXCEPTION.getErrorCode()); } - MeetingV2CreateMeetingForLightningResponseDto meetingV2CreateMeetingForLightningResponseDto = meetingV2Service.createMeetingForLightning( - userId, requestBody.lightningBody()); + MeetingV2CreateMeetingForFlashResponseDto meetingV2CreateMeetingForFlashResponseDto = meetingV2Service.createMeetingForFlash( + userId, requestBody.flashBody()); - Lightning lightning = lightningMapper.toLightningEntity(meetingV2CreateMeetingForLightningResponseDto, + Flash flash = flashMapper.toFlashntity(meetingV2CreateMeetingForFlashResponseDto, ACTIVE_GENERATION, user.getId(), realTime); - lightningRepository.save(lightning); - tagV2Service.createLightningTag(requestBody.welcomeMessageTypes(), lightning.getId()); + flashRepository.save(flash); + tagV2Service.createFlashTag(requestBody.welcomeMessageTypes(), flash.getId()); - return LightningV2CreateLightningResponseDto.from(lightning.getMeetingId()); + return FlashV2CreateFlashResponseDto.from(flash.getMeetingId()); } - public LightningV2GetLightningByMeetingIdResponseDto getLightningByMeetingId(Integer meetingId, Integer userId) { + public FlashV2GetFlashByMeetingIdResponseDto getFlashByMeetingId(Integer meetingId, Integer userId) { User user = userV2Service.getUserByUserId(userId); - Lightning lightning = lightningRepository.findByMeetingId(meetingId) - .orElseThrow(() -> new NotFoundException(NOT_FOUND_LIGHTNING.getErrorCode())); + Flash flash = flashRepository.findByMeetingId(meetingId) + .orElseThrow(() -> new NotFoundException(NOT_FOUND_FLASH.getErrorCode())); - MeetingCreatorDto meetingLeader = userReader.getMeetingLeader(lightning.getLeaderUserId()); + MeetingCreatorDto meetingLeader = userReader.getMeetingLeader(flash.getLeaderUserId()); Applies applies = new Applies( applyRepository.findAllByMeetingIdWithUser(meetingId, List.of(WAITING, APPROVE, REJECT), ORDER_ASC)); - boolean isHost = lightning.checkLightningMeetingLeader(user.getId()); + boolean isHost = flash.checkFlashMeetingLeader(user.getId()); boolean isApply = applies.isApply(meetingId, user.getId()); boolean isApproved = applies.isApproved(meetingId, user.getId()); long approvedCount = applies.getApprovedCount(meetingId); List applyWholeInfoDtos = getApplyWholeInfoDtos(applies, meetingId, userId); - List welcomeMessageTypes = tagV2Service.getWelcomeMessageTypesByLightningId( - lightning.getId()); + List welcomeMessageTypes = tagV2Service.getWelcomeMessageTypesByFlashId( + flash.getId()); - return LightningV2GetLightningByMeetingIdResponseDto.of(meetingId, lightning, welcomeMessageTypes, + return FlashV2GetFlashByMeetingIdResponseDto.of(meetingId, flash, welcomeMessageTypes, approvedCount, isHost, isApply, isApproved, meetingLeader, applyWholeInfoDtos, realTime.now()); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSetting.java b/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSetting.java index abd75cf2..89416593 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSetting.java +++ b/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSetting.java @@ -1,5 +1,5 @@ package org.sopt.makers.crew.main.global.config; public interface ImageSetting { - String getDefaultLightningImage(); + String getDefaultFlashImage(); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSettingConfig.java b/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSettingConfig.java index c58cb8c8..012723c8 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSettingConfig.java +++ b/main/src/main/java/org/sopt/makers/crew/main/global/config/ImageSettingConfig.java @@ -5,11 +5,11 @@ @Configuration public class ImageSettingConfig implements ImageSetting { - @Value("${img.lightning}") - private String defaultLightningImage; + @Value("${img.flash}") + private String defaultFlashImage; @Override - public String getDefaultLightningImage() { - return defaultLightningImage; + public String getDefaultFlashImage() { + return defaultFlashImage; } } diff --git a/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java b/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java index a7a676af..ea7faaff 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java +++ b/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java @@ -66,7 +66,7 @@ public enum ErrorStatus { NOT_FOUND_POST("존재하지 않는 게시글입니다."), // 예외 처리 NotFound로 수정 필요 NOT_FOUND_USER("존재하지 않는 유저입니다."), // 예외 처리 NotFound로 수정 필요 NOT_FOUND_COMMENT("존재하지 않는 댓글입니다."), // 예외 처리 NotFound로 수정 필요 - NOT_FOUND_LIGHTNING("번쩍 모임이 없습니다."), // 예외 처리 NotFound로 수정 필요 + NOT_FOUND_FLASH("번쩍 모임이 없습니다."), // 예외 처리 NotFound로 수정 필요 /** * 405 METHOD_NOT_ALLOWED diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Controller.java b/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Controller.java deleted file mode 100644 index 63c3cfaa..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/LightningV2Controller.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.sopt.makers.crew.main.lightning.v2; - -import java.security.Principal; - -import org.sopt.makers.crew.main.global.util.UserUtil; -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2CreateLightningResponseDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2GetLightningByMeetingIdResponseDto; -import org.sopt.makers.crew.main.lightning.v2.service.LightningV2Service; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import jakarta.validation.Valid; -import lombok.RequiredArgsConstructor; - -@RestController -@RequestMapping("/lightning/v2") -@RequiredArgsConstructor -public class LightningV2Controller implements LightningV2Api { - private final LightningV2Service lightningV2Service; - - @Override - @PostMapping - public ResponseEntity createLightning( - @Valid @RequestBody LightningV2CreateLightningBodyDto requestBody, - Principal principal - ) { - Integer userId = UserUtil.getUserId(principal); - return ResponseEntity.status(HttpStatus.CREATED).body(lightningV2Service.createLightning(requestBody, userId)); - } - - @Override - @GetMapping("{meetingId}") - public ResponseEntity getLightningByMeetingId( - @PathVariable Integer meetingId, - Principal principal - ) { - Integer userId = UserUtil.getUserId(principal); - - return ResponseEntity.ok(lightningV2Service.getLightningByMeetingId(meetingId, userId)); - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/mapper/LightningMapper.java b/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/mapper/LightningMapper.java deleted file mode 100644 index ba4b6adb..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/mapper/LightningMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.sopt.makers.crew.main.lightning.v2.dto.mapper; - -import static org.sopt.makers.crew.main.global.constant.CrewConst.*; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.stream.IntStream; - -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Named; -import org.sopt.makers.crew.main.entity.lightning.Lightning; -import org.sopt.makers.crew.main.entity.lightning.enums.LightningPlaceType; -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.meeting.v2.dto.response.MeetingV2CreateMeetingForLightningResponseDto; - -@Mapper(componentModel = "spring") -public interface LightningMapper { - @Mapping(source = "meetingV2CreateMeetingForLightningResponseDto.files", target = "imageURL", qualifiedByName = "getImageURL") - @Mapping(target = "startDate", expression = "java(time.now())") - @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") - static List getImageURL(List files) { - return IntStream.range(0, files.size()) - .mapToObj(index -> new ImageUrlVO(index, files.get(index))) - .toList(); - } - - @Named("getActivityStartDate") - static LocalDateTime getActivityStartDate(String date) { - return LocalDateTime.parse(date + DAY_START_TIME, DateTimeFormatter.ofPattern(DAY_TIME_FORMAT)); - } - - @Named("getActivityEndDate") - static LocalDateTime getActivityEndDate(String date) { - return LocalDateTime.parse(date + DAY_END_TIME, DateTimeFormatter.ofPattern(DAY_TIME_FORMAT)); - } - - @Named("getLightningPlaceType") - static LightningPlaceType getLightningPlaceType(String placeType) { - return LightningPlaceType.ofValue(placeType); - } - - @Named("getLightningTimingType") - static LightningTimingType getLightningTimingType(String timingType) { - return LightningTimingType.ofValue(timingType); - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2CreateLightningResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2CreateLightningResponseDto.java deleted file mode 100644 index 9289dbbd..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/dto/response/LightningV2CreateLightningResponseDto.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.crew.main.lightning.v2.dto.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotNull; - -@Schema(name = "LightningV2CreateLightningResponseDto", description = "번쩍 모임 생성 응답 Dto") -public record LightningV2CreateLightningResponseDto( - @Schema(description = "모임 id - 번쩍 카테고리", example = "1") - @NotNull - Integer meetingId -) { - public static LightningV2CreateLightningResponseDto from(Integer meetingId) { - return new LightningV2CreateLightningResponseDto(meetingId); - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2Service.java b/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2Service.java deleted file mode 100644 index 014d3254..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/lightning/v2/service/LightningV2Service.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.sopt.makers.crew.main.lightning.v2.service; - -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2CreateLightningResponseDto; -import org.sopt.makers.crew.main.lightning.v2.dto.response.LightningV2GetLightningByMeetingIdResponseDto; - -public interface LightningV2Service { - LightningV2CreateLightningResponseDto createLightning( - LightningV2CreateLightningBodyDto requestBody, Integer userId); - - LightningV2GetLightningByMeetingIdResponseDto getLightningByMeetingId(Integer meetingId, Integer userId); -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/MeetingV2CreateMeetingForLightningResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/MeetingV2CreateMeetingForFlashResponseDto.java similarity index 61% rename from main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/MeetingV2CreateMeetingForLightningResponseDto.java rename to main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/MeetingV2CreateMeetingForFlashResponseDto.java index fbdb2664..c5903e16 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/MeetingV2CreateMeetingForLightningResponseDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/dto/response/MeetingV2CreateMeetingForFlashResponseDto.java @@ -2,7 +2,7 @@ import java.util.List; -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyWithoutWelcomeMessageDto; +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyWithoutWelcomeMessageDto; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Max; @@ -10,8 +10,8 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; -@Schema(name = "MeetingV2CreateMeetingForLightningResponseDto", description = "번쩍 모임 생성 및 수정 request body dto") -public record MeetingV2CreateMeetingForLightningResponseDto( +@Schema(name = "MeetingV2CreateMeetingForFlashResponseDto", description = "번쩍 모임 생성 및 수정 request body dto") +public record MeetingV2CreateMeetingForFlashResponseDto( @Schema(description = "모임 id", example = "1") @NotNull Integer meetingId, @@ -25,9 +25,9 @@ public record MeetingV2CreateMeetingForLightningResponseDto( @NotNull String desc, - @Schema(example = "예정 기간(협의 후 결정)", description = "번쩍 일정 결정 방식") + @Schema(example = "예정 기간 (협의 후 결정)", description = "번쩍 일정 결정 방식") @NotNull - String lightningTimingType, + String flashTimingType, @Schema(example = "2025.10.29", description = "번쩍 활동 시작 날짜", name = "activityStartDate") @NotNull @@ -39,10 +39,10 @@ public record MeetingV2CreateMeetingForLightningResponseDto( @Schema(example = "오프라인", description = "모임 장소 Tag") @NotNull - String lightningPlaceType, + String flashPlaceType, @Schema(example = "잠실역 5번 출구", description = "모임 장소") - String lightningPlace, + String flashPlace, @Schema(example = "1", description = "최소 모집 인원") @Min(1) @@ -62,20 +62,20 @@ public record MeetingV2CreateMeetingForLightningResponseDto( @Size(max = 1) List files ) { - public static MeetingV2CreateMeetingForLightningResponseDto of( - Integer meetingId, LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody) { - return new MeetingV2CreateMeetingForLightningResponseDto( + public static MeetingV2CreateMeetingForFlashResponseDto of( + Integer meetingId, FlashV2CreateFlashBodyWithoutWelcomeMessageDto flashBody) { + return new MeetingV2CreateMeetingForFlashResponseDto( meetingId, - lightningBody.title(), - lightningBody.desc(), - lightningBody.lightningTimingType(), - lightningBody.activityStartDate(), - lightningBody.activityEndDate(), - lightningBody.lightningPlaceType(), - lightningBody.lightningPlace(), - lightningBody.minimumCapacity(), - lightningBody.maximumCapacity(), - lightningBody.files() + flashBody.title(), + flashBody.desc(), + flashBody.flashTimingType(), + flashBody.activityStartDate(), + flashBody.activityEndDate(), + flashBody.flashPlaceType(), + flashBody.flashPlace(), + flashBody.minimumCapacity(), + flashBody.maximumCapacity(), + flashBody.files() ); } } diff --git a/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2Service.java b/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2Service.java index 1d87a95d..2ad14fa2 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2Service.java +++ b/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2Service.java @@ -2,7 +2,7 @@ import java.util.List; -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyWithoutWelcomeMessageDto; +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyWithoutWelcomeMessageDto; import org.sopt.makers.crew.main.meeting.v2.dto.query.MeetingGetAppliesQueryDto; import org.sopt.makers.crew.main.meeting.v2.dto.query.MeetingV2GetAllMeetingByOrgUserQueryDto; import org.sopt.makers.crew.main.meeting.v2.dto.query.MeetingV2GetAllMeetingQueryDto; @@ -12,7 +12,7 @@ import org.sopt.makers.crew.main.meeting.v2.dto.response.AppliesCsvFileUrlResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingGetApplyListResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2ApplyMeetingResponseDto; -import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForLightningResponseDto; +import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForFlashResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2GetAllMeetingByOrgUserDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2GetAllMeetingDto; @@ -53,6 +53,6 @@ AppliesCsvFileUrlResponseDto getAppliesCsvFileUrl(Integer meetingId, List meetingIds, Integer userId); - MeetingV2CreateMeetingForLightningResponseDto createMeetingForLightning(Integer userId, - LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody); + MeetingV2CreateMeetingForFlashResponseDto createMeetingForFlash(Integer userId, + FlashV2CreateFlashBodyWithoutWelcomeMessageDto flashBody); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceImpl.java b/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceImpl.java index dcbaaf0e..1a6b5985 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceImpl.java +++ b/main/src/main/java/org/sopt/makers/crew/main/meeting/v2/service/MeetingV2ServiceImpl.java @@ -49,6 +49,7 @@ import org.sopt.makers.crew.main.entity.user.enums.UserPart; import org.sopt.makers.crew.main.entity.user.vo.UserActivityVO; import org.sopt.makers.crew.main.external.s3.service.S3Service; +import org.sopt.makers.crew.main.flash.v2.dto.request.FlashV2CreateFlashBodyWithoutWelcomeMessageDto; import org.sopt.makers.crew.main.global.config.ImageSetting; import org.sopt.makers.crew.main.global.dto.MeetingCreatorDto; import org.sopt.makers.crew.main.global.dto.MeetingResponseDto; @@ -59,7 +60,6 @@ import org.sopt.makers.crew.main.global.util.AdvertisementCustomPageable; import org.sopt.makers.crew.main.global.util.Time; import org.sopt.makers.crew.main.global.util.UserPartUtil; -import org.sopt.makers.crew.main.lightning.v2.dto.request.LightningV2CreateLightningBodyWithoutWelcomeMessageDto; import org.sopt.makers.crew.main.meeting.v2.dto.ApplyMapper; import org.sopt.makers.crew.main.meeting.v2.dto.MeetingMapper; import org.sopt.makers.crew.main.meeting.v2.dto.query.MeetingGetAppliesQueryDto; @@ -73,7 +73,7 @@ import org.sopt.makers.crew.main.meeting.v2.dto.response.ApplyWholeInfoDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingGetApplyListResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2ApplyMeetingResponseDto; -import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForLightningResponseDto; +import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingForFlashResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2CreateMeetingResponseDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2GetAllMeetingByOrgUserDto; import org.sopt.makers.crew.main.meeting.v2.dto.response.MeetingV2GetAllMeetingByOrgUserMeetingDto; @@ -474,24 +474,24 @@ public MeetingV2GetRecommendDto getRecommendMeetingsByIds(List meetingI } @Override - public MeetingV2CreateMeetingForLightningResponseDto createMeetingForLightning(Integer userId, - LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody) { + public MeetingV2CreateMeetingForFlashResponseDto createMeetingForFlash(Integer userId, + FlashV2CreateFlashBodyWithoutWelcomeMessageDto flashBody) { User user = userRepository.findByIdOrThrow(userId); - List imageURL = getImageURL(lightningBody.files()); - LocalDateTime activityStartDate = getActivityStartDate(lightningBody.activityStartDate()); - LocalDateTime activityEndDate = getActivityEndDate((lightningBody.activityStartDate())); + List imageURL = getImageURL(flashBody.files()); + LocalDateTime activityStartDate = getActivityStartDate(flashBody.activityStartDate()); + LocalDateTime activityEndDate = getActivityEndDate((flashBody.activityStartDate())); - Meeting lightningMeeting = Meeting.createLightningMeeting( + Meeting flashMeeting = Meeting.createFlashMeeting( user, userId, - lightningBody.title(), + flashBody.title(), imageURL, time.now(), activityStartDate, // 모집 마감일 = 활동 시작일 - lightningBody.maximumCapacity(), - lightningBody.desc(), + flashBody.maximumCapacity(), + flashBody.desc(), activityStartDate, activityEndDate, ACTIVE_GENERATION, @@ -500,9 +500,9 @@ public MeetingV2CreateMeetingForLightningResponseDto createMeetingForLightning(I EMPTY_STRING // null 대신 빈 문자열로 NPE 방지 ); - meetingRepository.save(lightningMeeting); + meetingRepository.save(flashMeeting); - return MeetingV2CreateMeetingForLightningResponseDto.of(lightningMeeting.getId(), lightningBody); + return MeetingV2CreateMeetingForFlashResponseDto.of(flashMeeting.getId(), flashBody); } private void deleteCsvFile(String filePath) { @@ -659,7 +659,7 @@ private List getImageURL(List files) { AtomicInteger index = new AtomicInteger(0); if (files.isEmpty()) { - files.add(imageSetting.getDefaultLightningImage()); + files.add(imageSetting.getDefaultFlashImage()); } return files.stream() diff --git a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateFlashTagResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateFlashTagResponseDto.java new file mode 100644 index 00000000..2d731a78 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateFlashTagResponseDto.java @@ -0,0 +1,15 @@ +package org.sopt.makers.crew.main.tag.v2.dto.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; + +@Schema(name = "TagV2CreateFlashTagResponseDto", description = "번쩍 모임 태그 생성 응답 Dto") +public record TagV2CreateFlashTagResponseDto( + @Schema(description = "모임 태그 id", example = "1") + @NotNull + Integer tagId +) { + public static TagV2CreateFlashTagResponseDto from(Integer tagId) { + return new TagV2CreateFlashTagResponseDto(tagId); + } +} diff --git a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateTagResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateTagResponseDto.java deleted file mode 100644 index 4dedd85a..00000000 --- a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/dto/response/TagV2CreateTagResponseDto.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.crew.main.tag.v2.dto.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotNull; - -@Schema(name = "TagV2CreateLightningTagResponseDto", description = "번쩍 모임 태그 생성 응답 Dto") -public record TagV2CreateTagResponseDto( - @Schema(description = "모임 태그 id", example = "1") - @NotNull - Integer tagId -) { - public static TagV2CreateTagResponseDto from(Integer tagId) { - return new TagV2CreateTagResponseDto(tagId); - } -} diff --git a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2Service.java b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2Service.java index ab138972..b9058462 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2Service.java +++ b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2Service.java @@ -3,10 +3,10 @@ import java.util.List; import org.sopt.makers.crew.main.entity.tag.enums.WelcomeMessageType; -import org.sopt.makers.crew.main.tag.v2.dto.response.TagV2CreateTagResponseDto; +import org.sopt.makers.crew.main.tag.v2.dto.response.TagV2CreateFlashTagResponseDto; public interface TagV2Service { - TagV2CreateTagResponseDto createLightningTag(List welcomeMessageTypes, Integer lightningId); + TagV2CreateFlashTagResponseDto createFlashTag(List welcomeMessageTypes, Integer flashId); - List getWelcomeMessageTypesByLightningId(Integer lightningId); + List getWelcomeMessageTypesByFlashId(Integer flashId); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2ServiceImpl.java b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2ServiceImpl.java index 5a3b56b3..4d9b29b4 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2ServiceImpl.java +++ b/main/src/main/java/org/sopt/makers/crew/main/tag/v2/service/TagV2ServiceImpl.java @@ -11,7 +11,7 @@ import org.sopt.makers.crew.main.entity.tag.enums.TagType; import org.sopt.makers.crew.main.entity.tag.enums.WelcomeMessageType; import org.sopt.makers.crew.main.global.exception.BadRequestException; -import org.sopt.makers.crew.main.tag.v2.dto.response.TagV2CreateTagResponseDto; +import org.sopt.makers.crew.main.tag.v2.dto.response.TagV2CreateFlashTagResponseDto; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,38 +28,38 @@ public class TagV2ServiceImpl implements TagV2Service { @Override @Transactional - public TagV2CreateTagResponseDto createLightningTag(List welcomeMessageTypes, - Integer lightningId) { + public TagV2CreateFlashTagResponseDto createFlashTag(List welcomeMessageTypes, + Integer flashId) { - if (lightningId == null) { + if (flashId == null) { throw new BadRequestException(VALIDATION_EXCEPTION.getErrorCode()); } if (welcomeMessageTypes == null || welcomeMessageTypes.isEmpty()) { - return saveTag(lightningId, List.of()); + return saveTag(flashId, List.of()); } List welcomeMessageTypeEnums = welcomeMessageTypes.stream() .map(WelcomeMessageType::ofValue) .toList(); - return saveTag(lightningId, welcomeMessageTypeEnums); + return saveTag(flashId, welcomeMessageTypeEnums); } @Override - public List getWelcomeMessageTypesByLightningId(Integer lightningId) { - if (lightningId == null) { + public List getWelcomeMessageTypesByFlashId(Integer flashId) { + if (flashId == null) { throw new BadRequestException(VALIDATION_EXCEPTION.getErrorCode()); } - return tagRepository.findByLightningId(lightningId) + return tagRepository.findByFlashId(flashId) .map(WelcomeMessageTypeProjection::getWelcomeMessageTypes) .orElse(Collections.emptyList()); } - private TagV2CreateTagResponseDto saveTag(Integer lightningId, List welcomeMessageTypeEnums) { - Tag tag = Tag.createLightningMeetingTag(TagType.LIGHTNING, lightningId, welcomeMessageTypeEnums); + private TagV2CreateFlashTagResponseDto saveTag(Integer flashId, List welcomeMessageTypeEnums) { + Tag tag = Tag.createFlashMeetingTag(TagType.FLASH, flashId, welcomeMessageTypeEnums); tagRepository.save(tag); - return TagV2CreateTagResponseDto.from(tag.getId()); + return TagV2CreateFlashTagResponseDto.from(tag.getId()); } } diff --git a/main/src/main/resources/application-dev.yml b/main/src/main/resources/application-dev.yml index e3547496..ce14bb59 100644 --- a/main/src/main/resources/application-dev.yml +++ b/main/src/main/resources/application-dev.yml @@ -29,7 +29,7 @@ spring: storage_engine: innodb data: redis: - host: redis + host: localhost port: 6379 jwt: @@ -118,4 +118,4 @@ logging: environment: dev img: - lightning: ${LIGHTNING_IMAGE} + flash: ${FLASH_IMAGE} diff --git a/main/src/main/resources/application-local.yml b/main/src/main/resources/application-local.yml index 3c9ada65..356e2115 100644 --- a/main/src/main/resources/application-local.yml +++ b/main/src/main/resources/application-local.yml @@ -118,4 +118,4 @@ logging: environment: local img: - lightning: ${LIGHTNING_IMAGE} + flash: ${FLASH_IMAGE} diff --git a/main/src/main/resources/application-prod.yml b/main/src/main/resources/application-prod.yml index 9542bded..ef5f1b71 100644 --- a/main/src/main/resources/application-prod.yml +++ b/main/src/main/resources/application-prod.yml @@ -118,4 +118,4 @@ logging: environment: prod img: - lightning: ${LIGHTNING_IMAGE} + flash: ${FLASH_IMAGE} diff --git a/main/src/main/resources/application-test.yml b/main/src/main/resources/application-test.yml index ce3f3a4a..85f9c9a3 100644 --- a/main/src/main/resources/application-test.yml +++ b/main/src/main/resources/application-test.yml @@ -117,4 +117,4 @@ logging: environment: test img: - lightning: ${LIGHTNING_IMAGE} + flash: ${FLASH_IMAGE}