Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 0 additions & 120 deletions src/main/java/com/retrip/trip/application/in/TripService.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.retrip.trip.application.in.request;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.UUID;

@Schema(description = "여행 최대 참여자 수정 Request")
public record MaxParticipantUpdateRequest(
@Schema(description = "여행 최대 참여자") int maxParticipants,
@Schema(description = "참여자 수정 ID") UUID memberId) {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,63 +14,37 @@

@Schema(description = "여행 생성 Request")
public record TripCreateRequest(
@Schema(description = "여행 멤버 ID", example = "550e8400-e29b-41d4-a716-446655440000") @NotNull
UUID memberId,
@Schema(description = "여행 위치 ID", example = "550e8400-e29b-41d4-a716-446655440001") @NotNull
UUID locationId,
@Schema(description = "여행 제목", example = "유럽 배낭여행") @NotNull String title,
@Schema(description = "여행 설명", example = "파리, 런던, 로마를 여행하는 일정입니다.") String description,
@Schema(description = "여행 시작 날짜", example = "2025-06-15") @FutureOrPresent LocalDate start,
@Schema(description = "여행 종료 날짜", example = "2025-06-25") @FutureOrPresent LocalDate end,
@Schema(description = "여행 공개 여부") boolean open,
@Schema(description = "여행 최대 참가 인원") int maxParticipants,
@Schema(description = "여행 카테고리") TripCategory category) {

@Schema(description = "여행 멤버 ID", example = "550e8400-e29b-41d4-a716-446655440000")
@NotNull
UUID memberId,

@Schema(description = "여행 위치 ID", example = "550e8400-e29b-41d4-a716-446655440001")
@NotNull
UUID locationId,

@Schema(description = "여행 제목", example = "유럽 배낭여행")
@NotNull
String title,

@Schema(description = "여행 설명", example = "파리, 런던, 로마를 여행하는 일정입니다.")
String description,

@Schema(description = "여행 시작 날짜", example = "2025-06-15")
@FutureOrPresent
LocalDate start,

@Schema(description = "여행 종료 날짜", example = "2025-06-25")
@FutureOrPresent
LocalDate end,

@Schema(description = "여행 공개 여부")
boolean open,

@Schema(description = "여행 최대 참가 인원")
int maxParticipants,

@Schema(description = "여행 카테고리")
TripCategory category

) {
public Trip to() {
return Trip.create(
memberId,
locationId,
new TripTitle(title),
new TripDescription(description),
new TripPeriod(start, end),
open,
maxParticipants,
category
);
category);
}

public Trip toWithItineraries() {
return Trip.createWithItineraries(
memberId,
locationId,
new TripTitle(title),
new TripDescription(description),
new TripPeriod(start, end),
open,
maxParticipants,
category
);
category);
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package com.retrip.trip.application.in.response;

import com.retrip.trip.domain.entity.Trip;
import com.retrip.trip.domain.entity.participant.Participant;
import com.retrip.trip.domain.vo.ParticipantRole;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.UUID;

@Schema(description = "여행 리더 위임 Response")
public record DelegateLeaderResponse(
@Schema(description = "여행 ID")
UUID tripId,

@Schema(description = "새로운 리더 멤버 ID")
UUID newLeaderId
) {
public static DelegateLeaderResponse of(Trip trip, UUID newLeaderId) {
return new DelegateLeaderResponse(trip.getId(), newLeaderId);
@Schema(description = "새로운 리더 ID") UUID id,
@Schema(description = "여행 ID") UUID tripId,
@Schema(description = "새로운 리더 멤버 ID") UUID memberId,
@Schema(description = "새로운 리더 멤버 Role") String role) {
public static DelegateLeaderResponse of(Trip trip, Participant leader) {
return new DelegateLeaderResponse(
leader.getId(), trip.getId(), leader.getMemberId(), leader.getRole().getViewName());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.retrip.trip.application.in.response;

import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDate;
import java.util.UUID;

@Schema(description = "여행 최대 참여자 수정 Response")
public record MaxParticipantUpdateResponse(
@Schema(description = "여행 Id") UUID tripId,
@Schema(description = "여행 최대 참여자") int maxParticipants) {

public static MaxParticipantUpdateResponse of(UUID id, int maxParticipants) {
return new MaxParticipantUpdateResponse(id, maxParticipants);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.retrip.trip.application.in.response;

import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDate;
import java.util.UUID;

@Schema(description = "여행 목록 Response")
public record MyTripResponse(
@Schema(description = "여행 ID") UUID id,
@Schema(description = "여행 제목") String title,
@Schema(description = "목적지 ID") UUID destinationId,
@Schema(description = "여행 시작 날짜") LocalDate start,
@Schema(description = "여행 종료 날짜") LocalDate end,
@Schema(description = "여행 최대 참여자") int maxParticipants,
@Schema(description = "여행 공개 여부") boolean open) {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.retrip.trip.application.in.response;

import com.retrip.trip.domain.entity.Trip;
import com.retrip.trip.domain.entity.participant.Participant;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDate;
Expand All @@ -10,37 +11,33 @@

@Schema(description = "여행 생성 Response")
public record TripCreateResponse(
@Schema(description = "여행 ID", example = "550e8400-e29b-41d4-a716-446655440000")
UUID id,

@Schema(description = "여행 ID", example = "550e8400-e29b-41d4-a716-446655440000") UUID id,
@Schema(description = "여행 목적지 ID", example = "550e8400-e29b-41d4-a716-446655440001")
UUID destinationId,

@Schema(description = "여행 제목", example = "파리 여행")
String title,

@Schema(description = "여행 설명")
String description,

@Schema(description = "여행 시작 날짜")
LocalDate start,

@Schema(description = "여행 종료 날짜")
LocalDate end,

@Schema(description = "여행 공개 여부")
boolean open,

@Schema(description = "여행 최대 참가 인원")
int maxParticipants,

@Schema(description = "여행 카테고리")
String category,
UUID destinationId,
@Schema(description = "여행 제목", example = "파리 여행") String title,
@Schema(description = "여행 설명") String description,
@Schema(description = "여행 시작 날짜") LocalDate start,
@Schema(description = "여행 종료 날짜") LocalDate end,
@Schema(description = "여행 공개 여부") boolean open,
@Schema(description = "여행 최대 참가 인원") int maxParticipants,
@Schema(description = "여행 참가 인원") List<ParticipantResponse> participants,
@Schema(description = "여행 카테고리") String category,
@Schema(description = "여행 일정 리스트") List<ItineraryCreateResponse> itineraries) {
private record ParticipantResponse(
@Schema(description = "참여자 ID") UUID id,
@Schema(description = "참여자 User ID") UUID memberId,
@Schema(description = "참여자 ROLE") String role,
@Schema(description = "참여자 STATUS") String status) {
private static ParticipantResponse of(Participant participant) {
return new ParticipantResponse(
participant.getId(),
participant.getMemberId(),
participant.getRole().getViewName(),
participant.getStatus().name());
}
}

@Schema(description = "여행 일정 리스트")
List<ItineraryCreateResponse> itineraries
) {
public static TripCreateResponse of(Trip trip) {
public static TripCreateResponse of(Trip trip, Participant participant) {
return new TripCreateResponse(
trip.getId(),
trip.getDestinationId(),
Expand All @@ -49,25 +46,22 @@ public static TripCreateResponse of(Trip trip) {
trip.getPeriod().getStart(),
trip.getPeriod().getEnd(),
trip.isOpen(),
trip.getTripParticipants().getMaxParticipants(),
trip.getMaxParticipants(),
List.of(ParticipantResponse.of(participant)),
trip.getCategory().getViewName(),
trip.getItineraries() == null ? new ArrayList<>() :
trip.getItineraries().getValues().stream()
.map(i -> new ItineraryCreateResponse(i.getId(), i.getName(), i.getDate()))
.toList()
);
trip.getItineraries() == null
? new ArrayList<>()
: trip.getItineraries().getValues().stream()
.map(
i ->
new ItineraryCreateResponse(
i.getId(), i.getName(), i.getDate()))
.toList());
}

@Schema(description = "여행 일정 Response")
private record ItineraryCreateResponse(
@Schema(description = "일정 ID")
UUID id,

@Schema(description = "일정 이름")
String name,

@Schema(description = "일정 날짜")
LocalDate date
) {
}
@Schema(description = "일정 ID") UUID id,
@Schema(description = "일정 이름") String name,
@Schema(description = "일정 날짜") LocalDate date) {}
}
Loading