Event 도메인 구현
2024. 8. 20. 10:00ㆍSpring기반 REST API개발
Event 클래스
package com.example.inflearnrestapi.events;
import java.time.LocalDateTime;
public class Event {
private String name;
private String description;
private LocalDateTime beginEnrollmentDateTime;
private LocalDateTime closeEnrollmentDateTime;
private LocalDateTime beginEventDateTime;
private LocalDateTime endEventDateTime;
private String location; // (optional) 이게 없으면 온라인 모임
private int basePrice; // (optional)
private int maxPrice; // (optional)
private int limitOfEnrollment;
private boolean offline;
private boolean free;
private EventStatus eventStatus;
}
EventStatus Enum 클래스
package com.example.inflearnrestapi.events;
public enum EventStatus {
DRAFT, PUBLISHED, BEGAN_ENROLLMENT;
}

- 엔티티 클래스에는 @Data를 사용하면 EqualsAndHashCode 에서 StackOverflow가 발생할 수 있어 사용하는걸 권장하지 않음.
- @Builder 어노테이션을 사용할 경우, 기본 생성자를 생성해 주는 @NoArgsConstructor 어노테이션을 사용하고 있습니다.
'Spring기반 REST API개발' 카테고리의 다른 글
| REST API - 201 응답 받기 (0) | 2024.08.21 |
|---|---|
| REST API - 테스트 만들기 (0) | 2024.08.21 |
| Event 생성 API 구현 - 비즈니스 로직 (0) | 2024.08.20 |
| Event REST API (0) | 2024.08.20 |
| REST API (0) | 2024.08.20 |