From 259c04f4dfa9a8a9da60092c42e86e503c555db4 Mon Sep 17 00:00:00 2001 From: whereami0404 Date: Mon, 20 May 2024 12:33:28 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=EC=9D=91=EB=8B=B5=20DTO=20=EC=8A=A4?= =?UTF-8?q?=ED=8E=99=20=EB=B3=80=EA=B2=BD(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dto/DetailExperience.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/dto/DetailExperience.kt b/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/dto/DetailExperience.kt index 0fc5a645..d6aff10e 100644 --- a/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/dto/DetailExperience.kt +++ b/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/dto/DetailExperience.kt @@ -1,6 +1,5 @@ package com.bamyanggang.apimodule.domain.experience.application.dto -import com.bamyanggang.apimodule.domain.strongpoint.application.dto.GetStrongPoint.DetailStrongPoint import java.time.LocalDateTime import java.util.* @@ -8,8 +7,8 @@ class DetailExperience { data class Response( val id: UUID, val title: String, - val parentTagId: UUID, - val childTagId: UUID, + val parentTag: DetailTag, + val childTag: DetailTag, val strongPoints: List, val contents: List, val startedAt: LocalDateTime, @@ -20,4 +19,14 @@ class DetailExperience { val question: String, val answer: String, ) + + data class DetailTag( + val id: UUID, + val name: String, + ) + + data class DetailStrongPoint( + val id: UUID, + val name: String, + ) } From be4c87939e2574421c7058ea21b84903adcdfd4e Mon Sep 17 00:00:00 2001 From: whereami0404 Date: Mon, 20 May 2024 13:33:34 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=ED=83=9C=EA=B7=B8=20=EB=8B=A8?= =?UTF-8?q?=EA=B1=B4=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domainmodule/domain/tag/repository/TagRepository.kt | 1 + .../domainmodule/domain/tag/service/TagReader.kt | 4 ++++ .../com/bamyanggang/persistence/tag/TagRepositoryImpl.java | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/repository/TagRepository.kt b/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/repository/TagRepository.kt index 874c65a6..ae62bf28 100644 --- a/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/repository/TagRepository.kt +++ b/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/repository/TagRepository.kt @@ -9,4 +9,5 @@ interface TagRepository { fun findAllChildTagsByUserId(userId: UUID, parentId: UUID): List fun deleteByTagId(tagId: UUID) fun isExistById(tagId: UUID): Boolean + fun findById(tagId: UUID): Tag } diff --git a/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/service/TagReader.kt b/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/service/TagReader.kt index ca5fbe97..106e52a5 100644 --- a/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/service/TagReader.kt +++ b/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/tag/service/TagReader.kt @@ -16,4 +16,8 @@ class TagReader( fun readAllChildTagsByUserId(userId: UUID, parentId: UUID): List { return tagRepository.findAllChildTagsByUserId(userId, parentId) } + + fun readById(tagId: UUID): Tag { + return tagRepository.findById(tagId) + } } diff --git a/Infrastructure-Module/persistence/src/main/java/com/bamyanggang/persistence/tag/TagRepositoryImpl.java b/Infrastructure-Module/persistence/src/main/java/com/bamyanggang/persistence/tag/TagRepositoryImpl.java index 9de7d7ca..f7633cf7 100644 --- a/Infrastructure-Module/persistence/src/main/java/com/bamyanggang/persistence/tag/TagRepositoryImpl.java +++ b/Infrastructure-Module/persistence/src/main/java/com/bamyanggang/persistence/tag/TagRepositoryImpl.java @@ -1,6 +1,7 @@ package com.bamyanggang.persistence.tag; import com.bamyanggang.domainmodule.domain.tag.aggregate.Tag; +import com.bamyanggang.domainmodule.domain.tag.exception.TagException.NotFoundTag; import com.bamyanggang.domainmodule.domain.tag.repository.TagRepository; import com.bamyanggang.persistence.tag.jpa.entity.TagJpaEntity; import com.bamyanggang.persistence.tag.jpa.repository.TagJpaRepository; @@ -43,4 +44,10 @@ public void deleteByTagId(UUID tagId) { public boolean isExistById(UUID tagId) { return tagJpaRepository.existsById(tagId); } + + @Override + public Tag findById(UUID tagId) { + TagJpaEntity tagJpaEntity = tagJpaRepository.findById(tagId).orElseThrow(NotFoundTag::new); + return tagMapper.toDomainEntity(tagJpaEntity); + } } From 76e1d1857993af1ffce689209a3bdcd63c0cae1b Mon Sep 17 00:00:00 2001 From: whereami0404 Date: Mon, 20 May 2024 13:34:12 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=EA=B2=BD=ED=97=98=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=ED=83=9C=EA=B7=B8=20=EC=9D=91=EB=8B=B5=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ExperienceGetService.kt | 25 +++++++++++++++---- .../application/dto/CreateStrongPoint.kt | 2 +- .../service/StrongPointAppender.kt | 1 - 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/service/ExperienceGetService.kt b/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/service/ExperienceGetService.kt index 2ff4db3e..01a7a4b9 100644 --- a/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/service/ExperienceGetService.kt +++ b/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/experience/application/service/ExperienceGetService.kt @@ -3,9 +3,9 @@ package com.bamyanggang.apimodule.domain.experience.application.service import com.bamyanggang.apimodule.common.getAuthenticationPrincipal import com.bamyanggang.apimodule.domain.experience.application.dto.DetailExperience import com.bamyanggang.apimodule.domain.experience.application.dto.ExperienceYear -import com.bamyanggang.apimodule.domain.strongpoint.application.dto.GetStrongPoint import com.bamyanggang.domainmodule.domain.experience.service.ExperienceReader import com.bamyanggang.domainmodule.domain.strongpoint.service.StrongPointReader +import com.bamyanggang.domainmodule.domain.tag.service.TagReader import org.springframework.stereotype.Service import java.util.* @@ -13,6 +13,7 @@ import java.util.* class ExperienceGetService( private val experienceReader: ExperienceReader, private val strongPointReader: StrongPointReader, + private val tagReader: TagReader, ) { fun getExperienceDetailById(experienceId: UUID) : DetailExperience.Response { val oneExperience = experienceReader.readExperience(experienceId) @@ -24,9 +25,23 @@ class ExperienceGetService( ) } - val strongPointIds = oneExperience.strongPoints.map { it.id } + val strongPointIds = oneExperience.strongPoints.map { it.strongPointId } val strongPointDetails = strongPointReader.readByIds(strongPointIds).map { - GetStrongPoint.DetailStrongPoint( + DetailExperience.DetailStrongPoint( + it.id, + it.name + ) + } + + val detailParentTag = tagReader.readById(oneExperience.parentTagId).let { + DetailExperience.DetailTag( + it.id, + it.name + ) + } + + val detailChildTag = tagReader.readById(oneExperience.childTagId).let { + DetailExperience.DetailTag( it.id, it.name ) @@ -36,8 +51,8 @@ class ExperienceGetService( DetailExperience.Response( id = it.id, title = it.title, - parentTagId = it.parentTagId, - childTagId = it.childTagId, + parentTag = detailParentTag, + childTag = detailChildTag, strongPoints = strongPointDetails, contents = detailExperienceContents, startedAt = it.startedAt, diff --git a/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/strongpoint/application/dto/CreateStrongPoint.kt b/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/strongpoint/application/dto/CreateStrongPoint.kt index 6ebefd23..5e4c4471 100644 --- a/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/strongpoint/application/dto/CreateStrongPoint.kt +++ b/Api-Module/src/main/kotlin/com/bamyanggang/apimodule/domain/strongpoint/application/dto/CreateStrongPoint.kt @@ -4,7 +4,7 @@ import java.util.* class CreateStrongPoint { data class Request( - val names: List, + val names: List ) data class Response( diff --git a/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/strongpoint/service/StrongPointAppender.kt b/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/strongpoint/service/StrongPointAppender.kt index 2abf0287..df855f8b 100644 --- a/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/strongpoint/service/StrongPointAppender.kt +++ b/Domain-Module/src/main/kotlin/com/bamyanggang/domainmodule/domain/strongpoint/service/StrongPointAppender.kt @@ -22,6 +22,5 @@ class StrongPointAppender( strongPointRepository.saveAll(newStrongPoints) return newStrongPoints - } } From e678af2afa22ae67f0a39c3a0d66a487c03fb373 Mon Sep 17 00:00:00 2001 From: whereami0404 Date: Mon, 20 May 2024 13:34:31 +0900 Subject: [PATCH 4/4] =?UTF-8?q?test:=20=EC=9D=91=EB=8B=B5=20=EA=B0=92=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95(#1?= =?UTF-8?q?02)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ExperienceControllerTest.kt | 16 ++++++++++------ .../presentation/StrongPointControllerTest.kt | 8 +++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/experience/presentation/ExperienceControllerTest.kt b/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/experience/presentation/ExperienceControllerTest.kt index a91750a1..70fa0130 100644 --- a/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/experience/presentation/ExperienceControllerTest.kt +++ b/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/experience/presentation/ExperienceControllerTest.kt @@ -9,7 +9,6 @@ import com.bamyanggang.apimodule.domain.experience.application.service.Experienc import com.bamyanggang.apimodule.domain.experience.application.service.ExperienceDeleteService import com.bamyanggang.apimodule.domain.experience.application.service.ExperienceEditService import com.bamyanggang.apimodule.domain.experience.application.service.ExperienceGetService -import com.bamyanggang.apimodule.domain.strongpoint.application.dto.GetStrongPoint.DetailStrongPoint import com.bamyanggang.commonmodule.exception.ExceptionHandler import com.bamyanggang.commonmodule.fixture.generateFixture import org.junit.jupiter.api.DisplayName @@ -301,13 +300,14 @@ class ExperienceControllerTest : BaseRestDocsTest() { val contentResponse = arrayListOf(content1, content2) val experienceId: UUID = UUID.randomUUID() + val experienceDetailResponse : DetailExperience.Response = generateFixture { it.set("id", experienceId) it.set("title", "제목") it.set("contents", contentResponse) - it.set("strongPoints", generateFixture>()) - it.set("parentTagId", generateFixture()) - it.set("childTagId", generateFixture()) + it.set("strongPoints", generateFixture>()) + it.set("parentTag", generateFixture()) + it.set("childTag", generateFixture()) it.set("startedAt", generateFixture()) it.set("endedAt", generateFixture()) } @@ -340,8 +340,12 @@ class ExperienceControllerTest : BaseRestDocsTest() { fieldWithPath("strongPoints").description("관련된 역량 키워드"), fieldWithPath("strongPoints[].id").description("역량 키워드 id"), fieldWithPath("strongPoints[].name").description("역량 키워드 이름"), - fieldWithPath("parentTagId").description("속한 상위 태그"), - fieldWithPath("childTagId").description("속한 하위 태그"), + fieldWithPath("parentTag").description("속한 상위 태그"), + fieldWithPath("parentTag.id").description("상위 태그 id"), + fieldWithPath("parentTag.name").description("상위 태그 이름"), + fieldWithPath("childTag").description("속한 하위 태그"), + fieldWithPath("childTag.id").description("하위 태그 id"), + fieldWithPath("childTag.name").description("하위 태그 이름"), fieldWithPath("startedAt").description("경험 시작 날짜"), fieldWithPath("endedAt").description("경험 종료 날짜"), ), diff --git a/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/strongpoint/presentation/StrongPointControllerTest.kt b/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/strongpoint/presentation/StrongPointControllerTest.kt index bc1f0a7a..45d89df1 100644 --- a/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/strongpoint/presentation/StrongPointControllerTest.kt +++ b/Api-Module/src/test/kotlin/com/bamyanggang/apimodule/domain/strongpoint/presentation/StrongPointControllerTest.kt @@ -150,7 +150,13 @@ class StrongPointControllerTest : BaseRestDocsTest() { @Test @DisplayName("역량 키워드 개수 제한보다 더 많은 키워드 등록 시도 시 예외를 반환한다.") fun overCountLimitTest(){ - val overCountLimitRequest: CreateStrongPoint.Request = generateFixture() + val overCountLimitRequest = CreateStrongPoint.Request( + arrayListOf( + CreateStrongPoint.StrongPointName("역량 키워드 이름 1"), + CreateStrongPoint.StrongPointName("역량 키워드 이름 2") + ) + ) + given(strongPointController.createStrongPoint(overCountLimitRequest)).willThrow(StrongPointException.OverCountLimit())