Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASAP-249 feat: 편지 수정할 떄 templatetype도 받도록 추가 #105

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ interface UpdateLetterUsecase {

fun updateSpaceLetter(command: Command.Space)

sealed class Command {

sealed class Command {
data class Independent(
val letterId: String,
val userId: String,
val senderName: String,
val content: String,
val images: List<String>,
val templateType: Int,
) : Command()

data class Space(
Expand All @@ -21,6 +21,7 @@ interface UpdateLetterUsecase {
val senderName: String,
val content: String,
val images: List<String>,
val templateType: Int,
) : Command()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class LetterCommandService(
senderName = command.senderName,
content = command.content,
images = command.images,
templateType = command.templateType,
)
independentLetterManagementPort.save(independentLetter)
}
Expand All @@ -235,6 +236,7 @@ class LetterCommandService(
senderName = command.senderName,
content = command.content,
images = command.images,
templateType = command.templateType,
)
spaceLetterManagementPort.save(spaceLetter)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ class LetterCommandServiceTest :
content = "content",
images = emptyList(),
userId = "user-id",
templateType = 1,
)
val independentLetter =
LetterFixture.generateIndependentLetter(
Expand All @@ -318,7 +319,7 @@ class LetterCommandServiceTest :
}

given("행성 편지 수정 요청이 들어올 떄") {
val command = UpdateLetterUsecase.Command.Space("letter-id", "user-id", "name", "content", emptyList())
val command = UpdateLetterUsecase.Command.Space("letter-id", "user-id", "name", "content", emptyList(), 1)
val spaceLetter =
LetterFixture.generateSpaceLetter(
id = DomainId("letter-id"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class LetterController(
content = request.content,
images = request.images,
userId = userId,
templateType = request.templateType,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class SpaceLetterController(
content = request.content,
images = request.images,
userId = userId,
templateType = request.templateType,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package com.asap.bootstrap.letter.dto
data class ModifyLetterRequest(
val senderName: String,
val content: String,
val images: List<String>
) {
}
val images: List<String>,
val templateType: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ class LetterControllerTest : LetterAcceptanceSupporter() {
senderName = "senderName",
content = "content",
images = listOf("images"),
templateType = 1,
)
// when
val response =
Expand Down Expand Up @@ -545,7 +546,7 @@ class LetterControllerTest : LetterAcceptanceSupporter() {
}

@Nested
inner class DeleteSendLetter {
inner class DeleteSendLetter {
@Test
fun deleteSendLetter() {
// given
Expand All @@ -564,7 +565,7 @@ class LetterControllerTest : LetterAcceptanceSupporter() {
}

@Test
fun deleteSendLetters() {
fun deleteSendLetters() {
// given
val userId = userMockManager.settingUser()
val accessToken = jwtMockManager.generateAccessToken(userId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class SpaceLetterControllerTest : LetterAcceptanceSupporter() {
content = "content",
images = listOf("images"),
senderName = "senderName",
templateType = 1,
)
// when
val response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ class LetterApiIntegrationTest : IntegrationSupporter() {
content = "content",
images = listOf("images"),
senderName = "senderName",
templateType = 1,
)
// when
val response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ class SpaceLetterApiIntegrationTest : IntegrationSupporter() {
content = "updateContent",
images = listOf("image1", "image2"),
senderName = "updateSenderName",
templateType = 1,
)
// when
val response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ class IndependentLetter(
senderName: String,
content: String,
images: List<String>,
templateType: Int,
) {
this.sender.update(senderName)
this.content.updateContent(content)
this.content.updateImages(images.toMutableList())
this.content.updateTemplateType(templateType)
}

fun delete() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ class SpaceLetter(
senderName: String,
content: String,
images: List<String>,
templateType: Int,
) {
this.sender.update(senderName)
this.content.updateContent(content)
this.content.updateImages(images.toMutableList())
this.content.updateTemplateType(templateType)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.asap.domain.letter.vo
data class LetterContent(
var content: String,
val images: MutableList<String>,
val templateType: Int,
var templateType: Int,
) {
fun updateContent(content: String) {
this.content = content
Expand All @@ -14,7 +14,11 @@ data class LetterContent(
this.images.addAll(images)
}

fun delete() {
fun updateTemplateType(templateType: Int) {
this.templateType = templateType
}

fun delete() {
this.content = ""
this.images.clear()
}
Expand Down
Loading