-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from KUSITMS-29th-TEAM-B/feat/flight-74
feat: 경험 수정 API 구현(#74)
- Loading branch information
Showing
23 changed files
with
383 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...main/kotlin/com/bamyanggang/apimodule/domain/experience/application/dto/EditExperience.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.bamyanggang.apimodule.domain.experience.application.dto | ||
|
||
import com.bamyanggang.apimodule.domain.experience.application.dto.CreateExperience.ExperienceContentRequest | ||
import java.time.LocalDateTime | ||
import java.util.* | ||
|
||
class EditExperience { | ||
data class Request( | ||
val title: String, | ||
val parentTagId: UUID, | ||
val childTagId: UUID, | ||
val strongPointIds: List<UUID>, | ||
val contents: List<ExperienceContentRequest>, | ||
val startedAt: LocalDateTime, | ||
val endedAt: LocalDateTime, | ||
) | ||
|
||
data class ExperienceContentRequest( | ||
val question: String, | ||
val answer: String, | ||
) | ||
|
||
data class Response(val id: UUID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.../com/bamyanggang/apimodule/domain/experience/application/service/ExperienceEditService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.bamyanggang.apimodule.domain.experience.application.service | ||
|
||
import com.bamyanggang.apimodule.common.getAuthenticationPrincipal | ||
import com.bamyanggang.apimodule.domain.experience.application.dto.EditExperience | ||
import com.bamyanggang.domainmodule.domain.experience.aggregate.ExperienceContent | ||
import com.bamyanggang.domainmodule.domain.experience.aggregate.ExperienceStrongPoint | ||
import com.bamyanggang.domainmodule.domain.experience.service.ExperienceModifier | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
import java.util.* | ||
|
||
@Service | ||
class ExperienceEditService( | ||
private val experienceModifier: ExperienceModifier, | ||
) { | ||
@Transactional | ||
fun editExperience(request: EditExperience.Request, experienceId: UUID) : EditExperience.Response{ | ||
val newContents = request.contents.map { | ||
ExperienceContent.create(it.question, it.answer) | ||
} | ||
|
||
val newExperienceStrongPoints = request.strongPointIds.map { | ||
ExperienceStrongPoint.create(it) | ||
} | ||
|
||
return getAuthenticationPrincipal().let { | ||
experienceModifier.modifyExperience( | ||
experienceId = experienceId, | ||
userId = it, | ||
title = request.title, | ||
parentTagId = request.parentTagId, | ||
childTagId = request.childTagId, | ||
contents = newContents, | ||
experienceStrongPoints = newExperienceStrongPoints, | ||
startedAt = request.startedAt, | ||
endedAt = request.endedAt | ||
) | ||
}.let { EditExperience.Response(it.id) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.../kotlin/com/bamyanggang/domainmodule/domain/experience/aggregate/ExperienceStrongPoint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.bamyanggang.domainmodule.domain.experience.aggregate | ||
|
||
import com.bamyanggang.domainmodule.common.entity.DomainEntity | ||
import com.example.uuid.UuidCreator | ||
import java.util.* | ||
|
||
data class ExperienceStrongPoint( | ||
override val id: UUID = UuidCreator.create(), | ||
val strongPointId: UUID | ||
) : DomainEntity { | ||
|
||
companion object { | ||
fun create(strongPointId: UUID): ExperienceStrongPoint { | ||
return ExperienceStrongPoint(strongPointId = strongPointId) | ||
} | ||
|
||
fun toDomain(id: UUID, strongPointId: UUID): ExperienceStrongPoint { | ||
return ExperienceStrongPoint(id, strongPointId) | ||
} | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
.../com/bamyanggang/domainmodule/domain/experience/repository/ExperienceContentRepository.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.