style: fix lint

This commit is contained in:
usbharu 2024-02-24 14:25:59 +09:00
parent 5c8d7e8d36
commit 23c830f390
9 changed files with 14 additions and 17 deletions

View File

@ -92,7 +92,6 @@ import java.security.interfaces.RSAPrivateKey
import java.security.interfaces.RSAPublicKey
import java.util.*
@EnableWebSecurity(debug = false)
@Configuration
@Suppress("FunctionMaxLength", "TooManyFunctions", "LongMethod")

View File

@ -35,4 +35,4 @@ open class ClientException : MastodonApiException {
writableStackTrace: Boolean,
response: MastodonApiErrorResponse<*>,
) : super(message, cause, enableSuppression, writableStackTrace, response)
}
}

View File

@ -52,4 +52,4 @@ abstract class MastodonApiException : RuntimeException {
) {
this.response = response
}
}
}

View File

@ -18,4 +18,4 @@ package dev.usbharu.hideout.mastodon.domain.exception
import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse
open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response)
open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response)

View File

@ -21,19 +21,16 @@ import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse
class StatusNotFoundException : ClientException {
fun getTypedResponse(): MastodonApiErrorResponse<NotFoundResponse> {
return response as MastodonApiErrorResponse<NotFoundResponse>
}
constructor(response: MastodonApiErrorResponse<NotFoundResponse>) : super(response)
constructor(message: String?, response: MastodonApiErrorResponse<NotFoundResponse>) : super(message, response)
constructor(message: String?, cause: Throwable?, response: MastodonApiErrorResponse<NotFoundResponse>) : super(
message,
cause,
response
)
constructor(cause: Throwable?, response: MastodonApiErrorResponse<NotFoundResponse>) : super(cause, response)
constructor(
message: String?,
cause: Throwable?,
@ -42,14 +39,18 @@ class StatusNotFoundException : ClientException {
response: MastodonApiErrorResponse<NotFoundResponse>,
) : super(message, cause, enableSuppression, writableStackTrace, response)
fun getTypedResponse(): MastodonApiErrorResponse<NotFoundResponse> =
response as MastodonApiErrorResponse<NotFoundResponse>
companion object {
fun ofId(id: Long): StatusNotFoundException = StatusNotFoundException(
"id: $id was not found.",
MastodonApiErrorResponse(
NotFoundResponse(
"Record not found"
), 404
),
404
),
)
}
}
}

View File

@ -16,4 +16,4 @@
package dev.usbharu.hideout.mastodon.domain.model
data class MastodonApiErrorResponse<R>(val response: R, val statusCode: Int)
data class MastodonApiErrorResponse<R>(val response: R, val statusCode: Int)

View File

@ -85,7 +85,7 @@ class MastodonApiControllerAdvice {
}
val message = details.map {
it.key + " " + it.value.joinToString { it.description }
it.key + " " + it.value.joinToString { responseDetails -> responseDetails.description }
}.joinToString()
return ResponseEntity.unprocessableEntity()
@ -101,4 +101,4 @@ class MastodonApiControllerAdvice {
companion object {
private val logger = LoggerFactory.getLogger(MastodonApiControllerAdvice::class.java)
}
}
}

View File

@ -43,7 +43,6 @@ class MastodonStatusesApiContoller(
)
}
override suspend fun apiV1StatusesIdEmojiReactionsEmojiDelete(id: String, emoji: String): ResponseEntity<Status> {
val uid =
loginUserContextHolder.getLoginUserId()

View File

@ -161,8 +161,6 @@ class StatsesApiServiceImpl(
status: Status,
userId: Long?,
): Status {
return when (status.visibility) {
public -> status
unlisted -> status