diff --git a/src/main/kotlin/com/example/attendanceapimono/adapter/present/EventController.kt b/src/main/kotlin/com/example/attendanceapimono/adapter/present/EventController.kt new file mode 100644 index 0000000..5447b35 --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/adapter/present/EventController.kt @@ -0,0 +1,8 @@ +package com.example.attendanceapimono.adapter.present + +import com.example.attendanceapimono.adapter.present.api.EventAPI +import org.springframework.web.bind.annotation.RestController + +@RestController +class EventController: EventAPI { +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/EventAPI.kt b/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/EventAPI.kt new file mode 100644 index 0000000..e6ec6a2 --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/EventAPI.kt @@ -0,0 +1,7 @@ +package com.example.attendanceapimono.adapter.present.api + +import io.swagger.v3.oas.annotations.tags.Tag + +@Tag(name = "Event 관련 API") +interface EventAPI { +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/JWTTokenV1.kt b/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/JWTTokenV1.kt new file mode 100644 index 0000000..25c5f17 --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/JWTTokenV1.kt @@ -0,0 +1,6 @@ +package com.example.attendanceapimono.adapter.present.api + +import io.swagger.v3.oas.annotations.security.SecurityRequirement + +@SecurityRequirement(name = "signedTokenV1") +annotation class JWTTokenV1 diff --git a/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/UserAPI.kt b/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/UserAPI.kt index 18971fd..694e21b 100644 --- a/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/UserAPI.kt +++ b/src/main/kotlin/com/example/attendanceapimono/adapter/present/api/UserAPI.kt @@ -74,10 +74,11 @@ interface UserAPI { description = "토큰 체크 및 재생성 하는 기능", content = [Content( mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = Schema(implementation = TokenResponse::class), - examples = [ExampleObject(TokenResponse.Example)] + schema = Schema(implementation = ReSignResponse::class), + examples = [ExampleObject(ReSignResponse.Example)] )], ) + @JWTTokenV1 @ResponseStatus(HttpStatus.OK) @GetMapping("/token") suspend fun reSign(@LoginUserID userID: UUID): ResponseEntity> diff --git a/src/main/kotlin/com/example/attendanceapimono/application/AttendanceService.kt b/src/main/kotlin/com/example/attendanceapimono/application/AttendanceService.kt new file mode 100644 index 0000000..50950c8 --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/application/AttendanceService.kt @@ -0,0 +1,13 @@ +package com.example.attendanceapimono.application + +import com.example.attendanceapimono.domain.attendance.AttendanceRepository +import com.example.attendanceapimono.domain.event.EventRepository +import org.springframework.stereotype.Service + +@Service +class AttendanceService( + private val eventRepository: EventRepository, + private val attendanceRepository: AttendanceRepository, +) { + +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/application/EventService.kt b/src/main/kotlin/com/example/attendanceapimono/application/EventService.kt new file mode 100644 index 0000000..b9235ae --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/application/EventService.kt @@ -0,0 +1,10 @@ +package com.example.attendanceapimono.application + +import org.springframework.stereotype.Service + +@Service +class EventService { + fun createEvent() { + + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/application/dto/event/CreateEventRequest.kt b/src/main/kotlin/com/example/attendanceapimono/application/dto/event/CreateEventRequest.kt new file mode 100644 index 0000000..6e4f2ba --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/application/dto/event/CreateEventRequest.kt @@ -0,0 +1,47 @@ +package com.example.attendanceapimono.application.dto.event + +import io.swagger.v3.oas.annotations.media.Schema +import org.hibernate.validator.constraints.Length +import org.springframework.format.annotation.DateTimeFormat +import java.time.LocalDateTime + +@Schema( + title = "이벤트 등록 요청", + description = "새로운 이벤트를 등록할 때 필요한 Body에 대한 DTO입니다.", + example = CreateEventRequest.Example +) +class CreateEventRequest( + @Schema(description = "DDD 기수 입니다.") + val generationID: Int, + + @Schema(description = "이벤트 명") + @field:Length(min = 5, max = 255) + val title: String, + + @Schema(description = "이벤트 설명") + @field:Length(max = 500) + val description: String, + + @Schema(description = "예상 시작 일") + @field:DateTimeFormat + val expectedAt: String, + + @Schema(description = "지각 기준 시간 (분)") + val lateDiffMinute: Int, + + @Schema(description = "결석 기준 시간 (분)") + val absentDiffMinute: Int +) { + companion object { + const val Example = """ + { + "generationID": 6, + "title": "오리엔테이션", + "description": "함께 모여 앞으로의 방향에 대해 이야기 나눠 보아요.", + "expectedAt": "2021-08-21T14:00:00.000", + "lateDiffMinute": 10, + "absentDiffMinute": 60 + } + """ + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/application/dto/event/CreateEventResponse.kt b/src/main/kotlin/com/example/attendanceapimono/application/dto/event/CreateEventResponse.kt new file mode 100644 index 0000000..e97f2ef --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/application/dto/event/CreateEventResponse.kt @@ -0,0 +1,32 @@ +package com.example.attendanceapimono.application.dto.event + +import com.example.attendanceapimono.domain.event.Event +import io.swagger.v3.oas.annotations.media.Schema + +@Schema( + title = "이벤트 등록 후 반환", + description = "이벤트를 등록한 후, 반환해주는 Response에 대한 DTO 입니다.", + example = CreateEventResponse.Example, +) +data class CreateEventResponse ( + @Schema(description = "생성된 event") + val event: Event, +) { + companion object { + const val Example = """ + { + "id": "123e4567-e89b-12d3-a456-426614174000", + "generationID": 6, + "title": "오리엔테이션", + "description": "함께 모여 앞으로의 방향에 대해 이야기 나눠 보아요.", + "isDone": false, + "expectedAt": "2021-08-21T14:00:00.000", + "lateDiffMinute": 10, + "absentDiffMinute": 60, + "startAt": null, + "createdAt": "2021-08-12T22:13:47.245", + "updatedAt": "2021-08-12T22:13:47.245" + } + """ + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/domain/attendance/AttendanceRepository.kt b/src/main/kotlin/com/example/attendanceapimono/domain/attendance/AttendanceRepository.kt new file mode 100644 index 0000000..7c08d5a --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/domain/attendance/AttendanceRepository.kt @@ -0,0 +1,8 @@ +package com.example.attendanceapimono.domain.attendance + +import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.stereotype.Repository +import java.util.* + +@Repository +interface AttendanceRepository : JpaRepository \ No newline at end of file diff --git a/src/main/kotlin/com/example/attendanceapimono/domain/event/Event.kt b/src/main/kotlin/com/example/attendanceapimono/domain/event/Event.kt index a0cbd93..ffb1f07 100644 --- a/src/main/kotlin/com/example/attendanceapimono/domain/event/Event.kt +++ b/src/main/kotlin/com/example/attendanceapimono/domain/event/Event.kt @@ -21,10 +21,10 @@ class Event( var title: String, @Column(length = 500, nullable = false) - var description: String, + var description: String = "", @Column(nullable = false) - var isDone: Boolean, + var isDone: Boolean = false, @Column(nullable = false) val expectedAt: LocalDateTime, @@ -36,7 +36,7 @@ class Event( var absentDiffMinutes: Int, @Column(nullable = false) - val startAt: LocalDateTime, + var startAt: LocalDateTime, @Column(nullable = false) val createdAt: LocalDateTime, diff --git a/src/main/kotlin/com/example/attendanceapimono/domain/event/EventRepository.kt b/src/main/kotlin/com/example/attendanceapimono/domain/event/EventRepository.kt new file mode 100644 index 0000000..487e32a --- /dev/null +++ b/src/main/kotlin/com/example/attendanceapimono/domain/event/EventRepository.kt @@ -0,0 +1,8 @@ +package com.example.attendanceapimono.domain.event + +import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.stereotype.Repository +import java.util.* + +@Repository +interface EventRepository : JpaRepository \ No newline at end of file