-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix :: rollback serialization related trashes... it works well
- Loading branch information
Showing
24 changed files
with
86 additions
and
131 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
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
25 changes: 0 additions & 25 deletions
25
src/main/kotlin/com/teamapi/palette/dto/response/ChatResponses.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/com/teamapi/palette/dto/response/Responses.kt
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
src/main/kotlin/com/teamapi/palette/dto/response/RoomResponses.kt
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/teamapi/palette/dto/response/chat/ChatResponse.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,17 @@ | ||
package com.teamapi.palette.dto.response.chat | ||
|
||
import com.teamapi.palette.entity.consts.ChatState | ||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ChatResponse( | ||
val id: String?, | ||
val message: String?, | ||
val resource: ChatState, | ||
val datetime: Instant, | ||
val roomId: Long, | ||
val userId: Long, | ||
val isAi: Boolean, | ||
val promptId: String?, | ||
) |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/teamapi/palette/dto/response/chat/ImageListResponse.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,8 @@ | ||
package com.teamapi.palette.dto.response.chat | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ImageListResponse( | ||
val images: List<String> | ||
) |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/teamapi/palette/dto/response/room/QnAResponse.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,15 @@ | ||
package com.teamapi.palette.dto.response.room | ||
|
||
import com.teamapi.palette.entity.consts.PromptType | ||
import com.teamapi.palette.entity.qna.ChatAnswer | ||
import com.teamapi.palette.entity.qna.ChatQuestion | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class QnAResponse( | ||
val id: String, | ||
val type: PromptType, | ||
val question: ChatQuestion, | ||
val answer: ChatAnswer?, | ||
val promptName: String, | ||
) |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/teamapi/palette/dto/response/room/RoomResponse.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,10 @@ | ||
package com.teamapi.palette.dto.response.room | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RoomResponse( | ||
val id: Long, | ||
val title: String?, | ||
val message: String? | ||
) |
7 changes: 2 additions & 5 deletions
7
...api/palette/dto/response/UserResponses.kt → ...palette/dto/response/user/UserResponse.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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
package com.teamapi.palette.dto.response | ||
package com.teamapi.palette.dto.response.user | ||
|
||
import com.teamapi.palette.entity.User | ||
import kotlinx.datetime.LocalDate | ||
import kotlinx.datetime.toKotlinLocalDate | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
sealed interface UserResponses : Responses { | ||
@Serializable | ||
data class UserResponse( | ||
val id: Long, | ||
val name: String, | ||
val email: String, | ||
val birthDate: LocalDate | ||
) : UserResponses { | ||
) { | ||
companion object { | ||
fun from(user: User): UserResponse { | ||
return UserResponse(user.id!!, user.username, user.email, user.birthDate.toKotlinLocalDate()) | ||
} | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/com/teamapi/palette/repository/chat/ChatRepository.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
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
13 changes: 6 additions & 7 deletions
13
src/main/kotlin/com/teamapi/palette/response/ResponseBody.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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
package com.teamapi.palette.response | ||
|
||
import com.teamapi.palette.dto.response.Responses | ||
import kotlinx.serialization.Serializable | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.http.ResponseEntity | ||
|
||
@Serializable | ||
class ResponseBody( | ||
class ResponseBody<T : Any>( | ||
override val code: Int, | ||
override val message: String, | ||
val data: Responses, | ||
val data: T, | ||
) : BaseResponse { | ||
companion object { | ||
fun of(code: HttpStatus, message: String, data: Responses): ResponseEntity<ResponseBody> = | ||
fun <T : Any> of(code: HttpStatus, message: String, data: T): ResponseEntity<ResponseBody<T>> = | ||
ResponseEntity.status(code).body(ResponseBody(code.value(), message, data)) | ||
|
||
fun ok(message: String, data: Responses) = of(HttpStatus.OK, message, data) | ||
fun created(message: String, data: Responses) = of(HttpStatus.CREATED, message, data) | ||
fun noContent(message: String, data: Responses) = of(HttpStatus.NO_CONTENT, message, data) | ||
fun <T : Any> ok(message: String, data: T) = of(HttpStatus.OK, message, data) | ||
fun <T : Any> created(message: String, data: T) = of(HttpStatus.CREATED, message, data) | ||
fun <T : Any> noContent(message: String, data: T) = of(HttpStatus.NO_CONTENT, message, data) | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
src/main/kotlin/com/teamapi/palette/response/ResponseList.kt
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.