style: スタイルを修正

This commit is contained in:
usbharu 2023-08-15 01:53:33 +09:00
parent 16fd6a017e
commit 6e6e2a911c
2 changed files with 5 additions and 8 deletions

View File

@ -28,10 +28,7 @@ fun Routing.usersAP(
val name = val name =
call.parameters["name"] ?: throw ParameterNotExistException("Parameter(name='name') does not exist.") call.parameters["name"] ?: throw ParameterNotExistException("Parameter(name='name') does not exist.")
val person = apUserService.getPersonByName(name) val person = apUserService.getPersonByName(name)
return@handle call.respondAp( return@handle call.respondAp(person, HttpStatusCode.OK)
person,
HttpStatusCode.OK
)
} }
get { get {
// TODO: 暫定処置なので治す // TODO: 暫定処置なので治す
@ -43,7 +40,8 @@ fun Routing.usersAP(
) )
val personByName = apUserService.getPersonByName(userEntity.name) val personByName = apUserService.getPersonByName(userEntity.name)
call.respondText( call.respondText(
userEntity.toString() + "\n" + followerQueryService.findFollowersById(userEntity.id) + "\n" + Config.configData.objectMapper.writeValueAsString( userEntity.toString() + "\n" + followerQueryService.findFollowersById(userEntity.id) +
"\n" + Config.configData.objectMapper.writeValueAsString(
personByName personByName
) )
) )
@ -56,9 +54,7 @@ class ContentTypeRouteSelector(private vararg val contentType: ContentType) : Ro
override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation { override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation {
context.call.application.log.debug("Accept: ${context.call.request.accept()}") context.call.application.log.debug("Accept: ${context.call.request.accept()}")
val requestContentType = context.call.request.accept() ?: return RouteSelectorEvaluation.FailedParameter val requestContentType = context.call.request.accept() ?: return RouteSelectorEvaluation.FailedParameter
return if (requestContentType.split(",") return if (requestContentType.split(",").any { contentType.any { contentType -> contentType.match(it) } }) {
.any { contentType.any { contentType -> contentType.match(it) } }
) {
RouteSelectorEvaluation.Constant RouteSelectorEvaluation.Constant
} else { } else {
RouteSelectorEvaluation.FailedParameter RouteSelectorEvaluation.FailedParameter

View File

@ -12,6 +12,7 @@ import dev.usbharu.hideout.service.user.UserService
import org.koin.core.annotation.Single import org.koin.core.annotation.Single
import kotlin.math.min import kotlin.math.min
@Suppress("TooManyFunctions")
interface UserApiService { interface UserApiService {
suspend fun findAll(limit: Int? = 100, offset: Long = 0): List<UserResponse> suspend fun findAll(limit: Int? = 100, offset: Long = 0): List<UserResponse>