Skip to content

Commit

Permalink
refactor : imageUrl property to emojiImageId
Browse files Browse the repository at this point in the history
  • Loading branch information
xonmin committed Jun 29, 2024
1 parent 58b663e commit 49d1a46
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
11 changes: 5 additions & 6 deletions api/src/main/kotlin/com/mashup/dojo/QuestionController.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mashup.dojo

import com.mashup.dojo.common.DojoApiResponse
import com.mashup.dojo.domain.QuestionId
import com.mashup.dojo.dto.QuestionCreateRequest
import com.mashup.dojo.usecase.QuestionUseCase
import io.swagger.v3.oas.annotations.Operation
Expand All @@ -22,15 +23,13 @@ class QuestionController(
@PostMapping
fun createQuestion(
@Valid @RequestBody request: QuestionCreateRequest,
): DojoApiResponse<Unit> {
questionUseCase.create(
): DojoApiResponse<QuestionId> {
return questionUseCase.create(
QuestionUseCase.CreateCommand(
content = request.content,
type = request.type,
imageUrl = request.imageUrl
emojiImageId = request.emojiImageId
)
)

return DojoApiResponse.success()
).let { DojoApiResponse.success(it.id) }
}
}
5 changes: 3 additions & 2 deletions api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mashup.dojo.dto

import com.mashup.dojo.domain.ImageId
import com.mashup.dojo.domain.QuestionType
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
Expand All @@ -12,8 +13,8 @@ data class QuestionCreateRequest(
@field:NotNull
val type: QuestionType,
@field:NotBlank
@Schema(description = "질문 이미지")
val imageUrl: String,
@Schema(description = "질문 이모지 이미지 id")
val emojiImageId: ImageId,
)

@Schema(description = "질문 등록 bulk 요청")
Expand Down
2 changes: 1 addition & 1 deletion service/src/main/kotlin/com/mashup/dojo/domain/Question.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class Question(
val content: String,
val type: QuestionType,
// Todo 정책 확인하고 이름 확실하게 짓기
val imageUrl: String,
val emojiImageId: ImageId,
val createdAt: LocalDateTime,
val deletedAt: LocalDateTime?,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mashup.dojo.service

import com.mashup.dojo.domain.ImageId
import com.mashup.dojo.domain.Question
import com.mashup.dojo.domain.QuestionId
import com.mashup.dojo.domain.QuestionType
Expand All @@ -14,7 +15,7 @@ interface QuestionService {
fun createQuestion(
content: String,
type: QuestionType,
imageUrl: String,
emojiImageId: ImageId,
): Question
}

Expand All @@ -25,7 +26,7 @@ class DefaultQuestionService : QuestionService {
override fun createQuestion(
content: String,
type: QuestionType,
imageUrl: String,
emojiImageId: ImageId,
): Question {
// todo create questionEntity
// return QuestionRepository.save(content, type, imageUrl).toQuestion
Expand All @@ -42,7 +43,7 @@ class DefaultQuestionService : QuestionService {
id = QuestionId(8181818),
content = "세상에서 제일 멋쟁이인 사람",
type = QuestionType.FRIEND,
imageUrl = "default:url",
emojiImageId = ImageId(1),
createdAt = LocalDateTime.now(),
deletedAt = null
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mashup.dojo.usecase

import com.mashup.dojo.domain.ImageId
import com.mashup.dojo.domain.Question
import com.mashup.dojo.domain.QuestionType
import com.mashup.dojo.service.QuestionService
Expand All @@ -9,7 +10,7 @@ interface QuestionUseCase {
data class CreateCommand(
val content: String,
val type: QuestionType,
val imageUrl: String,
val emojiImageId: ImageId,
)

fun create(command: CreateCommand): Question
Expand All @@ -23,7 +24,7 @@ class QuestionCreateUseCase(
return questionService.createQuestion(
command.content,
command.type,
command.imageUrl
command.emojiImageId
)
}
}

0 comments on commit 49d1a46

Please sign in to comment.