-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Kusitms-29th-Meetup-TeamE/feat/34/mypage-…
…schedule Feat: 마이페이지 일정 목록 api 구현
- Loading branch information
Showing
10 changed files
with
202 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/meetup/teame/backend/domain/user/dto/request/ReadCalenderReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.meetup.teame.backend.domain.user.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.Min; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Getter | ||
public class ReadCalenderReq { | ||
@NotBlank(message="year is required.") | ||
@Schema(example = "2024") | ||
private Integer year; | ||
|
||
@NotBlank(message="month is required.") | ||
@Schema(example = "5") | ||
private Integer month; | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/meetup/teame/backend/domain/user/dto/response/AppointmentRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.meetup.teame.backend.domain.user.dto.response; | ||
|
||
import com.meetup.teame.backend.domain.activity.entity.Activity; | ||
import com.meetup.teame.backend.domain.chatroom.entity.Appointment; | ||
import com.meetup.teame.backend.domain.chatroom.entity.DirectChatRoom; | ||
import com.meetup.teame.backend.domain.chatroom.entity.GroupChatRoom; | ||
import lombok.*; | ||
|
||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Locale; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Builder | ||
public class AppointmentRes { | ||
private LocalDate date; | ||
private String tag; | ||
private String description; | ||
private String about; | ||
|
||
public static AppointmentRes ofActivity(GroupChatRoom groupChatRoom) { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("a h시 m분", new Locale("ko", "KR")); | ||
String startTime = groupChatRoom.getActivity().getTime().format(formatter); | ||
String endTIme = groupChatRoom.getActivity().getTime().plusMinutes(groupChatRoom.getActivity().getDuration()).format(formatter); | ||
return AppointmentRes.builder() | ||
.date(groupChatRoom.getActivity().getTime().toLocalDate()) | ||
.tag(groupChatRoom.getActivity().getTitle()) | ||
.description(groupChatRoom.getActivity().getTitle() + " 활동 참여하기") | ||
.about(groupChatRoom.getActivity().getLocation() + ", " + startTime + " ~ " + endTIme) | ||
.build(); | ||
} | ||
|
||
public static AppointmentRes ofDirectChatRoom(DirectChatRoom directChatRoom) { | ||
return AppointmentRes.builder() | ||
.date(directChatRoom.getNextAppointment().getAppointmentDate()) | ||
.tag(directChatRoom.getExperience().getDescription()) | ||
.description(directChatRoom.getExperience().getDescription() + " 배움 나누기") | ||
.about(directChatRoom.getNextAppointment().getAppointmentLocation()) | ||
.build(); | ||
} | ||
|
||
public static AppointmentRes ofGroupChatRoom(GroupChatRoom groupChatRoom) { | ||
return AppointmentRes.builder() | ||
.date(groupChatRoom.getNextAppointment().getAppointmentDate()) | ||
.tag(groupChatRoom.getActivity().getTitle()) | ||
.description(groupChatRoom.getActivity().getTitle() + " 약속") | ||
.about(groupChatRoom.getNextAppointment().getAppointmentLocation()) | ||
.build(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/meetup/teame/backend/domain/user/dto/response/ReadCalenderRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.meetup.teame.backend.domain.user.dto.response; | ||
|
||
import com.meetup.teame.backend.domain.chatroom.entity.Appointment; | ||
import com.meetup.teame.backend.domain.chatroom.entity.DirectChatRoom; | ||
import com.meetup.teame.backend.domain.chatroom.entity.GroupChatRoom; | ||
import lombok.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Builder | ||
public class ReadCalenderRes { | ||
List<AppointmentRes> appointments; | ||
|
||
public static ReadCalenderRes of(List<GroupChatRoom> groupChatRoomsByActivity, List<DirectChatRoom> directChatRooms, List<GroupChatRoom> groupChatRooms) { | ||
List<AppointmentRes> appointments = new ArrayList<>(); | ||
appointments.addAll(groupChatRoomsByActivity.stream() | ||
.map(AppointmentRes::ofActivity) | ||
.toList()); | ||
appointments.addAll(directChatRooms.stream() | ||
.map(AppointmentRes::ofDirectChatRoom) | ||
.toList()); | ||
appointments.addAll(groupChatRooms.stream() | ||
.map(AppointmentRes::ofGroupChatRoom) | ||
.toList()); | ||
appointments.sort((a, b) -> a.getDate().compareTo(b.getDate())); | ||
|
||
return ReadCalenderRes.builder() | ||
.appointments(appointments) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters