From 0ce419990541260c174ab7cdd1465eec7af82ce0 Mon Sep 17 00:00:00 2001 From: Jo Seonggyu Date: Fri, 8 Sep 2023 22:40:37 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20admissions=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=ED=94=84=EB=A1=A0=ED=8A=B8=EC=97=90=20=EB=A7=9E=EA=B2=8C=20?= =?UTF-8?q?=ED=98=91=EC=9D=98=20(#76)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: admissions 프론트에 맞게 협의 * fix: seminarEntity time 삭제 * fix: admissionsEntity pageName 추가 * fix: 불필요한 파일 삭제 * 커밋 --- .../csereal/core/academics/dto/SubjectChangesDto.kt | 1 + .../core/admissions/api/AdmissionsController.kt | 8 ++++---- .../core/admissions/database/AdmissionsEntity.kt | 6 +++--- .../csereal/core/admissions/dto/AdmissionsDto.kt | 2 -- .../core/admissions/service/AdmissionsService.kt | 10 ++++++++-- .../csereal/core/seminar/database/SeminarEntity.kt | 6 ------ .../csereal/core/seminar/dto/SeminarDto.kt | 4 ---- 7 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt index 33cf95d3..28754dc7 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/SubjectChangesDto.kt @@ -7,6 +7,7 @@ class SubjectChangesDto( val description: String, ) { companion object { + fun of(entity: AcademicsEntity) = entity.run { SubjectChangesDto( time = this.time!!, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/api/AdmissionsController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/api/AdmissionsController.kt index 36ab19c8..25798f87 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/api/AdmissionsController.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/api/AdmissionsController.kt @@ -17,9 +17,9 @@ import org.springframework.web.bind.annotation.RestController class AdmissionsController( private val admissionsService: AdmissionsService ) { - @PostMapping("/undergraduate") + @PostMapping("/undergraduate/{postType}") fun createUndergraduateAdmissions( - @RequestParam postType: String, + @PathVariable postType: String, @Valid @RequestBody request: AdmissionsDto ) : AdmissionsDto { return admissionsService.createUndergraduateAdmissions(postType, request) @@ -32,9 +32,9 @@ class AdmissionsController( return admissionsService.createGraduateAdmissions(request) } - @GetMapping("/undergraduate") + @GetMapping("/undergraduate/{postType}") fun readUndergraduateAdmissions( - @RequestParam postType: String + @PathVariable postType: String ) : ResponseEntity { return ResponseEntity.ok(admissionsService.readUndergraduateAdmissions(postType)) } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/database/AdmissionsEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/database/AdmissionsEntity.kt index e12e9716..7d7640e8 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/database/AdmissionsEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/database/AdmissionsEntity.kt @@ -10,14 +10,14 @@ import jakarta.persistence.Enumerated class AdmissionsEntity( @Enumerated(EnumType.STRING) val postType: AdmissionsPostType, - val title: String, + val pageName: String, val description: String, ): BaseTimeEntity() { companion object { - fun of(postType: AdmissionsPostType, admissionsDto: AdmissionsDto) : AdmissionsEntity { + fun of(postType: AdmissionsPostType, pageName: String, admissionsDto: AdmissionsDto) : AdmissionsEntity { return AdmissionsEntity( postType = postType, - title = admissionsDto.title, + pageName = pageName, description = admissionsDto.description, ) } diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/dto/AdmissionsDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/dto/AdmissionsDto.kt index c49c7e7a..c5bb7dbe 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/dto/AdmissionsDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/dto/AdmissionsDto.kt @@ -5,7 +5,6 @@ import java.time.LocalDateTime data class AdmissionsDto( val id: Long, - val title: String, val description: String, val createdAt: LocalDateTime?, val modifiedAt: LocalDateTime?, @@ -14,7 +13,6 @@ data class AdmissionsDto( fun of(entity: AdmissionsEntity) : AdmissionsDto = entity.run { AdmissionsDto( id = this.id, - title = this.title, description = this.description, createdAt = this.createdAt, modifiedAt = this.modifiedAt, diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt index e79a67cf..67a59ae8 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/admissions/service/AdmissionsService.kt @@ -24,7 +24,13 @@ class AdmissionsServiceImpl( override fun createUndergraduateAdmissions(postType: String, request: AdmissionsDto): AdmissionsDto { val enumPostType = makeStringToAdmissionsPostType(postType) - val newAdmissions = AdmissionsEntity.of(enumPostType, request) + val pageName = when(enumPostType) { + AdmissionsPostType.UNDERGRADUATE_EARLY_ADMISSION -> "수시 모집" + AdmissionsPostType.UNDERGRADUATE_REGULAR_ADMISSION -> "정시 모집" + else -> throw CserealException.Csereal404("해당하는 페이지를 찾을 수 없습니다.") + } + + val newAdmissions = AdmissionsEntity.of(enumPostType, pageName, request) admissionsRepository.save(newAdmissions) @@ -33,7 +39,7 @@ class AdmissionsServiceImpl( @Transactional override fun createGraduateAdmissions(request: AdmissionsDto): AdmissionsDto { - val newAdmissions: AdmissionsEntity = AdmissionsEntity.of(AdmissionsPostType.GRADUATE, request) + val newAdmissions: AdmissionsEntity = AdmissionsEntity.of(AdmissionsPostType.GRADUATE, "전기/후기 모집", request) admissionsRepository.save(newAdmissions) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt index 06218223..bd175855 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/database/SeminarEntity.kt @@ -29,9 +29,7 @@ class SeminarEntity( var affiliationURL: String?, var startDate: String?, - var startTime: String?, var endDate: String?, - var endTime: String?, var location: String, @@ -65,9 +63,7 @@ class SeminarEntity( affiliation = seminarDto.affiliation, affiliationURL = seminarDto.affiliationURL, startDate = seminarDto.startDate, - startTime = seminarDto.startTime, endDate = seminarDto.endDate, - endTime = seminarDto.endTime, location = seminarDto.location, host = seminarDto.host, isPublic = seminarDto.isPublic, @@ -87,9 +83,7 @@ class SeminarEntity( affiliation = updateSeminarRequest.affiliation affiliationURL = updateSeminarRequest.affiliationURL startDate = updateSeminarRequest.startDate - startTime = updateSeminarRequest.startTime endDate = updateSeminarRequest.endDate - endTime = updateSeminarRequest.endTime location = updateSeminarRequest.location host = updateSeminarRequest.host isPublic = updateSeminarRequest.isPublic diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt index c6c2d9c9..3ca22770 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/seminar/dto/SeminarDto.kt @@ -16,9 +16,7 @@ data class SeminarDto( val affiliation: String, val affiliationURL: String?, val startDate: String?, - val startTime: String?, val endDate: String?, - val endTime: String?, val location: String, val host: String?, val additionalNote: String?, @@ -47,9 +45,7 @@ data class SeminarDto( affiliation = this.affiliation, affiliationURL = this.affiliationURL, startDate = this.startDate, - startTime = this.startTime, endDate = this.endDate, - endTime = this.endTime, location = this.location, host = this.host, additionalNote = this.additionalNote,