From b18e829c208dfed2d9e85d813266575897364ba7 Mon Sep 17 00:00:00 2001 From: huGgW Date: Thu, 30 Jan 2025 17:01:53 +0900 Subject: [PATCH 1/2] feat: basic structure for council --- .../core/council/api/v2/CouncilController.kt | 13 +++++++++++++ .../csereal/core/council/database/CouncilEntity.kt | 10 ++++++++++ .../core/council/database/CouncilRepository.kt | 7 +++++++ .../csereal/core/council/dto/CouncilDto.kt | 10 ++++++++++ .../csereal/core/council/service/CouncilService.kt | 11 +++++++++++ 5 files changed, 51 insertions(+) create mode 100644 src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt create mode 100644 src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt create mode 100644 src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt create mode 100644 src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt create mode 100644 src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt new file mode 100644 index 00000000..d5fc8241 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt @@ -0,0 +1,13 @@ +package com.wafflestudio.csereal.core.council.api.v2 + +import com.wafflestudio.csereal.core.council.service.CouncilService +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/api/v2/council") +class CouncilController ( + private val councilService: CouncilService +) { + // ... +} diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt new file mode 100644 index 00000000..5d6bcc17 --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt @@ -0,0 +1,10 @@ +package com.wafflestudio.csereal.core.council.database + +import com.wafflestudio.csereal.common.config.BaseTimeEntity +import jakarta.persistence.Entity + +@Entity(name = "council") +class CouncilEntity ( + // ... +): BaseTimeEntity() { +} diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt new file mode 100644 index 00000000..64419f9f --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt @@ -0,0 +1,7 @@ +package com.wafflestudio.csereal.core.council.database + +import org.springframework.data.jpa.repository.JpaRepository + +interface CouncilRepository: JpaRepository { + // ... +} diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt new file mode 100644 index 00000000..31fc344a --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt @@ -0,0 +1,10 @@ +package com.wafflestudio.csereal.core.council.dto + +import java.time.LocalDateTime + +data class CouncilDto( + val id: Long, + val createdAt: LocalDateTime?, + val modifiedAt: LocalDateTime?, + // ... +) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt new file mode 100644 index 00000000..ab91171b --- /dev/null +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt @@ -0,0 +1,11 @@ +package com.wafflestudio.csereal.core.council.service + +import com.wafflestudio.csereal.core.council.database.CouncilRepository +import org.springframework.stereotype.Service + +@Service +class CouncilService ( + private val councilRepository: CouncilRepository +) { + // ... +} From de7d666505da8000fad67a69a1804495ed379ee0 Mon Sep 17 00:00:00 2001 From: huGgW Date: Thu, 30 Jan 2025 17:17:08 +0900 Subject: [PATCH 2/2] refactor: ktlint --- .../csereal/core/council/api/v2/CouncilController.kt | 2 +- .../csereal/core/council/database/CouncilEntity.kt | 5 +++-- .../csereal/core/council/database/CouncilRepository.kt | 2 +- .../com/wafflestudio/csereal/core/council/dto/CouncilDto.kt | 2 +- .../csereal/core/council/service/CouncilService.kt | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt index d5fc8241..9eb4de29 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/api/v2/CouncilController.kt @@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("/api/v2/council") -class CouncilController ( +class CouncilController( private val councilService: CouncilService ) { // ... diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt index 5d6bcc17..0cfc692e 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilEntity.kt @@ -4,7 +4,8 @@ import com.wafflestudio.csereal.common.config.BaseTimeEntity import jakarta.persistence.Entity @Entity(name = "council") -class CouncilEntity ( +class CouncilEntity( + // ... +) : BaseTimeEntity() { // ... -): BaseTimeEntity() { } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt index 64419f9f..d4d6faa8 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/database/CouncilRepository.kt @@ -2,6 +2,6 @@ package com.wafflestudio.csereal.core.council.database import org.springframework.data.jpa.repository.JpaRepository -interface CouncilRepository: JpaRepository { +interface CouncilRepository : JpaRepository { // ... } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt index 31fc344a..fcc24d09 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/dto/CouncilDto.kt @@ -5,6 +5,6 @@ import java.time.LocalDateTime data class CouncilDto( val id: Long, val createdAt: LocalDateTime?, - val modifiedAt: LocalDateTime?, + val modifiedAt: LocalDateTime? // ... ) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt index ab91171b..07aeb596 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/council/service/CouncilService.kt @@ -4,7 +4,7 @@ import com.wafflestudio.csereal.core.council.database.CouncilRepository import org.springframework.stereotype.Service @Service -class CouncilService ( +class CouncilService( private val councilRepository: CouncilRepository ) { // ...