-
Notifications
You must be signed in to change notification settings - Fork 0
Darayo Backend Convention
Jiwoong Song edited this page Jun 29, 2025
·
1 revision
festival/
├── domain/ # 도메인 로직 전반 (엔티티, 서비스), 영속성 로직
│ ├── constant/ # enum class들
│ ├── entity/ # JPA Entity 등 비즈니스 모델
│ ├── repository/ # JPA Repository 또는 QueryDSL 등 데이터 저장/조회 구현체
│ └── service/ # 도메인 서비스 (Controller가 직접 의존, UseCase 역할을 대신 함)
│
├── infra/ # 기술 세부 사항
│ └── fcm/ # fcm
│ └── ext-library/ # 기타 외부 종속성
│
└── presentation/ # 외부 요청을 받는 계층 (REST API ONLY)
├── artist/
│ ├── ArtistController.java
│ └── exchanges/ # 요청/응답 DTO
└── performance/
├── PerformanceController.java
└── exchanges/
- Record 타입 활용
- 요청 타입은 Req, 응답 타입은 Res
- Inner Record로 필요한 하위 응답 타입 정의
요청 예시)
public record EditReservationInfoReq(
// ....
) { }
응답 예시)
public record UserGetTimetableRes(
// ...
List<UserTimetableArtistRes> artists
) {
public record UserTimetableArtistRes(
//...
) { }
}
파라미터가 여러개 있는 경우
@RestController
@RequestMapping("/api/admin/timetable")
@RequiredArgsConstructor
public class TimetableAdminController {
private final TimetableManagement timetableManagement;
@PutMapping("/{timetableId}")
public ResponseEntity<Void> editTimetable(
@PathVariable("timetableId") Long timetableId,
@RequestBody EditTimetableReq req
) {
/** 구현부 **/
return ResponseEntity.ok().build();
}
}
파라미터가 하나만 있는 경우
@GetMapping("/{festivalId}/timetable")
public ResponseEntity<BaseResponse<List<UserGetTimetableRes>>> getPerformancesForFestival(
@PathVariable Long festivalId
) {
List<UserGetTimetableRes> data = timetableManagement.getUserGetTimetables(festivalId);
return ResponseEntity.ok(BaseResponse.success(data));
}