From 71a14c65c8914cf07d30dbd3548655093a3cb243 Mon Sep 17 00:00:00 2001 From: usbharu Date: Mon, 29 Jan 2024 21:01:59 +0900 Subject: [PATCH] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../infrastructure/exposed/Page.kt | 8 +++++-- .../account/MastodonAccountApiController.kt | 24 ++++++++++++++----- .../MastodonNotificationApiController.kt | 1 - 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/Page.kt b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/Page.kt index cff9e245..71df7898 100644 --- a/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/Page.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/Page.kt @@ -31,11 +31,15 @@ sealed class Page { ): Page = if (minId != null) { PageByMinId( - maxId, minId, limit + maxId, + minId, + limit ) } else { PageByMaxId( - maxId, sinceId, limit + maxId, + sinceId, + limit ) } } diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt index 64700a54..a32d1910 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/account/MastodonAccountApiController.kt @@ -27,7 +27,8 @@ class MastodonAccountApiController( ) : AccountApi { override suspend fun apiV1AccountsIdFollowPost( - id: String, followRequestBody: FollowRequestBody? + id: String, + followRequestBody: FollowRequestBody? ): ResponseEntity { val userid = loginUserContextHolder.getLoginUserId() @@ -38,11 +39,17 @@ class MastodonAccountApiController( ResponseEntity.ok(accountApiService.account(id.toLong())) override suspend fun apiV1AccountsVerifyCredentialsGet(): ResponseEntity = ResponseEntity( - accountApiService.verifyCredentials(loginUserContextHolder.getLoginUserId()), HttpStatus.OK + accountApiService.verifyCredentials(loginUserContextHolder.getLoginUserId()), + HttpStatus.OK ) override suspend fun apiV1AccountsPost( - username: String, password: String, email: String?, agreement: Boolean?, locale: Boolean?, reason: String? + username: String, + password: String, + email: String?, + agreement: Boolean?, + locale: Boolean?, + reason: String? ): ResponseEntity { transaction.transaction { accountApiService.registerAccount(UserCreateDto(username, username, "", password)) @@ -93,7 +100,8 @@ class MastodonAccountApiController( } override fun apiV1AccountsRelationshipsGet( - id: List?, withSuspended: Boolean + id: List?, + withSuspended: Boolean ): ResponseEntity> = runBlocking { val userid = loginUserContextHolder.getLoginUserId() @@ -164,8 +172,12 @@ class MastodonAccountApiController( val userid = loginUserContextHolder.getLoginUserId() val followRequests = accountApiService.followRequests( - userid, false, Page.PageByMaxId( - maxId?.toLongOrNull(), sinceId?.toLongOrNull(), limit?.coerceIn(0, 80) ?: 40 + userid, + false, + Page.PageByMaxId( + maxId?.toLongOrNull(), + sinceId?.toLongOrNull(), + limit?.coerceIn(0, 80) ?: 40 ) ) diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/notification/MastodonNotificationApiController.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/notification/MastodonNotificationApiController.kt index 1c8905c1..88d06682 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/notification/MastodonNotificationApiController.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/notification/MastodonNotificationApiController.kt @@ -55,7 +55,6 @@ class MastodonNotificationApiController( ) ResponseEntity.ok().header("Link", httpHeader).body(notifications.asFlow()) - } override suspend fun apiV1NotificationsIdDismissPost(id: String): ResponseEntity {