[#7] API 응답 형식 재정의 및 Swagger-UI 관련 코드 패키지 분리 #8

Merged
pricelees merged 16 commits from refactor/#7 into main 2025-07-15 05:37:42 +00:00
2 changed files with 14 additions and 33 deletions
Showing only changes of commit 0679365803 - Show all commits

View File

@ -0,0 +1,14 @@
package roomescape.common.dto.response
import com.fasterxml.jackson.annotation.JsonInclude
import roomescape.common.exception.ErrorType
@JsonInclude(JsonInclude.Include.NON_NULL)
data class CommonApiResponse<T>(
val data: T? = null,
)
data class CommonErrorResponse(
val errorType: ErrorType,
val message: String = errorType.description
)

View File

@ -1,33 +0,0 @@
package roomescape.common.dto.response
import com.fasterxml.jackson.annotation.JsonInclude
import roomescape.common.exception.ErrorType
@JsonInclude(JsonInclude.Include.NON_NULL)
data class RoomescapeApiResponseKT<T>(
val success: Boolean,
val data: T? = null,
val errorType: ErrorType? = null,
val message: String? = null,
) {
companion object {
@JvmStatic
fun <T> success(data: T? = null): RoomescapeApiResponseKT<T> {
return RoomescapeApiResponseKT(
success = true,
data = data,
)
}
@JvmStatic
fun <T> fail(errorType: ErrorType, message: String? = null): RoomescapeApiResponseKT<T> {
return RoomescapeApiResponseKT(
success = false,
errorType = errorType,
message = message ?: errorType.description
)
}
}
}