✨ notice 저장
This commit is contained in:
@@ -35,7 +35,7 @@ Kotlin + Spring Boot 2 + Spring MVC + Spring Data JPA
|
||||
|
||||
### 1.1. 프로젝트 구성
|
||||
|
||||
프로젝트는 멀티 모듈로 구성되어있습니다.
|
||||
demo-app 프로젝트는 멀티 모듈로 구성되어있습니다.
|
||||
|
||||
<img width="344" alt="architecture-1" src="https://user-images.githubusercontent.com/31076826/204638756-a9a8b9b8-d0e5-4a27-bf14-4c8f12e93448.png">
|
||||
|
||||
@@ -72,4 +72,6 @@ demo-app은 아래와 같이 `:util:common-util`, `:core:demo-core`, `:infrastru
|
||||
|
||||
demo-app을 하나의 모듈로 만든 웹 애플리케이션
|
||||
|
||||
adapter + core + domain 을 하나의 프로젝트 내에 구성했습니다.
|
||||
adapter + core + domain 을 하나의 프로젝트 내에 구성했습니다.
|
||||
|
||||
<img width="382" alt="스크린샷 2022-12-02 오후 2 08 10" src="https://user-images.githubusercontent.com/31076826/205219195-fd9fef03-5a0d-4673-8020-8c7f353c7a05.png">
|
||||
@@ -1,4 +1,30 @@
|
||||
package me.jiniworld.demohx.notice.adapter.input.web
|
||||
|
||||
internal class RegisterNoticeController {
|
||||
}
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import io.swagger.v3.oas.annotations.tags.Tag
|
||||
import me.jiniworld.demohx.annotation.WebAdapter
|
||||
import me.jiniworld.demohx.model.BaseResponse
|
||||
import me.jiniworld.demohx.notice.application.port.input.RegisterNoticeCommand
|
||||
import me.jiniworld.demohx.notice.application.port.input.RegisterNoticeUseCase
|
||||
import org.springframework.web.bind.annotation.PostMapping
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@WebAdapter
|
||||
@Tag(name = "setting-system", description = "설정-시스템(공지사항, FAQ, 이용약관, 메타정보 등)")
|
||||
@RestController
|
||||
@RequestMapping("/v1/notices")
|
||||
internal class RegisterNoticeController(
|
||||
private val registerNoticeUseCase: RegisterNoticeUseCase,
|
||||
) {
|
||||
|
||||
@Operation(summary = "공지사항 상세조회")
|
||||
@PostMapping("")
|
||||
fun registerNotice(@RequestBody command: RegisterNoticeCommand): BaseResponse {
|
||||
registerNoticeUseCase.registerNotice(command)
|
||||
return BaseResponse.SUCCESS
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,13 @@ internal class NoticeEntity {
|
||||
@LastModifiedDate
|
||||
var updatedAt: LocalDateTime? = null
|
||||
|
||||
constructor() {}
|
||||
|
||||
constructor(title: String, content: String) {
|
||||
this.title = title
|
||||
this.content = content
|
||||
}
|
||||
|
||||
fun mapToNotice() =
|
||||
Notice(id = id, noticeContent = NoticeContent(title = title, content = content), createdAt = createdAt)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ internal class NoticePersistenceAdapter(
|
||||
}
|
||||
|
||||
override fun saveNotice(noticeContent: NoticeContent) {
|
||||
TODO("Not yet implemented")
|
||||
noticeRepository.save(NoticeEntity(title = noticeContent.title, content = noticeContent.content))
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import me.jiniworld.demohx.annotation.UseCase
|
||||
import me.jiniworld.demohx.notice.application.port.input.RegisterNoticeCommand
|
||||
import me.jiniworld.demohx.notice.application.port.input.RegisterNoticeUseCase
|
||||
import me.jiniworld.demohx.notice.application.port.output.SaveNoticePort
|
||||
import me.jiniworld.demohx.notice.domain.NoticeContent
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
|
||||
@Transactional
|
||||
@@ -12,9 +13,7 @@ class RegisterNoticeService(
|
||||
private val saveNoticePort: SaveNoticePort,
|
||||
) : RegisterNoticeUseCase {
|
||||
|
||||
|
||||
|
||||
override fun registerNotice(command: RegisterNoticeCommand) {
|
||||
TODO("Not yet implemented")
|
||||
saveNoticePort.saveNotice(NoticeContent(title = command.title, content = command.content))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user