diff --git a/build.gradle b/build.gradle index 84b85eb..05639e9 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,7 @@ repositories { dependencies { // Web implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' testImplementation 'org.springframework.boot:spring-boot-starter-test' // DB implementation 'org.springframework.boot:spring-boot-starter-data-jpa' diff --git a/src/main/java/side/onetime/controller/EventController.java b/src/main/java/side/onetime/controller/EventController.java index 85cbae9..a452f5c 100644 --- a/src/main/java/side/onetime/controller/EventController.java +++ b/src/main/java/side/onetime/controller/EventController.java @@ -3,7 +3,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import side.onetime.dto.EventDto; +import side.onetime.dto.event.request.CreateEventRequest; +import side.onetime.dto.event.response.*; import side.onetime.global.common.ApiResponse; import side.onetime.global.common.status.SuccessStatus; import side.onetime.service.EventService; @@ -18,11 +19,11 @@ public class EventController { // 이벤트 생성 API @PostMapping - public ResponseEntity> createEvent( - @RequestBody EventDto.CreateEventRequest createEventRequest, + public ResponseEntity> createEvent( + @RequestBody CreateEventRequest createEventRequest, @RequestHeader(value = "Authorization", required = false) String authorizationHeader) { - EventDto.CreateEventResponse createEventResponse; + CreateEventResponse createEventResponse; if (authorizationHeader != null) { createEventResponse = eventService.createEventForAuthenticatedUser(createEventRequest, authorizationHeader); } else { @@ -34,37 +35,37 @@ public ResponseEntity> createEvent( // 이벤트 조회 API @GetMapping("/{event_id}") - public ResponseEntity> getEvent( + public ResponseEntity> getEvent( @PathVariable("event_id") String eventId) { - EventDto.GetEventResponse getEventResponse = eventService.getEvent(eventId); + GetEventResponse getEventResponse = eventService.getEvent(eventId); return ApiResponse.onSuccess(SuccessStatus._GET_EVENT, getEventResponse); } // 참여자 조회 API @GetMapping("/{event_id}/participants") - public ResponseEntity> getParticipants( + public ResponseEntity> getParticipants( @PathVariable("event_id") String eventId) { - EventDto.GetParticipantsResponse getParticipantsResponse = eventService.getParticipants(eventId); + GetParticipantsResponse getParticipantsResponse = eventService.getParticipants(eventId); return ApiResponse.onSuccess(SuccessStatus._GET_PARTICIPANTS, getParticipantsResponse); } // 가장 많이 되는 시간 조회 API @GetMapping("/{event_id}/most") - public ResponseEntity>> getMostPossibleTime( + public ResponseEntity>> getMostPossibleTime( @PathVariable("event_id") String eventId) { - List getMostPossibleTimes = eventService.getMostPossibleTime(eventId); + List getMostPossibleTimes = eventService.getMostPossibleTime(eventId); return ApiResponse.onSuccess(SuccessStatus._GET_MOST_POSSIBLE_TIME, getMostPossibleTimes); } // 유저 참여 이벤트 목록 조회 API @GetMapping("/user/all") - public ResponseEntity>> getUserParticipatedEvents( + public ResponseEntity>> getUserParticipatedEvents( @RequestHeader("Authorization") String authorizationHeader) { - List getUserParticipatedEventsResponses = eventService.getUserParticipatedEvents(authorizationHeader); + List getUserParticipatedEventsResponses = eventService.getUserParticipatedEvents(authorizationHeader); return ApiResponse.onSuccess(SuccessStatus._GET_USER_PARTICIPATED_EVENTS, getUserParticipatedEventsResponses); } diff --git a/src/main/java/side/onetime/controller/MemberController.java b/src/main/java/side/onetime/controller/MemberController.java index a40f4c1..36c5f70 100644 --- a/src/main/java/side/onetime/controller/MemberController.java +++ b/src/main/java/side/onetime/controller/MemberController.java @@ -2,8 +2,16 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import side.onetime.dto.MemberDto; +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 side.onetime.dto.member.request.IsDuplicateRequest; +import side.onetime.dto.member.request.LoginMemberRequest; +import side.onetime.dto.member.request.RegisterMemberRequest; +import side.onetime.dto.member.response.IsDuplicateResponse; +import side.onetime.dto.member.response.LoginMemberResponse; +import side.onetime.dto.member.response.RegisterMemberResponse; import side.onetime.global.common.ApiResponse; import side.onetime.global.common.status.SuccessStatus; import side.onetime.service.MemberService; @@ -16,28 +24,28 @@ public class MemberController { // 멤버 등록 API @PostMapping("/action-register") - public ResponseEntity> registerMember( - @RequestBody MemberDto.RegisterMemberRequest registerMemberRequest) { + public ResponseEntity> registerMember( + @RequestBody RegisterMemberRequest registerMemberRequest) { - MemberDto.RegisterMemberResponse registerMemberResponse = memberService.registerMember(registerMemberRequest); + RegisterMemberResponse registerMemberResponse = memberService.registerMember(registerMemberRequest); return ApiResponse.onSuccess(SuccessStatus._REGISTER_MEMBER, registerMemberResponse); } // 멤버 로그인 API @PostMapping("/action-login") - public ResponseEntity> loginMember( - @RequestBody MemberDto.LoginMemberRequest loginMemberRequest) { + public ResponseEntity> loginMember( + @RequestBody LoginMemberRequest loginMemberRequest) { - MemberDto.LoginMemberResponse loginMemberResponse = memberService.loginMember(loginMemberRequest); + LoginMemberResponse loginMemberResponse = memberService.loginMember(loginMemberRequest); return ApiResponse.onSuccess(SuccessStatus._LOGIN_MEMBER, loginMemberResponse); } // 이름 중복 확인 API @PostMapping("/name/action-check") - public ResponseEntity> isDuplicate( - @RequestBody MemberDto.IsDuplicateRequest isDuplicateRequest) { + public ResponseEntity> isDuplicate( + @RequestBody IsDuplicateRequest isDuplicateRequest) { - MemberDto.IsDuplicateResponse isDuplicateResponse = memberService.isDuplicate(isDuplicateRequest); + IsDuplicateResponse isDuplicateResponse = memberService.isDuplicate(isDuplicateRequest); return ApiResponse.onSuccess(SuccessStatus._IS_POSSIBLE_NAME, isDuplicateResponse); } } diff --git a/src/main/java/side/onetime/controller/ScheduleController.java b/src/main/java/side/onetime/controller/ScheduleController.java index ff060e0..eb92ca6 100644 --- a/src/main/java/side/onetime/controller/ScheduleController.java +++ b/src/main/java/side/onetime/controller/ScheduleController.java @@ -3,7 +3,11 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import side.onetime.dto.ScheduleDto; +import side.onetime.dto.schedule.request.CreateDateScheduleRequest; +import side.onetime.dto.schedule.request.CreateDayScheduleRequest; +import side.onetime.dto.schedule.request.GetFilteredSchedulesRequest; +import side.onetime.dto.schedule.response.PerDateSchedulesResponse; +import side.onetime.dto.schedule.response.PerDaySchedulesResponse; import side.onetime.global.common.ApiResponse; import side.onetime.global.common.status.SuccessStatus; import side.onetime.service.ScheduleService; @@ -19,7 +23,7 @@ public class ScheduleController { // 요일 스케줄 등록 API @PostMapping("/day") public ResponseEntity> createDaySchedules( - @RequestBody ScheduleDto.CreateDayScheduleRequest createDayScheduleRequest, + @RequestBody CreateDayScheduleRequest createDayScheduleRequest, @RequestHeader(value = "Authorization", required = false) String authorizationHeader) { if (authorizationHeader != null) { @@ -33,7 +37,7 @@ public ResponseEntity> createDaySchedules( // 날짜 스케줄 등록 API @PostMapping("/date") public ResponseEntity> createDateSchedules( - @RequestBody ScheduleDto.CreateDateScheduleRequest createDateScheduleRequest, + @RequestBody CreateDateScheduleRequest createDateScheduleRequest, @RequestHeader(value = "Authorization", required = false) String authorizationHeader) { if (authorizationHeader != null) { @@ -46,77 +50,77 @@ public ResponseEntity> createDateSchedules( // 전체 요일 스케줄 조회 API @GetMapping("/day/{event_id}") - public ResponseEntity>> getAllDaySchedules( + public ResponseEntity>> getAllDaySchedules( @PathVariable("event_id") String eventId) { - List perDaySchedulesResponses = scheduleService.getAllDaySchedules(eventId); + List perDaySchedulesResponses = scheduleService.getAllDaySchedules(eventId); return ApiResponse.onSuccess(SuccessStatus._GET_ALL_DAY_SCHEDULES, perDaySchedulesResponses); } // 개인 요일 스케줄 조회 API (비로그인) @GetMapping("/day/{event_id}/{member_id}") - public ResponseEntity> getMemberDaySchedules( + public ResponseEntity> getMemberDaySchedules( @PathVariable("event_id") String eventId, @PathVariable("member_id") String memberId) { - ScheduleDto.PerDaySchedulesResponse perDaySchedulesResponse = scheduleService.getMemberDaySchedules(eventId, memberId); + PerDaySchedulesResponse perDaySchedulesResponse = scheduleService.getMemberDaySchedules(eventId, memberId); return ApiResponse.onSuccess(SuccessStatus._GET_MEMBER_DAY_SCHEDULES, perDaySchedulesResponse); } // 개인 요일 스케줄 조회 API (로그인) @GetMapping("/day/{event_id}/user") - public ResponseEntity> getUserDaySchedules( + public ResponseEntity> getUserDaySchedules( @PathVariable("event_id") String eventId, @RequestHeader(value = "Authorization") String authorizationHeader) { - ScheduleDto.PerDaySchedulesResponse perDaySchedulesResponse = scheduleService.getUserDaySchedules(eventId, authorizationHeader); + PerDaySchedulesResponse perDaySchedulesResponse = scheduleService.getUserDaySchedules(eventId, authorizationHeader); return ApiResponse.onSuccess(SuccessStatus._GET_USER_DAY_SCHEDULES, perDaySchedulesResponse); } // 멤버 필터링 요일 스케줄 조회 API @GetMapping("/day/action-filtering") - public ResponseEntity>> getFilteredDaySchedules( - @RequestBody ScheduleDto.GetFilteredSchedulesRequest getFilteredSchedulesRequest) { + public ResponseEntity>> getFilteredDaySchedules( + @RequestBody GetFilteredSchedulesRequest getFilteredSchedulesRequest) { - List perDaySchedulesResponses = scheduleService.getFilteredDaySchedules(getFilteredSchedulesRequest); + List perDaySchedulesResponses = scheduleService.getFilteredDaySchedules(getFilteredSchedulesRequest); return ApiResponse.onSuccess(SuccessStatus._GET_FILTERED_DAY_SCHEDULES, perDaySchedulesResponses); } // 전체 날짜 스케줄 조회 API @GetMapping("/date/{event_id}") - public ResponseEntity>> getAllDateSchedules( + public ResponseEntity>> getAllDateSchedules( @PathVariable("event_id") String eventId) { - List perDateSchedulesResponses = scheduleService.getAllDateSchedules(eventId); + List perDateSchedulesResponses = scheduleService.getAllDateSchedules(eventId); return ApiResponse.onSuccess(SuccessStatus._GET_ALL_DATE_SCHEDULES, perDateSchedulesResponses); } // 개인 날짜 스케줄 조회 API (비로그인) @GetMapping("/date/{event_id}/{member_id}") - public ResponseEntity> getMemberDateSchedules( + public ResponseEntity> getMemberDateSchedules( @PathVariable("event_id") String eventId, @PathVariable("member_id") String memberId) { - ScheduleDto.PerDateSchedulesResponse perDateSchedulesResponse = scheduleService.getMemberDateSchedules(eventId, memberId); + PerDateSchedulesResponse perDateSchedulesResponse = scheduleService.getMemberDateSchedules(eventId, memberId); return ApiResponse.onSuccess(SuccessStatus._GET_MEMBER_DATE_SCHEDULES, perDateSchedulesResponse); } // 개인 날짜 스케줄 조회 API (로그인) @GetMapping("/date/{event_id}/user") - public ResponseEntity> getUserDateSchedules( + public ResponseEntity> getUserDateSchedules( @PathVariable("event_id") String eventId, @RequestHeader(value = "Authorization") String authorizationHeader) { - ScheduleDto.PerDateSchedulesResponse perDateSchedulesResponse = scheduleService.getUserDateSchedules(eventId, authorizationHeader); + PerDateSchedulesResponse perDateSchedulesResponse = scheduleService.getUserDateSchedules(eventId, authorizationHeader); return ApiResponse.onSuccess(SuccessStatus._GET_USER_DATE_SCHEDULES, perDateSchedulesResponse); } // 멤버 필터링 날짜 스케줄 조회 API @GetMapping("/date/action-filtering") - public ResponseEntity>> getFilteredDateSchedules( - @RequestBody ScheduleDto.GetFilteredSchedulesRequest getFilteredSchedulesRequest) { + public ResponseEntity>> getFilteredDateSchedules( + @RequestBody GetFilteredSchedulesRequest getFilteredSchedulesRequest) { - List perDateSchedulesResponses = scheduleService.getFilteredDateSchedules(getFilteredSchedulesRequest); + List perDateSchedulesResponses = scheduleService.getFilteredDateSchedules(getFilteredSchedulesRequest); return ApiResponse.onSuccess(SuccessStatus._GET_FILTERED_DATE_SCHEDULES, perDateSchedulesResponses); } } diff --git a/src/main/java/side/onetime/controller/TokenController.java b/src/main/java/side/onetime/controller/TokenController.java index 5a2815a..198765a 100644 --- a/src/main/java/side/onetime/controller/TokenController.java +++ b/src/main/java/side/onetime/controller/TokenController.java @@ -6,7 +6,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import side.onetime.dto.TokenDto; +import side.onetime.dto.token.request.ReissueTokenRequest; +import side.onetime.dto.token.response.ReissueTokenResponse; import side.onetime.global.common.ApiResponse; import side.onetime.global.common.status.SuccessStatus; import side.onetime.service.TokenService; @@ -19,10 +20,10 @@ public class TokenController { // 액세스 토큰 재발행 API @PostMapping("/action-reissue") - public ResponseEntity> reissueToken( - @RequestBody TokenDto.ReissueTokenRequest reissueAccessTokenRequest) { + public ResponseEntity> reissueToken( + @RequestBody ReissueTokenRequest reissueAccessTokenRequest) { - TokenDto.ReissueTokenResponse reissueTokenResponse = tokenService.reissueToken(reissueAccessTokenRequest); + ReissueTokenResponse reissueTokenResponse = tokenService.reissueToken(reissueAccessTokenRequest); return ApiResponse.onSuccess(SuccessStatus._REISSUE_TOKENS, reissueTokenResponse); } } \ No newline at end of file diff --git a/src/main/java/side/onetime/controller/UrlController.java b/src/main/java/side/onetime/controller/UrlController.java index 0a118f4..6d2d500 100644 --- a/src/main/java/side/onetime/controller/UrlController.java +++ b/src/main/java/side/onetime/controller/UrlController.java @@ -6,7 +6,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import side.onetime.dto.UrlDto; +import side.onetime.dto.url.request.ConvertToOriginalUrlRequest; +import side.onetime.dto.url.request.ConvertToShortenUrlRequest; +import side.onetime.dto.url.response.ConvertToOriginalUrlResponse; +import side.onetime.dto.url.response.ConvertToShortenUrlResponse; import side.onetime.global.common.ApiResponse; import side.onetime.global.common.status.SuccessStatus; import side.onetime.service.UrlService; @@ -19,19 +22,19 @@ public class UrlController { // 원본 -> 단축 URL API @PostMapping("/action-shorten") - public ResponseEntity> convertToShortenUrl( - @RequestBody UrlDto.ConvertToShortenUrlRequest covertToShortenUrlRequest) { + public ResponseEntity> convertToShortenUrl( + @RequestBody ConvertToShortenUrlRequest covertToShortenUrlRequest) { - UrlDto.ConvertToShortenUrlResponse convertToShortenUrlResponse = urlService.convertToShortenUrl(covertToShortenUrlRequest); + ConvertToShortenUrlResponse convertToShortenUrlResponse = urlService.convertToShortenUrl(covertToShortenUrlRequest); return ApiResponse.onSuccess(SuccessStatus._CONVERT_TO_SHORTEN_URL, convertToShortenUrlResponse); } // 단축 -> 원본 URL API @PostMapping("/action-original") - public ResponseEntity> convertToOriginalUrl( - @RequestBody UrlDto.ConvertToOriginalUrlRequest convertToOriginalUrlRequest) { + public ResponseEntity> convertToOriginalUrl( + @RequestBody ConvertToOriginalUrlRequest convertToOriginalUrlRequest) { - UrlDto.ConvertToOriginalUrlResponse convertToOriginalUrlResponse = urlService.convertToOriginalUrl(convertToOriginalUrlRequest); + ConvertToOriginalUrlResponse convertToOriginalUrlResponse = urlService.convertToOriginalUrl(convertToOriginalUrlRequest); return ApiResponse.onSuccess(SuccessStatus._CONVERT_TO_ORIGINAL_URL, convertToOriginalUrlResponse); } } diff --git a/src/main/java/side/onetime/controller/UserController.java b/src/main/java/side/onetime/controller/UserController.java index e91116b..b225892 100644 --- a/src/main/java/side/onetime/controller/UserController.java +++ b/src/main/java/side/onetime/controller/UserController.java @@ -3,7 +3,10 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import side.onetime.dto.UserDto; +import side.onetime.dto.user.request.OnboardUserRequest; +import side.onetime.dto.user.request.UpdateUserProfileRequest; +import side.onetime.dto.user.response.GetUserProfileResponse; +import side.onetime.dto.user.response.OnboardUserResponse; import side.onetime.global.common.ApiResponse; import side.onetime.global.common.status.SuccessStatus; import side.onetime.service.UserService; @@ -16,19 +19,19 @@ public class UserController { // 유저 온보딩 API @PostMapping("/onboarding") - public ResponseEntity> onboardUser( - @RequestBody UserDto.OnboardUserRequest onboardUserRequest) { + public ResponseEntity> onboardUser( + @RequestBody OnboardUserRequest onboardUserRequest) { - UserDto.OnboardUserResponse onboardUserResponse = userService.onboardUser(onboardUserRequest); + OnboardUserResponse onboardUserResponse = userService.onboardUser(onboardUserRequest); return ApiResponse.onSuccess(SuccessStatus._ONBOARD_USER, onboardUserResponse); } // 유저 정보 조회 API @GetMapping("/profile") - public ResponseEntity> getUserProfile( + public ResponseEntity> getUserProfile( @RequestHeader("Authorization") String authorizationHeader) { - UserDto.GetUserProfileResponse getUserProfileResponse = userService.getUserProfile(authorizationHeader); + GetUserProfileResponse getUserProfileResponse = userService.getUserProfile(authorizationHeader); return ApiResponse.onSuccess(SuccessStatus._GET_USER_PROFILE, getUserProfileResponse); } @@ -36,7 +39,7 @@ public ResponseEntity> getUserProfil @PatchMapping("/profile/action-update") public ResponseEntity> updateUserProfile( @RequestHeader("Authorization") String authorizationHeader, - @RequestBody UserDto.UpdateUserProfileRequest updateUserProfileRequest) { + @RequestBody UpdateUserProfileRequest updateUserProfileRequest) { userService.updateUserProfile(authorizationHeader, updateUserProfileRequest); return ApiResponse.onSuccess(SuccessStatus._UPDATE_USER_PROFILE); diff --git a/src/main/java/side/onetime/dto/EventDto.java b/src/main/java/side/onetime/dto/EventDto.java deleted file mode 100644 index 04fc70e..0000000 --- a/src/main/java/side/onetime/dto/EventDto.java +++ /dev/null @@ -1,181 +0,0 @@ -package side.onetime.dto; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import side.onetime.domain.*; -import side.onetime.domain.enums.Category; - -import java.time.LocalTime; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -public class EventDto { - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class CreateEventRequest { - private String title; - private String startTime; - private String endTime; - private Category category; - private List ranges; - - public Event to() { - return Event.builder() - .eventId(UUID.randomUUID()) - .title(title) - .startTime(startTime) - .endTime(endTime) - .category(category) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class CreateEventResponse { - private UUID eventId; - - public static CreateEventResponse of(Event event) { - return CreateEventResponse.builder() - .eventId(event.getEventId()) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class GetEventResponse { - private String title; - private String startTime; - private String endTime; - private Category category; - private List ranges; - - public static GetEventResponse of(Event event, List ranges) { - return GetEventResponse.builder() - .title(event.getTitle()) - .startTime(event.getStartTime()) - .endTime(event.getEndTime()) - .category(event.getCategory()) - .ranges(ranges) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class GetParticipantsResponse { - private List names; - - public static GetParticipantsResponse of(List members, List users) { - List names = new ArrayList<>(); - - // 멤버 이름 추가 - names.addAll(members.stream() - .map(Member::getName) - .collect(Collectors.toList())); - - // 유저 닉네임 추가 - names.addAll(users.stream() - .map(User::getNickname) - .collect(Collectors.toList())); - - return GetParticipantsResponse.builder() - .names(names) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class GetMostPossibleTime { - private String timePoint; - private String startTime; - private String endTime; - private int possibleCount; - private List possibleNames; - private List impossibleNames; - - public static GetMostPossibleTime dayOf(Schedule schedule, List possibleNames, List impossibleNames) { - return GetMostPossibleTime.builder() - .timePoint(schedule.getDay()) - .startTime(schedule.getTime()) - .endTime(String.valueOf(LocalTime.parse(schedule.getTime()).plusMinutes(30))) - .possibleCount(possibleNames.size()) - .possibleNames(possibleNames) - .impossibleNames(impossibleNames) - .build(); - } - - public static GetMostPossibleTime dateOf(Schedule schedule, List possibleNames, List impossibleNames) { - return GetMostPossibleTime.builder() - .timePoint(schedule.getDate()) - .startTime(schedule.getTime()) - .endTime(String.valueOf(LocalTime.parse(schedule.getTime()).plusMinutes(30))) - .possibleCount(possibleNames.size()) - .possibleNames(possibleNames) - .impossibleNames(impossibleNames) - .build(); - } - - public void updateEndTime(String endTime) { - endTime = String.valueOf(LocalTime.parse(endTime).plusMinutes(30)); - this.endTime = endTime; - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class GetUserParticipatedEventsResponse { - private UUID eventId; - private Category category; - private String title; - private String createdDate; - private int participantCount; - private String eventStatus; - private List mostPossibleTimes; - - public static GetUserParticipatedEventsResponse of(Event event, EventParticipation eventParticipation, int participantCount, List mostPossibleTimes) { - return GetUserParticipatedEventsResponse.builder() - .eventId(event.getEventId()) - .category(event.getCategory()) - .title(event.getTitle()) - .createdDate(String.valueOf(event.getCreatedDate())) - .participantCount(participantCount) - .eventStatus(String.valueOf(eventParticipation.getEventStatus())) - .mostPossibleTimes(mostPossibleTimes) - .build(); - } - } -} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/MemberDto.java b/src/main/java/side/onetime/dto/MemberDto.java deleted file mode 100644 index 8cf6145..0000000 --- a/src/main/java/side/onetime/dto/MemberDto.java +++ /dev/null @@ -1,124 +0,0 @@ -package side.onetime.dto; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import side.onetime.domain.Event; -import side.onetime.domain.Member; - -import java.util.List; -import java.util.UUID; - -public class MemberDto { - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class RegisterMemberRequest { - private String eventId; - private String name; - private String pin; - private List schedules; - - public Member to(Event event) { - return Member.builder() - .event(event) - .memberId(UUID.randomUUID()) - .name(name) - .pin(pin) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class RegisterMemberResponse { - private String memberId; - private String category; - - public static MemberDto.RegisterMemberResponse of(Member member, Event event) { - return RegisterMemberResponse.builder() - .memberId(String.valueOf(member.getMemberId())) - .category(event.getCategory().name()) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class Schedule { - private String timePoint; - private List times; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class LoginMemberRequest { - private String eventId; - private String name; - private String pin; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class LoginMemberResponse { - private String memberId; - private String category; - - public static MemberDto.LoginMemberResponse of(Member member, Event event) { - return LoginMemberResponse.builder() - .memberId(String.valueOf(member.getMemberId())) - .category(event.getCategory().name()) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class IsDuplicateRequest { - private String eventId; - private String name; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class IsDuplicateResponse { - private Boolean isPossible; - - public static MemberDto.IsDuplicateResponse of(Boolean isPossible) { - return MemberDto.IsDuplicateResponse.builder() - .isPossible(isPossible) - .build(); - } - } -} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/ScheduleDto.java b/src/main/java/side/onetime/dto/ScheduleDto.java deleted file mode 100644 index a3ef31e..0000000 --- a/src/main/java/side/onetime/dto/ScheduleDto.java +++ /dev/null @@ -1,137 +0,0 @@ -package side.onetime.dto; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import side.onetime.domain.Selection; - -import java.util.ArrayList; -import java.util.List; - -public class ScheduleDto { - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class CreateDayScheduleRequest { - private String eventId; - private String memberId; - @JsonProperty("schedules") - private List daySchedules; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class DaySchedule { - @JsonProperty("time_point") - private String day; - private List times; - - public static DaySchedule of(List selections) { - List times = new ArrayList<>(); - for (Selection selection : selections) { - times.add(selection.getSchedule().getTime()); - } - return DaySchedule.builder() - .day(selections.get(0).getSchedule().getDay()) - .times(times) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class CreateDateScheduleRequest { - private String eventId; - private String memberId; - @JsonProperty("schedules") - private List dateSchedules; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class DateSchedule { - @JsonProperty("time_point") - private String date; - private List times; - - public static DateSchedule of(List selections) { - List times = new ArrayList<>(); - for (Selection selection : selections) { - times.add(selection.getSchedule().getTime()); - } - return DateSchedule.builder() - .date(selections.get(0).getSchedule().getDate()) - .times(times) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class PerDaySchedulesResponse { - private String name; - @JsonProperty("schedules") - private List daySchedules; - - public static PerDaySchedulesResponse of(String name, List daySchedules) { - return PerDaySchedulesResponse.builder() - .name(name) - .daySchedules(daySchedules) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class PerDateSchedulesResponse { - private String name; - @JsonProperty("schedules") - private List dateSchedules; - - public static PerDateSchedulesResponse of(String name, List dateSchedules) { - return PerDateSchedulesResponse.builder() - .name(name) - .dateSchedules(dateSchedules) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class GetFilteredSchedulesRequest { - private String eventId; - private List names; - } -} diff --git a/src/main/java/side/onetime/dto/TokenDto.java b/src/main/java/side/onetime/dto/TokenDto.java deleted file mode 100644 index aa828d3..0000000 --- a/src/main/java/side/onetime/dto/TokenDto.java +++ /dev/null @@ -1,39 +0,0 @@ -package side.onetime.dto; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; - -public class TokenDto { - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class ReissueTokenRequest { - private String refreshToken; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class ReissueTokenResponse { - private String accessToken; - private String refreshToken; - - public static ReissueTokenResponse of(String accessToken, String refreshToken) { - return ReissueTokenResponse.builder() - .accessToken(accessToken) - .refreshToken(refreshToken) - .build(); - } - } -} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/UrlDto.java b/src/main/java/side/onetime/dto/UrlDto.java deleted file mode 100644 index 8c7694b..0000000 --- a/src/main/java/side/onetime/dto/UrlDto.java +++ /dev/null @@ -1,63 +0,0 @@ -package side.onetime.dto; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; - -public class UrlDto { - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class ConvertToShortenUrlRequest { - private String originalUrl; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class ConvertToShortenUrlResponse { - private String shortenUrl; - - public static ConvertToShortenUrlResponse of(String shortenUrl) { - return ConvertToShortenUrlResponse.builder() - .shortenUrl(shortenUrl) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class ConvertToOriginalUrlRequest { - private String shortenUrl; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class ConvertToOriginalUrlResponse { - private String originalUrl; - - public static ConvertToOriginalUrlResponse of(String originalUrl) { - return ConvertToOriginalUrlResponse.builder() - .originalUrl(originalUrl) - .build(); - } - } -} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/UserDto.java b/src/main/java/side/onetime/dto/UserDto.java deleted file mode 100644 index cdad045..0000000 --- a/src/main/java/side/onetime/dto/UserDto.java +++ /dev/null @@ -1,69 +0,0 @@ -package side.onetime.dto; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import side.onetime.domain.User; - -public class UserDto { - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class OnboardUserRequest { - private String registerToken; - private String nickname; - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class OnboardUserResponse { - private String accessToken; - private String refreshToken; - - public static OnboardUserResponse of(String accessToken, String refreshToken) { - return OnboardUserResponse.builder() - .accessToken(accessToken) - .refreshToken(refreshToken) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class GetUserProfileResponse { - private String nickname; - private String email; - - public static GetUserProfileResponse of(User user) { - return GetUserProfileResponse.builder() - .nickname(user.getNickname()) - .email(user.getEmail()) - .build(); - } - } - - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - public static class UpdateUserProfileRequest { - private String nickname; - } -} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/event/request/CreateEventRequest.java b/src/main/java/side/onetime/dto/event/request/CreateEventRequest.java new file mode 100644 index 0000000..126aa11 --- /dev/null +++ b/src/main/java/side/onetime/dto/event/request/CreateEventRequest.java @@ -0,0 +1,32 @@ +package side.onetime.dto.event.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import side.onetime.domain.Event; +import side.onetime.domain.enums.Category; + +import java.util.List; +import java.util.UUID; + +@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record CreateEventRequest( + @NotBlank(message = "제목은 필수 값입니다.") String title, + @NotBlank(message = "시작 시간은 필수 값입니다.") String startTime, + @NotBlank(message = "종료 시간은 필수 값입니다.") String endTime, + @NotBlank(message = "카테고리는 필수 값입니다.") Category category, + @NotNull(message = "설문 범위는 필수 값입니다.") List ranges +) { + public Event toEntity() { + return Event.builder() + .eventId(UUID.randomUUID()) + .title(title) + .startTime(startTime) + .endTime(endTime) + .category(category) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/event/response/CreateEventResponse.java b/src/main/java/side/onetime/dto/event/response/CreateEventResponse.java new file mode 100644 index 0000000..db47eec --- /dev/null +++ b/src/main/java/side/onetime/dto/event/response/CreateEventResponse.java @@ -0,0 +1,18 @@ +package side.onetime.dto.event.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Event; + +import java.util.UUID; + +@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record CreateEventResponse( + UUID eventId +) { + public static CreateEventResponse of(Event event) { + return new CreateEventResponse(event.getEventId()); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/event/response/GetEventResponse.java b/src/main/java/side/onetime/dto/event/response/GetEventResponse.java new file mode 100644 index 0000000..81a32e1 --- /dev/null +++ b/src/main/java/side/onetime/dto/event/response/GetEventResponse.java @@ -0,0 +1,29 @@ +package side.onetime.dto.event.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Event; +import side.onetime.domain.enums.Category; + +import java.util.List; + +@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record GetEventResponse( + String title, + String startTime, + String endTime, + Category category, + List ranges +) { + public static GetEventResponse of(Event event, List ranges) { + return new GetEventResponse( + event.getTitle(), + event.getStartTime(), + event.getEndTime(), + event.getCategory(), + ranges + ); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/event/response/GetMostPossibleTime.java b/src/main/java/side/onetime/dto/event/response/GetMostPossibleTime.java new file mode 100644 index 0000000..6e49479 --- /dev/null +++ b/src/main/java/side/onetime/dto/event/response/GetMostPossibleTime.java @@ -0,0 +1,53 @@ +package side.onetime.dto.event.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Schedule; + +import java.time.LocalTime; +import java.util.List; + +@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record GetMostPossibleTime( + String timePoint, + String startTime, + String endTime, + int possibleCount, + List possibleNames, + List impossibleNames +) { + public static GetMostPossibleTime dayOf(Schedule schedule, List possibleNames, List impossibleNames) { + return new GetMostPossibleTime( + schedule.getDay(), + schedule.getTime(), + String.valueOf(LocalTime.parse(schedule.getTime()).plusMinutes(30)), + possibleNames.size(), + possibleNames, + impossibleNames + ); + } + + public static GetMostPossibleTime dateOf(Schedule schedule, List possibleNames, List impossibleNames) { + return new GetMostPossibleTime( + schedule.getDate(), + schedule.getTime(), + String.valueOf(LocalTime.parse(schedule.getTime()).plusMinutes(30)), + possibleNames.size(), + possibleNames, + impossibleNames + ); + } + + public GetMostPossibleTime updateEndTime(String endTime) { + return new GetMostPossibleTime( + this.timePoint, + this.startTime, + String.valueOf(LocalTime.parse(endTime).plusMinutes(30)), + this.possibleCount, + this.possibleNames, + this.impossibleNames + ); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/event/response/GetParticipantsResponse.java b/src/main/java/side/onetime/dto/event/response/GetParticipantsResponse.java new file mode 100644 index 0000000..d6db2c3 --- /dev/null +++ b/src/main/java/side/onetime/dto/event/response/GetParticipantsResponse.java @@ -0,0 +1,22 @@ +package side.onetime.dto.event.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Member; +import side.onetime.domain.User; + +import java.util.List; +import java.util.stream.Collectors; + +@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record GetParticipantsResponse( + List names +) { + public static GetParticipantsResponse of(List members, List users) { + List names = members.stream().map(Member::getName).collect(Collectors.toList()); + names.addAll(users.stream().map(User::getNickname).collect(Collectors.toList())); + return new GetParticipantsResponse(names); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/event/response/GetUserParticipatedEventsResponse.java b/src/main/java/side/onetime/dto/event/response/GetUserParticipatedEventsResponse.java new file mode 100644 index 0000000..25a9acc --- /dev/null +++ b/src/main/java/side/onetime/dto/event/response/GetUserParticipatedEventsResponse.java @@ -0,0 +1,35 @@ +package side.onetime.dto.event.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Event; +import side.onetime.domain.EventParticipation; +import side.onetime.domain.enums.Category; + +import java.util.List; +import java.util.UUID; + +@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record GetUserParticipatedEventsResponse( + UUID eventId, + Category category, + String title, + String createdDate, + int participantCount, + String eventStatus, + List mostPossibleTimes +) { + public static GetUserParticipatedEventsResponse of(Event event, EventParticipation eventParticipation, int participantCount, List mostPossibleTimes) { + return new GetUserParticipatedEventsResponse( + event.getEventId(), + event.getCategory(), + event.getTitle(), + String.valueOf(event.getCreatedDate()), + participantCount, + String.valueOf(eventParticipation.getEventStatus()), + mostPossibleTimes + ); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/request/IsDuplicateRequest.java b/src/main/java/side/onetime/dto/member/request/IsDuplicateRequest.java new file mode 100644 index 0000000..a5bb0dd --- /dev/null +++ b/src/main/java/side/onetime/dto/member/request/IsDuplicateRequest.java @@ -0,0 +1,13 @@ +package side.onetime.dto.member.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record IsDuplicateRequest( + @NotBlank(message = "Event ID는 필수 값입니다.") String eventId, + @NotBlank(message = "이름은 필수 값입니다.") String name +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/request/LoginMemberRequest.java b/src/main/java/side/onetime/dto/member/request/LoginMemberRequest.java new file mode 100644 index 0000000..438c4aa --- /dev/null +++ b/src/main/java/side/onetime/dto/member/request/LoginMemberRequest.java @@ -0,0 +1,14 @@ +package side.onetime.dto.member.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record LoginMemberRequest( + @NotBlank(message = "Event ID는 필수 값입니다.") String eventId, + @NotBlank(message = "이름은 필수 값입니다.") String name, + @NotBlank(message = "PIN은 필수 값입니다.") String pin +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/request/RegisterMemberRequest.java b/src/main/java/side/onetime/dto/member/request/RegisterMemberRequest.java new file mode 100644 index 0000000..c965413 --- /dev/null +++ b/src/main/java/side/onetime/dto/member/request/RegisterMemberRequest.java @@ -0,0 +1,31 @@ +package side.onetime.dto.member.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import side.onetime.domain.Event; +import side.onetime.domain.Member; +import side.onetime.dto.member.response.ScheduleResponse; + +import java.util.List; +import java.util.UUID; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record RegisterMemberRequest( + @NotBlank(message = "Event ID는 필수 값입니다.") String eventId, + @NotBlank(message = "이름은 필수 값입니다.") String name, + @NotBlank(message = "PIN은 필수 값입니다.") String pin, + @NotNull(message = "스케줄 목록은 필수 값입니다.") List schedules +) { + public Member toEntity(Event event) { + return Member.builder() + .event(event) + .memberId(UUID.randomUUID()) + .name(name) + .pin(pin) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/response/IsDuplicateResponse.java b/src/main/java/side/onetime/dto/member/response/IsDuplicateResponse.java new file mode 100644 index 0000000..ea308f3 --- /dev/null +++ b/src/main/java/side/onetime/dto/member/response/IsDuplicateResponse.java @@ -0,0 +1,15 @@ +package side.onetime.dto.member.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record IsDuplicateResponse( + Boolean isPossible +) { + public static IsDuplicateResponse of(Boolean isPossible) { + return new IsDuplicateResponse(isPossible); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/response/LoginMemberResponse.java b/src/main/java/side/onetime/dto/member/response/LoginMemberResponse.java new file mode 100644 index 0000000..181de57 --- /dev/null +++ b/src/main/java/side/onetime/dto/member/response/LoginMemberResponse.java @@ -0,0 +1,21 @@ +package side.onetime.dto.member.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Event; +import side.onetime.domain.Member; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record LoginMemberResponse( + String memberId, + String category +) { + public static LoginMemberResponse of(Member member, Event event) { + return new LoginMemberResponse( + String.valueOf(member.getMemberId()), + event.getCategory().name() + ); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/response/RegisterMemberResponse.java b/src/main/java/side/onetime/dto/member/response/RegisterMemberResponse.java new file mode 100644 index 0000000..2a84f90 --- /dev/null +++ b/src/main/java/side/onetime/dto/member/response/RegisterMemberResponse.java @@ -0,0 +1,21 @@ +package side.onetime.dto.member.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.Event; +import side.onetime.domain.Member; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record RegisterMemberResponse( + String memberId, + String category +) { + public static RegisterMemberResponse of(Member member, Event event) { + return new RegisterMemberResponse( + String.valueOf(member.getMemberId()), + event.getCategory().name() + ); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/member/response/ScheduleResponse.java b/src/main/java/side/onetime/dto/member/response/ScheduleResponse.java new file mode 100644 index 0000000..f3f713f --- /dev/null +++ b/src/main/java/side/onetime/dto/member/response/ScheduleResponse.java @@ -0,0 +1,14 @@ +package side.onetime.dto.member.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ScheduleResponse( + String timePoint, + List times +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/schedule/request/CreateDateScheduleRequest.java b/src/main/java/side/onetime/dto/schedule/request/CreateDateScheduleRequest.java new file mode 100644 index 0000000..c94dd06 --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/request/CreateDateScheduleRequest.java @@ -0,0 +1,19 @@ +package side.onetime.dto.schedule.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import side.onetime.dto.schedule.response.DateSchedule; + +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record CreateDateScheduleRequest( + @NotBlank(message = "Event ID는 필수 값입니다.") String eventId, + String memberId, + @JsonProperty("schedules") @NotNull(message = "스케줄 목록은 필수 값입니다.") List dateSchedules +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/schedule/request/CreateDayScheduleRequest.java b/src/main/java/side/onetime/dto/schedule/request/CreateDayScheduleRequest.java new file mode 100644 index 0000000..9d4d769 --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/request/CreateDayScheduleRequest.java @@ -0,0 +1,19 @@ +package side.onetime.dto.schedule.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import side.onetime.dto.schedule.response.DaySchedule; + +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record CreateDayScheduleRequest( + @NotBlank(message = "Event ID는 필수 값입니다.") String eventId, + String memberId, + @JsonProperty("schedules") @NotNull(message = "스케줄 목록은 필수 값입니다.") List daySchedules +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/schedule/request/GetFilteredSchedulesRequest.java b/src/main/java/side/onetime/dto/schedule/request/GetFilteredSchedulesRequest.java new file mode 100644 index 0000000..64f8e14 --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/request/GetFilteredSchedulesRequest.java @@ -0,0 +1,16 @@ +package side.onetime.dto.schedule.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; + +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record GetFilteredSchedulesRequest( + @NotBlank(message = "Event ID는 필수 값입니다.") String eventId, + @NotNull(message = "이름 목록은 필수 값입니다.") List names +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/schedule/response/DateSchedule.java b/src/main/java/side/onetime/dto/schedule/response/DateSchedule.java new file mode 100644 index 0000000..4f78313 --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/response/DateSchedule.java @@ -0,0 +1,25 @@ +package side.onetime.dto.schedule.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import com.fasterxml.jackson.annotation.JsonProperty; +import side.onetime.domain.Selection; + +import java.util.ArrayList; +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record DateSchedule( + @JsonProperty("time_point") String date, + List times +) { + public static DateSchedule from(List selections) { + List times = new ArrayList<>(); + for (Selection selection : selections) { + times.add(selection.getSchedule().getTime()); + } + return new DateSchedule(selections.get(0).getSchedule().getDate(), times); + } +} diff --git a/src/main/java/side/onetime/dto/schedule/response/DaySchedule.java b/src/main/java/side/onetime/dto/schedule/response/DaySchedule.java new file mode 100644 index 0000000..c1f154a --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/response/DaySchedule.java @@ -0,0 +1,25 @@ +package side.onetime.dto.schedule.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import com.fasterxml.jackson.annotation.JsonProperty; +import side.onetime.domain.Selection; + +import java.util.ArrayList; +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record DaySchedule( + @JsonProperty("time_point") String day, + List times +) { + public static DaySchedule from(List selections) { + List times = new ArrayList<>(); + for (Selection selection : selections) { + times.add(selection.getSchedule().getTime()); + } + return new DaySchedule(selections.get(0).getSchedule().getDay(), times); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/schedule/response/PerDateSchedulesResponse.java b/src/main/java/side/onetime/dto/schedule/response/PerDateSchedulesResponse.java new file mode 100644 index 0000000..1e2c84b --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/response/PerDateSchedulesResponse.java @@ -0,0 +1,19 @@ +package side.onetime.dto.schedule.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record PerDateSchedulesResponse( + String name, + @JsonProperty("schedules") List dateSchedules +) { + public static PerDateSchedulesResponse of(String name, List dateSchedules) { + return new PerDateSchedulesResponse(name, dateSchedules); + } +} diff --git a/src/main/java/side/onetime/dto/schedule/response/PerDaySchedulesResponse.java b/src/main/java/side/onetime/dto/schedule/response/PerDaySchedulesResponse.java new file mode 100644 index 0000000..eb6042e --- /dev/null +++ b/src/main/java/side/onetime/dto/schedule/response/PerDaySchedulesResponse.java @@ -0,0 +1,19 @@ +package side.onetime.dto.schedule.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record PerDaySchedulesResponse( + String name, + @JsonProperty("schedules") List daySchedules +) { + public static PerDaySchedulesResponse of(String name, List daySchedules) { + return new PerDaySchedulesResponse(name, daySchedules); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/token/request/ReissueTokenRequest.java b/src/main/java/side/onetime/dto/token/request/ReissueTokenRequest.java new file mode 100644 index 0000000..8a30ac4 --- /dev/null +++ b/src/main/java/side/onetime/dto/token/request/ReissueTokenRequest.java @@ -0,0 +1,12 @@ +package side.onetime.dto.token.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ReissueTokenRequest( + @NotBlank(message = "리프레쉬 토큰은 필수 값입니다.") String refreshToken +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/token/response/ReissueTokenResponse.java b/src/main/java/side/onetime/dto/token/response/ReissueTokenResponse.java new file mode 100644 index 0000000..d32787b --- /dev/null +++ b/src/main/java/side/onetime/dto/token/response/ReissueTokenResponse.java @@ -0,0 +1,16 @@ +package side.onetime.dto.token.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ReissueTokenResponse( + String accessToken, + String refreshToken +) { + public static ReissueTokenResponse of(String accessToken, String refreshToken) { + return new ReissueTokenResponse(accessToken, refreshToken); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/url/request/ConvertToOriginalUrlRequest.java b/src/main/java/side/onetime/dto/url/request/ConvertToOriginalUrlRequest.java new file mode 100644 index 0000000..214ca80 --- /dev/null +++ b/src/main/java/side/onetime/dto/url/request/ConvertToOriginalUrlRequest.java @@ -0,0 +1,12 @@ +package side.onetime.dto.url.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ConvertToOriginalUrlRequest( + @NotBlank(message = "Shorten URL은 필수 값입니다.") String shortenUrl +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/url/request/ConvertToShortenUrlRequest.java b/src/main/java/side/onetime/dto/url/request/ConvertToShortenUrlRequest.java new file mode 100644 index 0000000..79a156c --- /dev/null +++ b/src/main/java/side/onetime/dto/url/request/ConvertToShortenUrlRequest.java @@ -0,0 +1,12 @@ +package side.onetime.dto.url.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ConvertToShortenUrlRequest( + @NotBlank(message = "Original URL은 필수 값입니다.") String originalUrl +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/url/response/ConvertToOriginalUrlResponse.java b/src/main/java/side/onetime/dto/url/response/ConvertToOriginalUrlResponse.java new file mode 100644 index 0000000..5d5e4f7 --- /dev/null +++ b/src/main/java/side/onetime/dto/url/response/ConvertToOriginalUrlResponse.java @@ -0,0 +1,15 @@ +package side.onetime.dto.url.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ConvertToOriginalUrlResponse( + String originalUrl +) { + public static ConvertToOriginalUrlResponse of(String originalUrl) { + return new ConvertToOriginalUrlResponse(originalUrl); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/url/response/ConvertToShortenUrlResponse.java b/src/main/java/side/onetime/dto/url/response/ConvertToShortenUrlResponse.java new file mode 100644 index 0000000..d9a5c38 --- /dev/null +++ b/src/main/java/side/onetime/dto/url/response/ConvertToShortenUrlResponse.java @@ -0,0 +1,15 @@ +package side.onetime.dto.url.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ConvertToShortenUrlResponse( + String shortenUrl +) { + public static ConvertToShortenUrlResponse of(String shortenUrl) { + return new ConvertToShortenUrlResponse(shortenUrl); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/user/request/OnboardUserRequest.java b/src/main/java/side/onetime/dto/user/request/OnboardUserRequest.java new file mode 100644 index 0000000..15dd35d --- /dev/null +++ b/src/main/java/side/onetime/dto/user/request/OnboardUserRequest.java @@ -0,0 +1,13 @@ +package side.onetime.dto.user.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record OnboardUserRequest( + @NotBlank(message = "Register Token은 필수 값입니다.") String registerToken, + @NotBlank(message = "Nickname은 필수 값입니다.") String nickname +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/user/request/UpdateUserProfileRequest.java b/src/main/java/side/onetime/dto/user/request/UpdateUserProfileRequest.java new file mode 100644 index 0000000..ded1ffb --- /dev/null +++ b/src/main/java/side/onetime/dto/user/request/UpdateUserProfileRequest.java @@ -0,0 +1,12 @@ +package side.onetime.dto.user.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import jakarta.validation.constraints.NotBlank; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record UpdateUserProfileRequest( + @NotBlank(message = "Nickname은 필수 값입니다.") String nickname +) {} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/user/response/GetUserProfileResponse.java b/src/main/java/side/onetime/dto/user/response/GetUserProfileResponse.java new file mode 100644 index 0000000..66fc231 --- /dev/null +++ b/src/main/java/side/onetime/dto/user/response/GetUserProfileResponse.java @@ -0,0 +1,17 @@ +package side.onetime.dto.user.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import side.onetime.domain.User; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record GetUserProfileResponse( + String nickname, + String email +) { + public static GetUserProfileResponse of(User user) { + return new GetUserProfileResponse(user.getNickname(), user.getEmail()); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/dto/user/response/OnboardUserResponse.java b/src/main/java/side/onetime/dto/user/response/OnboardUserResponse.java new file mode 100644 index 0000000..ce78901 --- /dev/null +++ b/src/main/java/side/onetime/dto/user/response/OnboardUserResponse.java @@ -0,0 +1,16 @@ +package side.onetime.dto.user.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record OnboardUserResponse( + String accessToken, + String refreshToken +) { + public static OnboardUserResponse of(String accessToken, String refreshToken) { + return new OnboardUserResponse(accessToken, refreshToken); + } +} \ No newline at end of file diff --git a/src/main/java/side/onetime/service/EventService.java b/src/main/java/side/onetime/service/EventService.java index aebfa11..01dbf03 100644 --- a/src/main/java/side/onetime/service/EventService.java +++ b/src/main/java/side/onetime/service/EventService.java @@ -1,14 +1,18 @@ package side.onetime.service; -import org.springframework.transaction.annotation.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import side.onetime.domain.*; +import side.onetime.domain.enums.Category; import side.onetime.domain.enums.EventStatus; -import side.onetime.dto.EventDto; +import side.onetime.dto.event.request.CreateEventRequest; +import side.onetime.dto.event.response.*; import side.onetime.exception.*; -import side.onetime.domain.enums.Category; -import side.onetime.repository.*; +import side.onetime.repository.EventParticipationRepository; +import side.onetime.repository.EventRepository; +import side.onetime.repository.ScheduleRepository; +import side.onetime.repository.SelectionRepository; import side.onetime.util.DateUtil; import side.onetime.util.JwtUtil; @@ -29,30 +33,30 @@ public class EventService { // 이벤트 생성 메서드 (비로그인) @Transactional - public EventDto.CreateEventResponse createEventForAnonymousUser(EventDto.CreateEventRequest createEventRequest) { - Event event = createEventRequest.to(); + public CreateEventResponse createEventForAnonymousUser(CreateEventRequest createEventRequest) { + Event event = createEventRequest.toEntity(); eventRepository.save(event); - if (createEventRequest.getCategory().equals(Category.DATE)) { - if (!isDateFormat(createEventRequest.getRanges().get(0))) { + if (createEventRequest.category().equals(Category.DATE)) { + if (!isDateFormat(createEventRequest.ranges().get(0))) { throw new EventException(EventErrorResult._IS_NOT_DATE_FORMAT); } - createAndSaveDateSchedules(event, createEventRequest.getRanges(), createEventRequest.getStartTime(), createEventRequest.getEndTime()); + createAndSaveDateSchedules(event, createEventRequest.ranges(), createEventRequest.startTime(), createEventRequest.endTime()); } else { - if (isDateFormat(createEventRequest.getRanges().get(0))) { + if (isDateFormat(createEventRequest.ranges().get(0))) { throw new EventException(EventErrorResult._IS_NOT_DAY_FORMAT); } - createAndSaveDaySchedules(event, createEventRequest.getRanges(), createEventRequest.getStartTime(), createEventRequest.getEndTime()); + createAndSaveDaySchedules(event, createEventRequest.ranges(), createEventRequest.startTime(), createEventRequest.endTime()); } - return EventDto.CreateEventResponse.of(event); + return CreateEventResponse.of(event); } // 이벤트 생성 메서드 (로그인) @Transactional - public EventDto.CreateEventResponse createEventForAuthenticatedUser(EventDto.CreateEventRequest createEventRequest, String authorizationHeader) { + public CreateEventResponse createEventForAuthenticatedUser(CreateEventRequest createEventRequest, String authorizationHeader) { User user = jwtUtil.getUserFromHeader(authorizationHeader); - Event event = createEventRequest.to(); + Event event = createEventRequest.toEntity(); EventParticipation eventParticipation = EventParticipation.builder() .user(user) .event(event) @@ -61,19 +65,19 @@ public EventDto.CreateEventResponse createEventForAuthenticatedUser(EventDto.Cre eventRepository.save(event); eventParticipationRepository.save(eventParticipation); - if (createEventRequest.getCategory().equals(Category.DATE)) { - if (!isDateFormat(createEventRequest.getRanges().get(0))) { + if (createEventRequest.category().equals(Category.DATE)) { + if (!isDateFormat(createEventRequest.ranges().get(0))) { throw new EventException(EventErrorResult._IS_NOT_DATE_FORMAT); } - createAndSaveDateSchedules(event, createEventRequest.getRanges(), createEventRequest.getStartTime(), createEventRequest.getEndTime()); + createAndSaveDateSchedules(event, createEventRequest.ranges(), createEventRequest.startTime(), createEventRequest.endTime()); } else { - if (isDateFormat(createEventRequest.getRanges().get(0))) { + if (isDateFormat(createEventRequest.ranges().get(0))) { throw new EventException(EventErrorResult._IS_NOT_DAY_FORMAT); } - createAndSaveDaySchedules(event, createEventRequest.getRanges(), createEventRequest.getStartTime(), createEventRequest.getEndTime()); + createAndSaveDaySchedules(event, createEventRequest.ranges(), createEventRequest.startTime(), createEventRequest.endTime()); } - return EventDto.CreateEventResponse.of(event); + return CreateEventResponse.of(event); } // 날짜 스케줄을 생성하고 저장하는 메서드 @@ -108,7 +112,7 @@ protected void createAndSaveDaySchedules(Event event, List ranges, Strin // 이벤트 조회 메서드 @Transactional(readOnly = true) - public EventDto.GetEventResponse getEvent(String eventId) { + public GetEventResponse getEvent(String eventId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -119,12 +123,12 @@ public EventDto.GetEventResponse getEvent(String eventId) { ? DateUtil.getSortedDateRanges(schedules.stream().map(Schedule::getDate).toList(), "yyyy.MM.dd") : DateUtil.getSortedDayRanges(schedules.stream().map(Schedule::getDay).toList()); - return EventDto.GetEventResponse.of(event, ranges); + return GetEventResponse.of(event, ranges); } // 참여자 조회 메서드 @Transactional(readOnly = true) - public EventDto.GetParticipantsResponse getParticipants(String eventId) { + public GetParticipantsResponse getParticipants(String eventId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -143,12 +147,12 @@ public EventDto.GetParticipantsResponse getParticipants(String eventId) { .map(EventParticipation::getUser) .toList(); - return EventDto.GetParticipantsResponse.of(members, users); + return GetParticipantsResponse.of(members, users); } // 가장 많이 되는 시간 조회 메서드 @Transactional(readOnly = true) - public List getMostPossibleTime(String eventId) { + public List getMostPossibleTime(String eventId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -161,8 +165,8 @@ public List getMostPossibleTime(String eventId) { // 이벤트에 참여하는 모든 유저 List eventParticipations = eventParticipationRepository.findAllByEvent(event); - EventDto.GetParticipantsResponse getParticipantsResponse = getParticipants(eventId); - List participantNames = getParticipantsResponse.getNames(); + GetParticipantsResponse getParticipantsResponse = getParticipants(eventId); + List participantNames = getParticipantsResponse.names(); // 유저 필터링: 참여자 목록에 있는 유저만 포함 List allUserNicknames = eventParticipations.stream() @@ -185,7 +189,7 @@ public List getMostPossibleTime(String eventId) { List allParticipants = new ArrayList<>(allMembersName); allParticipants.addAll(allUserNicknames); - List mostPossibleTimes = buildMostPossibleTimes(scheduleToNamesMap, mostPossibleCnt, allParticipants, event.getCategory()); + List mostPossibleTimes = buildMostPossibleTimes(scheduleToNamesMap, mostPossibleCnt, allParticipants, event.getCategory()); return DateUtil.sortMostPossibleTimes(mostPossibleTimes, event.getCategory()); } @@ -208,9 +212,9 @@ private Map> buildScheduleToNamesMap(List sele } // 최적 시간대 리스트 생성 - private List buildMostPossibleTimes(Map> scheduleToNamesMap, int mostPossibleCnt, List allMembersName, Category category) { - List mostPossibleTimes = new ArrayList<>(); - EventDto.GetMostPossibleTime previousTime = null; + private List buildMostPossibleTimes(Map> scheduleToNamesMap, int mostPossibleCnt, List allMembersName, Category category) { + List mostPossibleTimes = new ArrayList<>(); + GetMostPossibleTime previousTime = null; for (Map.Entry> entry : scheduleToNamesMap.entrySet()) { Schedule schedule = entry.getKey(); @@ -224,7 +228,7 @@ private List buildMostPossibleTimes(Map !curNames.contains(name)) .toList(); - EventDto.GetMostPossibleTime newTime = createMostPossibleTime(schedule, curNames, impossibleNames, category); + GetMostPossibleTime newTime = createMostPossibleTime(schedule, curNames, impossibleNames, category); mostPossibleTimes.add(newTime); previousTime = newTime; } @@ -238,23 +242,23 @@ private List buildMostPossibleTimes(Map curNames, Category category) { + private boolean canMergeWithPrevious(GetMostPossibleTime previousTime, Schedule schedule, List curNames, Category category) { if (previousTime == null) return false; boolean isSameTimePoint = category.equals(Category.DAY) - ? previousTime.getTimePoint().equals(schedule.getDay()) - : previousTime.getTimePoint().equals(schedule.getDate()); + ? previousTime.timePoint().equals(schedule.getDay()) + : previousTime.timePoint().equals(schedule.getDate()); return isSameTimePoint - && previousTime.getEndTime().equals(schedule.getTime()) - && new HashSet<>(previousTime.getPossibleNames()).containsAll(curNames); + && previousTime.endTime().equals(schedule.getTime()) + && new HashSet<>(previousTime.possibleNames()).containsAll(curNames); } // 새로운 시간대 객체 생성 - private EventDto.GetMostPossibleTime createMostPossibleTime(Schedule schedule, List curNames, List impossibleNames, Category category) { + private GetMostPossibleTime createMostPossibleTime(Schedule schedule, List curNames, List impossibleNames, Category category) { return category.equals(Category.DAY) - ? EventDto.GetMostPossibleTime.dayOf(schedule, curNames, impossibleNames) - : EventDto.GetMostPossibleTime.dateOf(schedule, curNames, impossibleNames); + ? GetMostPossibleTime.dayOf(schedule, curNames, impossibleNames) + : GetMostPossibleTime.dateOf(schedule, curNames, impossibleNames); } // 날짜 포맷인지 검증 @@ -264,7 +268,7 @@ private boolean isDateFormat(String range) { // 유저 참여 이벤트 반환 메서드 @Transactional(readOnly = true) - public List getUserParticipatedEvents(String authorizationHeader) { + public List getUserParticipatedEvents(String authorizationHeader) { User user = jwtUtil.getUserFromHeader(authorizationHeader); return eventParticipationRepository.findAllByUser(user).stream() @@ -274,10 +278,10 @@ public List getUserParticipatedEvent .map(eventParticipation -> { Event event = eventParticipation.getEvent(); String eventId = String.valueOf(event.getEventId()); - EventDto.GetParticipantsResponse getParticipantsResponse = getParticipants(eventId); - List participantNames = getParticipantsResponse.getNames(); - List mostPossibleTimes = getMostPossibleTime(eventId); - return EventDto.GetUserParticipatedEventsResponse.of(event, eventParticipation, participantNames.size(), mostPossibleTimes); + GetParticipantsResponse getParticipantsResponse = getParticipants(eventId); + List participantNames = getParticipantsResponse.names(); + List mostPossibleTimes = getMostPossibleTime(eventId); + return GetUserParticipatedEventsResponse.of(event, eventParticipation, participantNames.size(), mostPossibleTimes); }) .collect(Collectors.toList()); } diff --git a/src/main/java/side/onetime/service/MemberService.java b/src/main/java/side/onetime/service/MemberService.java index c17e393..a52a94c 100644 --- a/src/main/java/side/onetime/service/MemberService.java +++ b/src/main/java/side/onetime/service/MemberService.java @@ -1,15 +1,21 @@ package side.onetime.service; -import org.springframework.transaction.annotation.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import side.onetime.domain.Event; import side.onetime.domain.Member; import side.onetime.domain.Schedule; import side.onetime.domain.Selection; -import side.onetime.dto.MemberDto; -import side.onetime.exception.*; import side.onetime.domain.enums.Category; +import side.onetime.dto.member.request.IsDuplicateRequest; +import side.onetime.dto.member.request.LoginMemberRequest; +import side.onetime.dto.member.request.RegisterMemberRequest; +import side.onetime.dto.member.response.IsDuplicateResponse; +import side.onetime.dto.member.response.LoginMemberResponse; +import side.onetime.dto.member.response.RegisterMemberResponse; +import side.onetime.dto.member.response.ScheduleResponse; +import side.onetime.exception.*; import side.onetime.repository.EventRepository; import side.onetime.repository.MemberRepository; import side.onetime.repository.ScheduleRepository; @@ -29,16 +35,16 @@ public class MemberService { // 멤버 등록 메서드 @Transactional - public MemberDto.RegisterMemberResponse registerMember(MemberDto.RegisterMemberRequest registerMemberRequest) { - UUID eventId = UUID.fromString(registerMemberRequest.getEventId()); + public RegisterMemberResponse registerMember(RegisterMemberRequest registerMemberRequest) { + UUID eventId = UUID.fromString(registerMemberRequest.eventId()); Event event = eventRepository.findByEventId(eventId) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - if (memberRepository.existsByEventAndName(event, registerMemberRequest.getName())) { + if (memberRepository.existsByEventAndName(event, registerMemberRequest.name())) { throw new MemberException(MemberErrorResult._IS_ALREADY_REGISTERED); } - Member member = registerMemberRequest.to(event); + Member member = registerMemberRequest.toEntity(event); memberRepository.save(member); List selections; @@ -49,16 +55,16 @@ public MemberDto.RegisterMemberResponse registerMember(MemberDto.RegisterMemberR } selectionRepository.saveAll(selections); - return MemberDto.RegisterMemberResponse.of(member, event); + return RegisterMemberResponse.of(member, event); } // 멤버 요일 선택 목록을 만드는 메서드 - private List createMembersDaySelections(Event event, Member member, MemberDto.RegisterMemberRequest registerMemberRequest) { - List schedules = registerMemberRequest.getSchedules(); + private List createMembersDaySelections(Event event, Member member, RegisterMemberRequest registerMemberRequest) { + List schedules = registerMemberRequest.schedules(); List selections = new ArrayList<>(); - for (MemberDto.Schedule schedule : schedules) { - String day = schedule.getTimePoint(); - List times = schedule.getTimes(); + for (ScheduleResponse schedule : schedules) { + String day = schedule.timePoint(); + List times = schedule.times(); List selectedSchedules = scheduleRepository.findAllByEventAndDay(event, day) .orElseThrow(() -> new ScheduleException(ScheduleErrorResult._NOT_FOUND_DAY_SCHEDULES)); @@ -75,12 +81,12 @@ private List createMembersDaySelections(Event event, Member member, M } // 멤버 날짜 선택 목록을 만드는 메서드 - private List createMembersDateSelections(Event event, Member member, MemberDto.RegisterMemberRequest registerMemberRequest) { - List schedules = registerMemberRequest.getSchedules(); + private List createMembersDateSelections(Event event, Member member, RegisterMemberRequest registerMemberRequest) { + List schedules = registerMemberRequest.schedules(); List selections = new ArrayList<>(); - for (MemberDto.Schedule schedule : schedules) { - String date = schedule.getTimePoint(); - List times = schedule.getTimes(); + for (ScheduleResponse schedule : schedules) { + String date = schedule.timePoint(); + List times = schedule.times(); List selectedSchedules = scheduleRepository.findAllByEventAndDate(event, date) .orElseThrow(() -> new ScheduleException(ScheduleErrorResult._NOT_FOUND_DATE_SCHEDULES)); @@ -98,23 +104,23 @@ private List createMembersDateSelections(Event event, Member member, // 멤버 로그인 메서드 @Transactional(readOnly = true) - public MemberDto.LoginMemberResponse loginMember(MemberDto.LoginMemberRequest loginMemberRequest) { - UUID eventId = UUID.fromString(loginMemberRequest.getEventId()); + public LoginMemberResponse loginMember(LoginMemberRequest loginMemberRequest) { + UUID eventId = UUID.fromString(loginMemberRequest.eventId()); Event event = eventRepository.findByEventId(eventId) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - Member member = memberRepository.findByEventAndNameAndPin(event, loginMemberRequest.getName(), loginMemberRequest.getPin()) + Member member = memberRepository.findByEventAndNameAndPin(event, loginMemberRequest.name(), loginMemberRequest.pin()) .orElseThrow(() -> new MemberException(MemberErrorResult._NOT_FOUND_MEMBER)); - return MemberDto.LoginMemberResponse.of(member, event); + return LoginMemberResponse.of(member, event); } // 멤버 이름 중복 체크 메서드 @Transactional(readOnly = true) - public MemberDto.IsDuplicateResponse isDuplicate(MemberDto.IsDuplicateRequest isDuplicateRequest) { - UUID eventId = UUID.fromString(isDuplicateRequest.getEventId()); + public IsDuplicateResponse isDuplicate(IsDuplicateRequest isDuplicateRequest) { + UUID eventId = UUID.fromString(isDuplicateRequest.eventId()); Event event = eventRepository.findByEventId(eventId) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - return MemberDto.IsDuplicateResponse.of(!memberRepository.existsByEventAndName(event, isDuplicateRequest.getName())); + return IsDuplicateResponse.of(!memberRepository.existsByEventAndName(event, isDuplicateRequest.name())); } } \ No newline at end of file diff --git a/src/main/java/side/onetime/service/ScheduleService.java b/src/main/java/side/onetime/service/ScheduleService.java index 5729fde..8fae3d9 100644 --- a/src/main/java/side/onetime/service/ScheduleService.java +++ b/src/main/java/side/onetime/service/ScheduleService.java @@ -1,12 +1,18 @@ package side.onetime.service; -import org.springframework.transaction.annotation.Transactional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import side.onetime.domain.*; import side.onetime.domain.enums.EventStatus; -import side.onetime.dto.EventDto; -import side.onetime.dto.ScheduleDto; +import side.onetime.dto.event.response.GetParticipantsResponse; +import side.onetime.dto.schedule.request.CreateDateScheduleRequest; +import side.onetime.dto.schedule.request.CreateDayScheduleRequest; +import side.onetime.dto.schedule.request.GetFilteredSchedulesRequest; +import side.onetime.dto.schedule.response.DateSchedule; +import side.onetime.dto.schedule.response.DaySchedule; +import side.onetime.dto.schedule.response.PerDateSchedulesResponse; +import side.onetime.dto.schedule.response.PerDaySchedulesResponse; import side.onetime.exception.*; import side.onetime.repository.*; import side.onetime.util.JwtUtil; @@ -27,17 +33,17 @@ public class ScheduleService { // 요일 스케줄 등록 메서드 (비로그인) @Transactional - public void createDaySchedulesForAnonymousUser(ScheduleDto.CreateDayScheduleRequest createDayScheduleRequest) { - Event event = eventRepository.findByEventId(UUID.fromString(createDayScheduleRequest.getEventId())) + public void createDaySchedulesForAnonymousUser(CreateDayScheduleRequest createDayScheduleRequest) { + Event event = eventRepository.findByEventId(UUID.fromString(createDayScheduleRequest.eventId())) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - Member member = memberRepository.findByMemberId(UUID.fromString(createDayScheduleRequest.getMemberId())) + Member member = memberRepository.findByMemberId(UUID.fromString(createDayScheduleRequest.memberId())) .orElseThrow(() -> new MemberException(MemberErrorResult._NOT_FOUND_MEMBER)); - List daySchedules = createDayScheduleRequest.getDaySchedules(); + List daySchedules = createDayScheduleRequest.daySchedules(); List selections = new ArrayList<>(); - for (ScheduleDto.DaySchedule daySchedule : daySchedules) { - String day = daySchedule.getDay(); - List times = daySchedule.getTimes(); + for (DaySchedule daySchedule : daySchedules) { + String day = daySchedule.day(); + List times = daySchedule.times(); List schedules = scheduleRepository.findAllByEventAndDay(event, day) .orElseThrow(() -> new ScheduleException(ScheduleErrorResult._NOT_FOUND_DAY_SCHEDULES)); @@ -57,8 +63,8 @@ public void createDaySchedulesForAnonymousUser(ScheduleDto.CreateDayScheduleRequ // 요일 스케줄 등록 메서드 (로그인) @Transactional - public void createDaySchedulesForAuthenticatedUser(ScheduleDto.CreateDayScheduleRequest createDayScheduleRequest, String authorizationHeader) { - Event event = eventRepository.findByEventId(UUID.fromString(createDayScheduleRequest.getEventId())) + public void createDaySchedulesForAuthenticatedUser(CreateDayScheduleRequest createDayScheduleRequest, String authorizationHeader) { + Event event = eventRepository.findByEventId(UUID.fromString(createDayScheduleRequest.eventId())) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); User user = jwtUtil.getUserFromHeader(authorizationHeader); // 참여 정보가 없는 경우 참여자로 저장 @@ -71,13 +77,13 @@ public void createDaySchedulesForAuthenticatedUser(ScheduleDto.CreateDaySchedule .build() )); - List daySchedules = createDayScheduleRequest.getDaySchedules(); + List daySchedules = createDayScheduleRequest.daySchedules(); List newSelections = new ArrayList<>(); List allSchedules = new ArrayList<>(); - for (ScheduleDto.DaySchedule daySchedule : daySchedules) { - String day = daySchedule.getDay(); - List times = daySchedule.getTimes(); + for (DaySchedule daySchedule : daySchedules) { + String day = daySchedule.day(); + List times = daySchedule.times(); List schedules = scheduleRepository.findAllByEventAndDay(event, day) .orElseThrow(() -> new ScheduleException(ScheduleErrorResult._NOT_FOUND_DAY_SCHEDULES)); @@ -97,17 +103,17 @@ public void createDaySchedulesForAuthenticatedUser(ScheduleDto.CreateDaySchedule // 날짜 스케줄 등록 메서드 (비로그인) @Transactional - public void createDateSchedulesForAnonymousUser(ScheduleDto.CreateDateScheduleRequest createDateScheduleRequest) { - Event event = eventRepository.findByEventId(UUID.fromString(createDateScheduleRequest.getEventId())) + public void createDateSchedulesForAnonymousUser(CreateDateScheduleRequest createDateScheduleRequest) { + Event event = eventRepository.findByEventId(UUID.fromString(createDateScheduleRequest.eventId())) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - Member member = memberRepository.findByMemberId(UUID.fromString(createDateScheduleRequest.getMemberId())) + Member member = memberRepository.findByMemberId(UUID.fromString(createDateScheduleRequest.memberId())) .orElseThrow(() -> new MemberException(MemberErrorResult._NOT_FOUND_MEMBER)); - List dateSchedules = createDateScheduleRequest.getDateSchedules(); + List dateSchedules = createDateScheduleRequest.dateSchedules(); List selections = new ArrayList<>(); - for (ScheduleDto.DateSchedule dateSchedule : dateSchedules) { - String date = dateSchedule.getDate(); - List times = dateSchedule.getTimes(); + for (DateSchedule dateSchedule : dateSchedules) { + String date = dateSchedule.date(); + List times = dateSchedule.times(); List schedules = scheduleRepository.findAllByEventAndDate(event, date) .orElseThrow(() -> new ScheduleException(ScheduleErrorResult._NOT_FOUND_DATE_SCHEDULES)); @@ -127,8 +133,8 @@ public void createDateSchedulesForAnonymousUser(ScheduleDto.CreateDateScheduleRe // 날짜 스케줄 등록 메서드 (로그인) @Transactional - public void createDateSchedulesForAuthenticatedUser(ScheduleDto.CreateDateScheduleRequest createDateScheduleRequest, String authorizationHeader) { - Event event = eventRepository.findByEventId(UUID.fromString(createDateScheduleRequest.getEventId())) + public void createDateSchedulesForAuthenticatedUser(CreateDateScheduleRequest createDateScheduleRequest, String authorizationHeader) { + Event event = eventRepository.findByEventId(UUID.fromString(createDateScheduleRequest.eventId())) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); User user = jwtUtil.getUserFromHeader(authorizationHeader); // 참여 정보가 없는 경우 참여자로 저장 @@ -141,13 +147,13 @@ public void createDateSchedulesForAuthenticatedUser(ScheduleDto.CreateDateSchedu .build() )); - List dateSchedules = createDateScheduleRequest.getDateSchedules(); + List dateSchedules = createDateScheduleRequest.dateSchedules(); List newSelections = new ArrayList<>(); List allSchedules = new ArrayList<>(); - for (ScheduleDto.DateSchedule dateSchedule : dateSchedules) { - String date = dateSchedule.getDate(); - List times = dateSchedule.getTimes(); + for (DateSchedule dateSchedule : dateSchedules) { + String date = dateSchedule.date(); + List times = dateSchedule.times(); List schedules = scheduleRepository.findAllByEventAndDate(event, date) .orElseThrow(() -> new ScheduleException(ScheduleErrorResult._NOT_FOUND_DATE_SCHEDULES)); @@ -170,7 +176,7 @@ public void createDateSchedulesForAuthenticatedUser(ScheduleDto.CreateDateSchedu // 전체 요일 스케줄 반환 메서드 @Transactional(readOnly = true) - public List getAllDaySchedules(String eventId) { + public List getAllDaySchedules(String eventId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -178,8 +184,8 @@ public List getAllDaySchedules(String event List members = memberRepository.findAllWithSelectionsAndSchedulesByEvent(event); // 이벤트에 참여하는 모든 참여자 목록 - EventDto.GetParticipantsResponse getParticipantsResponse = eventService.getParticipants(eventId); - List participantNames = getParticipantsResponse.getNames(); + GetParticipantsResponse getParticipantsResponse = eventService.getParticipants(eventId); + List participantNames = getParticipantsResponse.names(); // 이벤트에 참여하는 모든 유저 List eventParticipations = eventParticipationRepository.findAllByEvent(event); @@ -188,7 +194,7 @@ public List getAllDaySchedules(String event .filter(user -> participantNames.contains(user.getNickname())) // 유저가 참여자 목록에 있는지 확인 .toList(); - List perDaySchedulesResponses = new ArrayList<>(); + List perDaySchedulesResponses = new ArrayList<>(); // 멤버 스케줄 추가 for (Member member : members) { @@ -199,10 +205,10 @@ public List getAllDaySchedules(String event Collectors.toList() )); - List daySchedules = groupedSelectionsByDay.entrySet().stream() - .map(entry -> ScheduleDto.DaySchedule.of(entry.getValue())) + List daySchedules = groupedSelectionsByDay.entrySet().stream() + .map(entry -> DaySchedule.from(entry.getValue())) .collect(Collectors.toList()); - perDaySchedulesResponses.add(ScheduleDto.PerDaySchedulesResponse.of(member.getName(), daySchedules)); + perDaySchedulesResponses.add(PerDaySchedulesResponse.of(member.getName(), daySchedules)); } // 유저 스케줄 추가 @@ -215,10 +221,10 @@ public List getAllDaySchedules(String event Collectors.toList() )); - List daySchedules = groupedSelectionsByDay.entrySet().stream() - .map(entry -> ScheduleDto.DaySchedule.of(entry.getValue())) + List daySchedules = groupedSelectionsByDay.entrySet().stream() + .map(entry -> DaySchedule.from(entry.getValue())) .collect(Collectors.toList()); - perDaySchedulesResponses.add(ScheduleDto.PerDaySchedulesResponse.of(user.getNickname(), daySchedules)); + perDaySchedulesResponses.add(PerDaySchedulesResponse.of(user.getNickname(), daySchedules)); } return perDaySchedulesResponses; @@ -226,7 +232,7 @@ public List getAllDaySchedules(String event // 개인 요일 스케줄 반환 메서드 (비로그인) @Transactional(readOnly = true) - public ScheduleDto.PerDaySchedulesResponse getMemberDaySchedules(String eventId, String memberId) { + public PerDaySchedulesResponse getMemberDaySchedules(String eventId, String memberId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -240,16 +246,16 @@ public ScheduleDto.PerDaySchedulesResponse getMemberDaySchedules(String eventId, Collectors.toList() )); - List daySchedules = groupedSelectionsByDay.entrySet().stream() - .map(entry -> ScheduleDto.DaySchedule.of(entry.getValue())) + List daySchedules = groupedSelectionsByDay.entrySet().stream() + .map(entry -> DaySchedule.from(entry.getValue())) .collect(Collectors.toList()); - return ScheduleDto.PerDaySchedulesResponse.of(member.getName(), daySchedules); + return PerDaySchedulesResponse.of(member.getName(), daySchedules); } // 개인 요일 스케줄 반환 메서드 (로그인) @Transactional(readOnly = true) - public ScheduleDto.PerDaySchedulesResponse getUserDaySchedules(String eventId, String authorizationHeader) { + public PerDaySchedulesResponse getUserDaySchedules(String eventId, String authorizationHeader) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -263,16 +269,16 @@ public ScheduleDto.PerDaySchedulesResponse getUserDaySchedules(String eventId, S Collectors.toList() )); - List daySchedules = groupedSelectionsByDay.entrySet().stream() - .map(entry -> ScheduleDto.DaySchedule.of(entry.getValue())) + List daySchedules = groupedSelectionsByDay.entrySet().stream() + .map(entry -> DaySchedule.from(entry.getValue())) .collect(Collectors.toList()); - return ScheduleDto.PerDaySchedulesResponse.of(user.getNickname(), daySchedules); + return PerDaySchedulesResponse.of(user.getNickname(), daySchedules); } // 전체 날짜 스케줄 반환 메서드 @Transactional(readOnly = true) - public List getAllDateSchedules(String eventId) { + public List getAllDateSchedules(String eventId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -280,8 +286,8 @@ public List getAllDateSchedules(String eve List members = memberRepository.findAllWithSelectionsAndSchedulesByEvent(event); // 이벤트에 참여하는 모든 참여자 목록 - EventDto.GetParticipantsResponse getParticipantsResponse = eventService.getParticipants(eventId); - List participantNames = getParticipantsResponse.getNames(); + GetParticipantsResponse getParticipantsResponse = eventService.getParticipants(eventId); + List participantNames = getParticipantsResponse.names(); // 이벤트에 참여하는 모든 유저 List eventParticipations = eventParticipationRepository.findAllByEvent(event); @@ -290,7 +296,7 @@ public List getAllDateSchedules(String eve .filter(user -> participantNames.contains(user.getNickname())) // 유저가 참여자 목록에 있는지 확인 .toList(); - List perDateSchedulesResponses = new ArrayList<>(); + List perDateSchedulesResponses = new ArrayList<>(); // 멤버 스케줄 추가 for (Member member : members) { @@ -301,10 +307,10 @@ public List getAllDateSchedules(String eve Collectors.toList() )); - List dateSchedules = groupedSelectionsByDate.entrySet().stream() - .map(entry -> ScheduleDto.DateSchedule.of(entry.getValue())) + List dateSchedules = groupedSelectionsByDate.entrySet().stream() + .map(entry -> DateSchedule.from(entry.getValue())) .collect(Collectors.toList()); - perDateSchedulesResponses.add(ScheduleDto.PerDateSchedulesResponse.of(member.getName(), dateSchedules)); + perDateSchedulesResponses.add(PerDateSchedulesResponse.of(member.getName(), dateSchedules)); } // 유저 스케줄 추가 @@ -317,10 +323,10 @@ public List getAllDateSchedules(String eve Collectors.toList() )); - List dateSchedules = groupedSelectionsByDate.entrySet().stream() - .map(entry -> ScheduleDto.DateSchedule.of(entry.getValue())) + List dateSchedules = groupedSelectionsByDate.entrySet().stream() + .map(entry -> DateSchedule.from(entry.getValue())) .collect(Collectors.toList()); - perDateSchedulesResponses.add(ScheduleDto.PerDateSchedulesResponse.of(user.getNickname(), dateSchedules)); + perDateSchedulesResponses.add(PerDateSchedulesResponse.of(user.getNickname(), dateSchedules)); } return perDateSchedulesResponses; @@ -328,7 +334,7 @@ public List getAllDateSchedules(String eve // 개인 날짜 스케줄 반환 메서드 (비로그인) @Transactional(readOnly = true) - public ScheduleDto.PerDateSchedulesResponse getMemberDateSchedules(String eventId, String memberId) { + public PerDateSchedulesResponse getMemberDateSchedules(String eventId, String memberId) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -342,16 +348,16 @@ public ScheduleDto.PerDateSchedulesResponse getMemberDateSchedules(String eventI Collectors.toList() )); - List dateSchedules = groupedSelectionsByDate.entrySet().stream() - .map(entry -> ScheduleDto.DateSchedule.of(entry.getValue())) + List dateSchedules = groupedSelectionsByDate.entrySet().stream() + .map(entry -> DateSchedule.from(entry.getValue())) .collect(Collectors.toList()); - return ScheduleDto.PerDateSchedulesResponse.of(member.getName(), dateSchedules); + return PerDateSchedulesResponse.of(member.getName(), dateSchedules); } // 개인 날짜 스케줄 반환 메서드 (로그인) @Transactional(readOnly = true) - public ScheduleDto.PerDateSchedulesResponse getUserDateSchedules(String eventId, String authorizationHeader) { + public PerDateSchedulesResponse getUserDateSchedules(String eventId, String authorizationHeader) { Event event = eventRepository.findByEventId(UUID.fromString(eventId)) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); @@ -365,22 +371,22 @@ public ScheduleDto.PerDateSchedulesResponse getUserDateSchedules(String eventId, Collectors.toList() )); - List dateSchedules = groupedSelectionsByDate.entrySet().stream() - .map(entry -> ScheduleDto.DateSchedule.of(entry.getValue())) + List dateSchedules = groupedSelectionsByDate.entrySet().stream() + .map(entry -> DateSchedule.from(entry.getValue())) .collect(Collectors.toList()); - return ScheduleDto.PerDateSchedulesResponse.of(user.getNickname(), dateSchedules); + return PerDateSchedulesResponse.of(user.getNickname(), dateSchedules); } // 멤버 필터링 요일 스케줄 반환 메서드 @Transactional(readOnly = true) - public List getFilteredDaySchedules(ScheduleDto.GetFilteredSchedulesRequest getFilteredSchedulesRequest) { - Event event = eventRepository.findByEventId(UUID.fromString(getFilteredSchedulesRequest.getEventId())) + public List getFilteredDaySchedules(GetFilteredSchedulesRequest getFilteredSchedulesRequest) { + Event event = eventRepository.findByEventId(UUID.fromString(getFilteredSchedulesRequest.eventId())) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - List members = memberRepository.findAllWithSelectionsAndSchedulesByEventAndNames(event, getFilteredSchedulesRequest.getNames()); + List members = memberRepository.findAllWithSelectionsAndSchedulesByEventAndNames(event, getFilteredSchedulesRequest.names()); - List perDaySchedulesResponses = new ArrayList<>(); + List perDaySchedulesResponses = new ArrayList<>(); for (Member member : members) { Map> groupedSelectionsByDay = member.getSelections().stream() @@ -390,23 +396,23 @@ public List getFilteredDaySchedules(Schedul Collectors.toList() )); - List daySchedules = groupedSelectionsByDay.entrySet().stream() - .map(entry -> ScheduleDto.DaySchedule.of(entry.getValue())) + List daySchedules = groupedSelectionsByDay.entrySet().stream() + .map(entry -> DaySchedule.from(entry.getValue())) .collect(Collectors.toList()); - perDaySchedulesResponses.add(ScheduleDto.PerDaySchedulesResponse.of(member.getName(), daySchedules)); + perDaySchedulesResponses.add(PerDaySchedulesResponse.of(member.getName(), daySchedules)); } return perDaySchedulesResponses; } // 멤버 필터링 날짜 스케줄 반환 메서드 @Transactional(readOnly = true) - public List getFilteredDateSchedules(ScheduleDto.GetFilteredSchedulesRequest getFilteredSchedulesRequest) { - Event event = eventRepository.findByEventId(UUID.fromString(getFilteredSchedulesRequest.getEventId())) + public List getFilteredDateSchedules(GetFilteredSchedulesRequest getFilteredSchedulesRequest) { + Event event = eventRepository.findByEventId(UUID.fromString(getFilteredSchedulesRequest.eventId())) .orElseThrow(() -> new EventException(EventErrorResult._NOT_FOUND_EVENT)); - List members = memberRepository.findAllWithSelectionsAndSchedulesByEventAndNames(event, getFilteredSchedulesRequest.getNames()); + List members = memberRepository.findAllWithSelectionsAndSchedulesByEventAndNames(event, getFilteredSchedulesRequest.names()); - List perDateSchedulesResponses = new ArrayList<>(); + List perDateSchedulesResponses = new ArrayList<>(); for (Member member : members) { Map> groupedSelectionsByDate = member.getSelections().stream() @@ -416,10 +422,10 @@ public List getFilteredDateSchedules(Sched Collectors.toList() )); - List dateSchedules = groupedSelectionsByDate.entrySet().stream() - .map(entry -> ScheduleDto.DateSchedule.of(entry.getValue())) + List dateSchedules = groupedSelectionsByDate.entrySet().stream() + .map(entry -> DateSchedule.from(entry.getValue())) .collect(Collectors.toList()); - perDateSchedulesResponses.add(ScheduleDto.PerDateSchedulesResponse.of(member.getName(), dateSchedules)); + perDateSchedulesResponses.add(PerDateSchedulesResponse.of(member.getName(), dateSchedules)); } return perDateSchedulesResponses; } diff --git a/src/main/java/side/onetime/service/TokenService.java b/src/main/java/side/onetime/service/TokenService.java index 24ce3b4..8e58fee 100644 --- a/src/main/java/side/onetime/service/TokenService.java +++ b/src/main/java/side/onetime/service/TokenService.java @@ -5,7 +5,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import side.onetime.domain.RefreshToken; -import side.onetime.dto.TokenDto; +import side.onetime.dto.token.request.ReissueTokenRequest; +import side.onetime.dto.token.response.ReissueTokenResponse; import side.onetime.exception.TokenErrorResult; import side.onetime.exception.TokenException; import side.onetime.repository.RefreshTokenRepository; @@ -28,8 +29,8 @@ public class TokenService { private final JwtUtil jwtUtil; // 액세스 & 리프레쉬 토큰 재발행 메서드 - public TokenDto.ReissueTokenResponse reissueToken(TokenDto.ReissueTokenRequest reissueTokenRequest) { - String refreshToken = reissueTokenRequest.getRefreshToken(); + public ReissueTokenResponse reissueToken(ReissueTokenRequest reissueTokenRequest) { + String refreshToken = reissueTokenRequest.refreshToken(); Long userId = jwtUtil.getUserIdFromToken(refreshToken); List existRefreshTokens = refreshTokenRepository.findByUserId(userId) @@ -48,6 +49,6 @@ public TokenDto.ReissueTokenResponse reissueToken(TokenDto.ReissueTokenRequest r refreshTokenRepository.save(new RefreshToken(userId, newRefreshToken)); log.info("토큰 재발행에 성공하였습니다."); - return TokenDto.ReissueTokenResponse.of(newAccessToken, newRefreshToken); + return ReissueTokenResponse.of(newAccessToken, newRefreshToken); } } \ No newline at end of file diff --git a/src/main/java/side/onetime/service/UrlService.java b/src/main/java/side/onetime/service/UrlService.java index a3b5fcc..435a5ba 100644 --- a/src/main/java/side/onetime/service/UrlService.java +++ b/src/main/java/side/onetime/service/UrlService.java @@ -2,7 +2,10 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import side.onetime.dto.UrlDto; +import side.onetime.dto.url.request.ConvertToOriginalUrlRequest; +import side.onetime.dto.url.request.ConvertToShortenUrlRequest; +import side.onetime.dto.url.response.ConvertToOriginalUrlResponse; +import side.onetime.dto.url.response.ConvertToShortenUrlResponse; import side.onetime.exception.EventErrorResult; import side.onetime.exception.EventException; import side.onetime.repository.EventRepository; @@ -16,20 +19,20 @@ public class UrlService { private final EventRepository eventRepository; // URL 단축 메서드 - public UrlDto.ConvertToShortenUrlResponse convertToShortenUrl(UrlDto.ConvertToShortenUrlRequest convertToShortenUrlRequest) { - String originalUrl = convertToShortenUrlRequest.getOriginalUrl(); + public ConvertToShortenUrlResponse convertToShortenUrl(ConvertToShortenUrlRequest convertToShortenUrlRequest) { + String originalUrl = convertToShortenUrlRequest.originalUrl(); UUID eventId = extractEventIdFromUrl(originalUrl); if (!eventRepository.existsByEventId(eventId)) { throw new EventException(EventErrorResult._NOT_FOUND_EVENT); } - return UrlDto.ConvertToShortenUrlResponse.of(Base62Util.convertToShortenUrl(originalUrl)); + return ConvertToShortenUrlResponse.of(Base62Util.convertToShortenUrl(originalUrl)); } // URL 복원 메서드 - public UrlDto.ConvertToOriginalUrlResponse convertToOriginalUrl(UrlDto.ConvertToOriginalUrlRequest convertToOriginalUrlRequest) { - String shortenUrl = convertToOriginalUrlRequest.getShortenUrl(); + public ConvertToOriginalUrlResponse convertToOriginalUrl(ConvertToOriginalUrlRequest convertToOriginalUrlRequest) { + String shortenUrl = convertToOriginalUrlRequest.shortenUrl(); String originalUrl = Base62Util.convertToOriginalUrl(shortenUrl); UUID eventId = extractEventIdFromUrl(originalUrl); @@ -37,7 +40,7 @@ public UrlDto.ConvertToOriginalUrlResponse convertToOriginalUrl(UrlDto.ConvertTo throw new EventException(EventErrorResult._NOT_FOUND_EVENT); } - return UrlDto.ConvertToOriginalUrlResponse.of(originalUrl); + return ConvertToOriginalUrlResponse.of(originalUrl); } // URL에서 Event ID 추출 diff --git a/src/main/java/side/onetime/service/UserService.java b/src/main/java/side/onetime/service/UserService.java index 54129b3..747da1b 100644 --- a/src/main/java/side/onetime/service/UserService.java +++ b/src/main/java/side/onetime/service/UserService.java @@ -6,7 +6,10 @@ import org.springframework.stereotype.Service; import side.onetime.domain.RefreshToken; import side.onetime.domain.User; -import side.onetime.dto.UserDto; +import side.onetime.dto.user.request.OnboardUserRequest; +import side.onetime.dto.user.request.UpdateUserProfileRequest; +import side.onetime.dto.user.response.GetUserProfileResponse; +import side.onetime.dto.user.response.OnboardUserResponse; import side.onetime.exception.UserErrorResult; import side.onetime.exception.UserException; import side.onetime.repository.RefreshTokenRepository; @@ -31,23 +34,23 @@ public class UserService { // 유저 온보딩 메서드 @Transactional - public UserDto.OnboardUserResponse onboardUser(UserDto.OnboardUserRequest onboardUserRequest) { + public OnboardUserResponse onboardUser(OnboardUserRequest onboardUserRequest) { // 레지스터 토큰을 이용하여 사용자 정보 추출 - String registerToken = onboardUserRequest.getRegisterToken(); + String registerToken = onboardUserRequest.registerToken(); jwtUtil.validateTokenExpiration(registerToken); String provider = jwtUtil.getProviderFromToken(registerToken); String providerId = jwtUtil.getProviderIdFromToken(registerToken); String name = jwtUtil.getNameFromToken(registerToken); String email = jwtUtil.getEmailFromToken(registerToken); - if (onboardUserRequest.getNickname().length() > NICKNAME_LENGTH_LIMIT) { + if (onboardUserRequest.nickname().length() > NICKNAME_LENGTH_LIMIT) { throw new UserException(UserErrorResult._NICKNAME_TOO_LONG); } User user = User.builder() .name(name) .email(email) - .nickname(onboardUserRequest.getNickname()) + .nickname(onboardUserRequest.nickname()) .provider(provider) .providerId(providerId) .build(); @@ -63,26 +66,23 @@ public UserDto.OnboardUserResponse onboardUser(UserDto.OnboardUserRequest onboar refreshTokenRepository.save(newRefreshToken); // 액세스 토큰 반환 - return UserDto.OnboardUserResponse.of(accessToken, refreshToken); + return OnboardUserResponse.of(accessToken, refreshToken); } // 유저 정보 조회 메서드 @Transactional(readOnly = true) - public UserDto.GetUserProfileResponse getUserProfile(String authorizationHeader) { + public GetUserProfileResponse getUserProfile(String authorizationHeader) { User user = jwtUtil.getUserFromHeader(authorizationHeader); - return UserDto.GetUserProfileResponse.of(user); + return GetUserProfileResponse.of(user); } // 유저 정보 수정 메서드 @Transactional - public void updateUserProfile(String authorizationHeader, UserDto.UpdateUserProfileRequest updateUserProfileRequest) { + public void updateUserProfile(String authorizationHeader, UpdateUserProfileRequest updateUserProfileRequest) { User user = jwtUtil.getUserFromHeader(authorizationHeader); - String nickname = updateUserProfileRequest.getNickname(); + String nickname = updateUserProfileRequest.nickname(); - if (nickname == null) { - throw new UserException(UserErrorResult._NOT_FOUND_REQUEST_NICKNAME); - } if (nickname.length() > NICKNAME_LENGTH_LIMIT) { throw new UserException(UserErrorResult._NICKNAME_TOO_LONG); } diff --git a/src/main/java/side/onetime/util/DateUtil.java b/src/main/java/side/onetime/util/DateUtil.java index d2d7ab5..84b0f59 100644 --- a/src/main/java/side/onetime/util/DateUtil.java +++ b/src/main/java/side/onetime/util/DateUtil.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import side.onetime.dto.EventDto; import side.onetime.domain.enums.Category; +import side.onetime.dto.event.response.GetMostPossibleTime; import java.time.LocalDate; import java.time.LocalDateTime; @@ -78,7 +78,7 @@ public static List getSortedDayRanges(List dayStrings) { } // 최적 시간대 리스트를 날짜 또는 요일별로 정렬 - public static List sortMostPossibleTimes(List mostPossibleTimes, Category category) { + public static List sortMostPossibleTimes(List mostPossibleTimes, Category category) { DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); List sortedList; @@ -90,7 +90,7 @@ public static List sortMostPossibleTimes(List i)); sortedList = mostPossibleTimes.stream() - .map(EventDto.GetMostPossibleTime::getTimePoint) + .map(GetMostPossibleTime::timePoint) .filter(dayOrderMap::containsKey) .sorted(Comparator.comparingInt(dayOrderMap::get)) .distinct() @@ -98,7 +98,7 @@ public static List sortMostPossibleTimes(List { try { LocalDate.parse(timePoint, dateFormatter); @@ -114,8 +114,8 @@ public static List sortMostPossibleTimes(List sortedList.contains(mostPossibleTime.getTimePoint())) - .sorted(Comparator.comparingInt(mostPossibleTime -> sortedList.indexOf(mostPossibleTime.getTimePoint()))) + .filter(mostPossibleTime -> sortedList.contains(mostPossibleTime.timePoint())) + .sorted(Comparator.comparingInt(mostPossibleTime -> sortedList.indexOf(mostPossibleTime.timePoint()))) .toList(); }