-
Notifications
You must be signed in to change notification settings - Fork 1
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 #14 from JNU-econovation/feat/2/schedule-domain
schedule domain
- Loading branch information
Showing
11 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
BE/error/src/main/java/com/example/demo/schedule/application/dto/CreateScheduleRequest.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.example.demo.schedule.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class CreateScheduleRequest { | ||
|
||
private String eventName; | ||
private LocalDateTime eventStartDate; | ||
private LocalDateTime eventEndDate; | ||
private String eventInfo; | ||
private String eventPlace; | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
BE/error/src/main/java/com/example/demo/schedule/application/dto/CreateScheduleResponse.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,12 @@ | ||
package com.example.demo.schedule.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class CreateScheduleResponse { private Long eventId;} |
19 changes: 19 additions & 0 deletions
19
BE/error/src/main/java/com/example/demo/schedule/application/dto/MonthCalendarResponse.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,19 @@ | ||
package com.example.demo.schedule.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class MonthCalendarResponse { | ||
private Long eventId; | ||
private String eventName; | ||
private LocalDateTime eventStartDate; | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...ror/src/main/java/com/example/demo/schedule/application/dto/SpecificScheduleResopnse.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,20 @@ | ||
package com.example.demo.schedule.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class SpecificScheduleResopnse { | ||
private Long eventId; | ||
private String eventName; | ||
private String eventInfo; | ||
private LocalDateTime eventStartDate; | ||
private LocalDateTime eventEndDate; | ||
} |
25 changes: 25 additions & 0 deletions
25
BE/error/src/main/java/com/example/demo/schedule/application/dto/UpdateScheduleRequest.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,25 @@ | ||
package com.example.demo.schedule.application.dto; | ||
|
||
|
||
import com.example.demo.schedule.persistence.ScheduleType; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class UpdateScheduleRequest { | ||
private Long eventId; | ||
private String eventName; | ||
private LocalDateTime eventStartDate; | ||
private LocalDateTime eventEndDate; | ||
private String eventInfo; | ||
private String eventPlace; | ||
private ScheduleType eventType; | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
...rror/src/main/java/com/example/demo/schedule/application/dto/WeekDayCalendarResponse.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,19 @@ | ||
package com.example.demo.schedule.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class WeekDayCalendarResponse { | ||
private Long eventId; | ||
private String eventName; | ||
private LocalDateTime eventStartDate; | ||
private LocalDateTime eventEndDate; | ||
} |
17 changes: 17 additions & 0 deletions
17
BE/error/src/main/java/com/example/demo/schedule/application/dto/YearCalendarResponse.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,17 @@ | ||
package com.example.demo.schedule.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class YearCalendarResponse { | ||
private Long eventId; | ||
private LocalDateTime eventStartDate; | ||
} |
46 changes: 46 additions & 0 deletions
46
BE/error/src/main/java/com/example/demo/schedule/persistence/ScheduleEntity.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,46 @@ | ||
package com.example.demo.schedule.persistence; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
//@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@ToString | ||
@Entity | ||
public class ScheduleEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long eventId; | ||
|
||
@Column(nullable = false) | ||
private String eventName; | ||
|
||
@Column(nullable = false) | ||
private LocalDateTime eventStartDate; | ||
private LocalDateTime eventEndDate; | ||
|
||
@Column(nullable = false) | ||
private String eventInfo; | ||
|
||
@Column(nullable = false) | ||
private String eventPlace; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private ScheduleType scheduleTypeType; | ||
|
||
@Builder | ||
public ScheduleEntity(Long eventId, String eventName, LocalDateTime eventStartDate, LocalDateTime eventEndDate, String eventInfo, String eventPlace, ScheduleType eventType) { | ||
//this.eventId = eventId; | ||
this.eventName = eventName; | ||
this.eventStartDate = eventStartDate; | ||
this.eventEndDate = eventEndDate; | ||
this.eventInfo = eventInfo; | ||
this.eventPlace = eventPlace; | ||
this.scheduleTypeType = eventType; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
BE/error/src/main/java/com/example/demo/schedule/persistence/ScheduleRepository.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,6 @@ | ||
package com.example.demo.schedule.persistence; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ScheduleRepository extends JpaRepository<ScheduleEntity, Long> { | ||
} |
6 changes: 6 additions & 0 deletions
6
BE/error/src/main/java/com/example/demo/schedule/persistence/ScheduleType.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,6 @@ | ||
package com.example.demo.schedule.persistence; | ||
|
||
public enum ScheduleType { | ||
PUBLIC, | ||
PRIVATE | ||
} |
56 changes: 56 additions & 0 deletions
56
BE/error/src/main/java/com/example/demo/schedule/presentation/ScheduleController.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,56 @@ | ||
package com.example.demo.schedule.presentation; | ||
|
||
import com.example.demo.common.presentation.response.ApiResponse; | ||
import com.example.demo.common.presentation.response.ApiResponseBody.SuccessBody; | ||
import com.example.demo.common.presentation.response.ApiResponseGenerator; | ||
import com.example.demo.common.presentation.response.MessageCode; | ||
import com.example.demo.schedule.application.dto.CreateScheduleRequest; | ||
import com.example.demo.schedule.application.dto.UpdateScheduleRequest; | ||
import com.example.demo.schedule.application.dto.YearCalendarResponse; | ||
import com.sun.net.httpserver.Authenticator; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api") | ||
public class ScheduleController { | ||
|
||
@PostMapping("/calendar") | ||
public ApiResponse<SuccessBody<Void>> create( | ||
@RequestBody CreateScheduleRequest createScheduleRequest) { | ||
// 일정 생성하는 service logic | ||
return ApiResponseGenerator.success(HttpStatus.OK, MessageCode.CREATE); | ||
} | ||
|
||
@GetMapping("/calendar/{eventId}") | ||
public ApiResponse<SuccessBody<YearCalendarResponse>> getSpecificCalendar ( | ||
@PathVariable("eventId") Long eventId) { | ||
// specific response 담아서 리턴 logic | ||
return ApiResponseGenerator.success(response, HttpStatus.OK, MessageCode.GET); | ||
} | ||
|
||
@GetMapping("/calendar") | ||
public ApiResponse<SuccessBody<YearCalendarResponse>> getTypeCalendar ( | ||
@RequestParam("period") String type) { | ||
// type 별 response 담아서 리턴 logic | ||
return ApiResponseGenerator.success(response, HttpStatus.OK, MessageCode.GET); | ||
} | ||
|
||
@PutMapping("/calendar/{eventId}") | ||
public ApiResponse<SuccessBody<Void>> update( | ||
@RequestBody UpdateScheduleRequest updateScheduleRequest, | ||
@PathVariable("eventId") Long eventId) { | ||
// 수정하는 logic | ||
return ApiResponseGenerator.success(HttpStatus.OK, MessageCode.UPDATE); | ||
} | ||
|
||
@DeleteMapping("/calendar/{eventId}") | ||
public ApiResponse<SuccessBody<Void>> delete( | ||
@PathVariable("eventId") Long eventId) { | ||
// 일정 삭제하는 logic | ||
return return ApiResponseGenerator.success(HttpStatus.OK, MessageCode.DELETE); | ||
} | ||
|
||
} |