From 58e301cf7117b24001682e6f7fcd5dc30c0a6a9d Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:37:40 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20JavaScript=E3=81=8CBigInt=E3=82=92?= =?UTF-8?q?=E6=89=B1=E3=81=88=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- .../domain/model/hideout/dto/PostResponse.kt | 4 ++-- .../domain/model/hideout/dto/UserResponse.kt | 4 ++-- .../dev/usbharu/hideout/plugins/Routing.kt | 2 +- .../hideout/routing/api/internal/v1/Users.kt | 2 +- src/main/resources/openapi/api.yaml | 23 +++++++------------ 6 files changed, 15 insertions(+), 22 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 91ca0a6a..8cc4ad0e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -59,7 +59,7 @@ kotlin { } sourceSets.main { - java.srcDirs("build/generated/ksp/main/kotlin") + kotlin.srcDirs("$buildDir/generated/ksp/main") } dependencies { diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostResponse.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostResponse.kt index c6845da9..8aee3f68 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostResponse.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/PostResponse.kt @@ -5,7 +5,7 @@ import dev.usbharu.hideout.domain.model.hideout.entity.User import dev.usbharu.hideout.domain.model.hideout.entity.Visibility data class PostResponse( - val id: Long, + val id: String, val user: UserResponse, val overview: String? = null, val text: String? = null, @@ -17,7 +17,7 @@ data class PostResponse( companion object { fun from(post: Post, user: User): PostResponse { return PostResponse( - id = post.id, + id = post.id.toString(), user = UserResponse.from(user), overview = post.overview, text = post.text, diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserResponse.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserResponse.kt index ab8c1829..6213a7e4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserResponse.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/dto/UserResponse.kt @@ -3,7 +3,7 @@ package dev.usbharu.hideout.domain.model.hideout.dto import dev.usbharu.hideout.domain.model.hideout.entity.User data class UserResponse( - val id: Long, + val id: String, val name: String, val domain: String, val screenName: String, @@ -14,7 +14,7 @@ data class UserResponse( companion object { fun from(user: User): UserResponse { return UserResponse( - id = user.id, + id = user.id.toString(), name = user.name, domain = user.domain, screenName = user.screenName, diff --git a/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt b/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt index 8d4942f2..711d9c9a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt +++ b/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt @@ -13,9 +13,9 @@ import dev.usbharu.hideout.service.activitypub.ActivityPubUserService import dev.usbharu.hideout.service.api.IPostApiService import dev.usbharu.hideout.service.api.IUserApiService import dev.usbharu.hideout.service.auth.HttpSignatureVerifyService -import dev.usbharu.hideout.service.reaction.IReactionService import dev.usbharu.hideout.service.auth.IJwtService import dev.usbharu.hideout.service.core.IMetaService +import dev.usbharu.hideout.service.reaction.IReactionService import dev.usbharu.hideout.service.user.IUserAuthService import dev.usbharu.hideout.service.user.IUserService import io.ktor.server.application.* diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt b/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt index 24a45006..5a90ea7b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/api/internal/v1/Users.kt @@ -81,7 +81,7 @@ fun Route.users(userService: IUserService, userApiService: IUserApiService) { } val acct = AcctUtil.parse(userParameter) val targetUser = userApiService.findByAcct(acct) - if (userService.followRequest(targetUser.id, userId)) { + if (userService.followRequest(targetUser.id.toLong(), userId)) { return@post call.respond(HttpStatusCode.OK) } else { return@post call.respond(HttpStatusCode.Accepted) diff --git a/src/main/resources/openapi/api.yaml b/src/main/resources/openapi/api.yaml index e07dec94..840daedd 100644 --- a/src/main/resources/openapi/api.yaml +++ b/src/main/resources/openapi/api.yaml @@ -355,8 +355,7 @@ components: description: 投稿ID required: true schema: - type: integer - format: int64 + type: string userName: name: userName in: path @@ -385,8 +384,7 @@ components: - createdAt properties: id: - type: number - format: int64 + type: string readOnly: true name: type: string @@ -402,7 +400,7 @@ components: type: string readOnly: true createdAt: - type: number + type: integer readOnly: true PostResponse: type: object @@ -416,8 +414,7 @@ components: - sensitive properties: id: - type: integer - format: int64 + type: string readOnly: true user: $ref: "#/components/schemas/UserResponse" @@ -436,12 +433,10 @@ components: format: uri readOnly: true repostId: - type: integer - format: int64 + type: string readOnly: true replyId: - type: integer - format: int64 + type: string readOnly: true sensitive: type: boolean @@ -456,11 +451,9 @@ components: visibility: $ref: "#/components/schemas/Visibility" repostId: - type: integer - format: int64 + type: string replyId: - type: integer - format: int64 + type: string sensitive: type: boolean