From a68f5ae577d04f486149d59b15f49aa1dd9ef0af Mon Sep 17 00:00:00 2001 From: kazakago Date: Sat, 6 Jan 2024 00:09:39 +0900 Subject: [PATCH] remove wildcard import --- .../kotlin/com/kazakago/cueue/Application.kt | 19 ++++++----- .../cueue/auth/firebase/FirebaseAuth.kt | 14 +++++--- .../cueue/config/cors/CORSRegister.kt | 7 ++-- .../cueue/config/database/DatabasePlugin.kt | 2 +- .../cueue/config/database/MigrationPlugin.kt | 2 +- .../cueue/config/firebase/FirebasePlugin.kt | 2 +- .../kazakago/cueue/config/koin/KoinPlugin.kt | 2 +- .../config/maintenance/MaintenancePlugin.kt | 14 +++++--- .../cueue/config/sentry/SentryPlugin.kt | 2 +- .../config/statuspage/StatusPageHandler.kt | 2 +- .../cueue/config/version/VersionPlugin.kt | 12 ++++--- .../cueue/controller/CallbackController.kt | 4 +-- .../cueue/controller/ContentsController.kt | 6 ++-- .../cueue/controller/ErrorController.kt | 8 ++--- .../controller/InvitationAcceptController.kt | 6 ++-- .../cueue/controller/InvitationController.kt | 6 ++-- .../cueue/controller/InvitationsController.kt | 6 ++-- .../cueue/controller/MenuController.kt | 6 ++-- .../cueue/controller/MenusController.kt | 6 ++-- .../cueue/controller/RecipeController.kt | 6 ++-- .../cueue/controller/RecipesController.kt | 6 ++-- .../cueue/controller/RootController.kt | 4 +-- .../cueue/controller/TagController.kt | 6 ++-- .../cueue/controller/TagsController.kt | 6 ++-- .../cueue/controller/UserController.kt | 6 ++-- .../cueue/controller/UsersController.kt | 6 ++-- .../cueue/controller/WorkspaceController.kt | 6 ++-- .../cueue/controller/WorkspacesController.kt | 6 ++-- .../cueue/controller/di/ControllerModules.kt | 17 +++++++++- .../cueue/database/entity/WorkspaceEntity.kt | 6 +++- .../com/kazakago/cueue/mapper/MenuMapper.kt | 2 -- .../cueue/mapper/MenuSummaryMapper.kt | 2 -- .../kazakago/cueue/mapper/di/MapperModules.kt | 11 +++++- .../com/kazakago/cueue/model/DecodedImage.kt | 9 +++-- .../com/kazakago/cueue/model/FirebaseUser.kt | 2 +- .../com/kazakago/cueue/model/Invitation.kt | 6 +++- .../cueue/repository/MenuRepository.kt | 14 ++++++-- .../kazakago/cueue/repository/Offsetter.kt | 2 +- .../cueue/repository/RecipeRepository.kt | 13 +++++-- .../cueue/repository/TagRepository.kt | 6 +++- .../cueue/repository/di/RepositoryModules.kt | 8 ++++- .../com/kazakago/cueue/route/AppRouter.kt | 34 +++++++++++++++---- .../cueue/route/ApplicationCallExtension.kt | 12 ++++--- 43 files changed, 211 insertions(+), 111 deletions(-) diff --git a/server/src/main/kotlin/com/kazakago/cueue/Application.kt b/server/src/main/kotlin/com/kazakago/cueue/Application.kt index 418db28..0714e40 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/Application.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/Application.kt @@ -11,15 +11,16 @@ import com.kazakago.cueue.config.koin.register import com.kazakago.cueue.config.sentry.Sentry import com.kazakago.cueue.config.statuspage.handle import com.kazakago.cueue.route.appRouting -import io.ktor.serialization.kotlinx.json.* -import io.ktor.server.application.* -import io.ktor.server.auth.* -import io.ktor.server.plugins.callloging.* -import io.ktor.server.plugins.contentnegotiation.* -import io.ktor.server.plugins.cors.routing.* -import io.ktor.server.plugins.defaultheaders.* -import io.ktor.server.plugins.forwardedheaders.* -import io.ktor.server.plugins.statuspages.* +import io.ktor.serialization.kotlinx.json.json +import io.ktor.server.application.Application +import io.ktor.server.application.install +import io.ktor.server.auth.Authentication +import io.ktor.server.plugins.callloging.CallLogging +import io.ktor.server.plugins.contentnegotiation.ContentNegotiation +import io.ktor.server.plugins.cors.routing.CORS +import io.ktor.server.plugins.defaultheaders.DefaultHeaders +import io.ktor.server.plugins.forwardedheaders.XForwardedHeaders +import io.ktor.server.plugins.statuspages.StatusPages fun Application.module() { install(Database) diff --git a/server/src/main/kotlin/com/kazakago/cueue/auth/firebase/FirebaseAuth.kt b/server/src/main/kotlin/com/kazakago/cueue/auth/firebase/FirebaseAuth.kt index b3bd8f9..f838802 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/auth/firebase/FirebaseAuth.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/auth/firebase/FirebaseAuth.kt @@ -5,11 +5,15 @@ import com.google.firebase.FirebaseException import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseAuthException import com.google.firebase.auth.FirebaseToken -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.auth.* -import io.ktor.server.request.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.auth.AuthenticationConfig +import io.ktor.server.auth.AuthenticationContext +import io.ktor.server.auth.AuthenticationProvider +import io.ktor.server.auth.Principal +import io.ktor.server.request.ApplicationRequest +import io.ktor.server.request.authorization +import io.ktor.server.response.respond class FirebaseAuthenticationProvider internal constructor(config: Config) : AuthenticationProvider(config) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/cors/CORSRegister.kt b/server/src/main/kotlin/com/kazakago/cueue/config/cors/CORSRegister.kt index 3534d0c..73f4417 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/cors/CORSRegister.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/cors/CORSRegister.kt @@ -1,8 +1,9 @@ package com.kazakago.cueue.config.cors -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.plugins.cors.* +import io.ktor.http.HttpHeaders +import io.ktor.http.HttpMethod +import io.ktor.server.application.ApplicationCallPipeline +import io.ktor.server.plugins.cors.CORSConfig fun CORSConfig.register(application: ApplicationCallPipeline) { val environment = application.environment ?: throw IllegalStateException() diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/database/DatabasePlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/database/DatabasePlugin.kt index bafecd9..822d82a 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/database/DatabasePlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/database/DatabasePlugin.kt @@ -1,6 +1,6 @@ package com.kazakago.cueue.config.database -import io.ktor.server.application.* +import io.ktor.server.application.createApplicationPlugin import org.jetbrains.exposed.sql.Database import java.net.URI diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/database/MigrationPlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/database/MigrationPlugin.kt index a130d7d..9957402 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/database/MigrationPlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/database/MigrationPlugin.kt @@ -1,6 +1,6 @@ package com.kazakago.cueue.config.database -import io.ktor.server.application.* +import io.ktor.server.application.createApplicationPlugin import org.flywaydb.core.Flyway val Migration = createApplicationPlugin(name = "Migration") { diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/firebase/FirebasePlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/firebase/FirebasePlugin.kt index df0610d..c47fd7a 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/firebase/FirebasePlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/firebase/FirebasePlugin.kt @@ -5,7 +5,7 @@ import com.google.firebase.FirebaseApp import com.google.firebase.FirebaseOptions import com.kazakago.cueue.model.AndroidPackage import com.kazakago.cueue.storage.StorageBucket -import io.ktor.server.application.* +import io.ktor.server.application.createApplicationPlugin val Firebase = createApplicationPlugin(name = "Firebase") { val environment = environment ?: throw IllegalStateException() diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/koin/KoinPlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/koin/KoinPlugin.kt index 5b24556..e9670d4 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/koin/KoinPlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/koin/KoinPlugin.kt @@ -1,6 +1,6 @@ package com.kazakago.cueue.config.koin -import io.ktor.server.application.* +import io.ktor.server.application.createApplicationPlugin import org.koin.core.KoinApplication import org.koin.core.context.startKoin diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/maintenance/MaintenancePlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/maintenance/MaintenancePlugin.kt index 59bd058..0271c0c 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/maintenance/MaintenancePlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/maintenance/MaintenancePlugin.kt @@ -1,10 +1,14 @@ package com.kazakago.cueue.config.maintenance -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.plugins.* -import io.ktor.server.response.* -import io.ktor.server.routing.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.createRouteScopedPlugin +import io.ktor.server.application.install +import io.ktor.server.plugins.origin +import io.ktor.server.response.respond +import io.ktor.server.routing.Route +import io.ktor.server.routing.RouteSelector +import io.ktor.server.routing.RouteSelectorEvaluation +import io.ktor.server.routing.RoutingResolveContext val Maintenance = createRouteScopedPlugin("Maintenance") { val environment = environment ?: throw IllegalStateException() diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/sentry/SentryPlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/sentry/SentryPlugin.kt index 171dcd5..04cae82 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/sentry/SentryPlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/sentry/SentryPlugin.kt @@ -1,6 +1,6 @@ package com.kazakago.cueue.config.sentry -import io.ktor.server.application.* +import io.ktor.server.application.createApplicationPlugin val Sentry = createApplicationPlugin(name = "Sentry") { val environment = environment ?: throw IllegalStateException() diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/statuspage/StatusPageHandler.kt b/server/src/main/kotlin/com/kazakago/cueue/config/statuspage/StatusPageHandler.kt index 4e152df..199c918 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/statuspage/StatusPageHandler.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/statuspage/StatusPageHandler.kt @@ -1,7 +1,7 @@ package com.kazakago.cueue.config.statuspage import com.kazakago.cueue.controller.ErrorController -import io.ktor.server.plugins.statuspages.* +import io.ktor.server.plugins.statuspages.StatusPagesConfig fun StatusPagesConfig.handle() { exception { call, cause -> diff --git a/server/src/main/kotlin/com/kazakago/cueue/config/version/VersionPlugin.kt b/server/src/main/kotlin/com/kazakago/cueue/config/version/VersionPlugin.kt index e289dff..364ba16 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/config/version/VersionPlugin.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/config/version/VersionPlugin.kt @@ -1,10 +1,14 @@ package com.kazakago.cueue.config.version import com.kazakago.cueue.model.MinApiVersion -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* -import io.ktor.server.routing.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.createRouteScopedPlugin +import io.ktor.server.application.install +import io.ktor.server.response.respond +import io.ktor.server.routing.Route +import io.ktor.server.routing.RouteSelector +import io.ktor.server.routing.RouteSelectorEvaluation +import io.ktor.server.routing.RoutingResolveContext val Version = createRouteScopedPlugin("Version") { onCall { call -> diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/CallbackController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/CallbackController.kt index 762cf4f..1c4521d 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/CallbackController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/CallbackController.kt @@ -1,8 +1,8 @@ package com.kazakago.cueue.controller import com.kazakago.cueue.model.AndroidPackage -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respondRedirect class CallbackController { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/ContentsController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/ContentsController.kt index 538607e..b8d7d5d 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/ContentsController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/ContentsController.kt @@ -4,9 +4,9 @@ import com.kazakago.cueue.model.ContentRegistration import com.kazakago.cueue.model.ContentSerializer import com.kazakago.cueue.model.DecodedImage import com.kazakago.cueue.repository.ContentRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class ContentsController(private val contentRepository: ContentRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/ErrorController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/ErrorController.kt index 19e2159..ba4a508 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/ErrorController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/ErrorController.kt @@ -2,10 +2,10 @@ package com.kazakago.cueue.controller import com.kazakago.cueue.exception.ImageDecodeException import com.kazakago.cueue.exception.UnauthorizedException -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.plugins.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.plugins.BadRequestException +import io.ktor.server.response.respond import io.sentry.Sentry import org.jetbrains.exposed.dao.exceptions.EntityNotFoundException diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationAcceptController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationAcceptController.kt index 0124c9e..7d89032 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationAcceptController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationAcceptController.kt @@ -4,9 +4,9 @@ import com.kazakago.cueue.model.FirebaseUser import com.kazakago.cueue.model.InvitationCode import com.kazakago.cueue.repository.InvitationRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class InvitationAcceptController(private val invitationRepository: InvitationRepository, private val userRepository: UserRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationController.kt index 278328b..9329b94 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationController.kt @@ -2,9 +2,9 @@ package com.kazakago.cueue.controller import com.kazakago.cueue.model.InvitationCode import com.kazakago.cueue.repository.InvitationRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class InvitationController(private val invitationRepository: InvitationRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationsController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationsController.kt index 1aef800..cf4f93f 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationsController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/InvitationsController.kt @@ -4,9 +4,9 @@ import com.kazakago.cueue.model.FirebaseUser import com.kazakago.cueue.model.InvitationCode import com.kazakago.cueue.repository.InvitationRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class InvitationsController(private val userRepository: UserRepository, private val invitationRepository: InvitationRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/MenuController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/MenuController.kt index da5b431..e133f25 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/MenuController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/MenuController.kt @@ -5,9 +5,9 @@ import com.kazakago.cueue.model.MenuId import com.kazakago.cueue.model.MenuRegistrationData import com.kazakago.cueue.repository.MenuRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class MenuController(private val userRepository: UserRepository, private val menuRepository: MenuRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/MenusController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/MenusController.kt index a6c1078..6a61431 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/MenusController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/MenusController.kt @@ -5,9 +5,9 @@ import com.kazakago.cueue.model.MenuId import com.kazakago.cueue.model.MenuRegistrationData import com.kazakago.cueue.repository.MenuRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class MenusController(private val userRepository: UserRepository, private val menuRepository: MenuRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/RecipeController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/RecipeController.kt index 19cb51b..2c3124e 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/RecipeController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/RecipeController.kt @@ -5,9 +5,9 @@ import com.kazakago.cueue.model.RecipeId import com.kazakago.cueue.model.RecipeRegistrationData import com.kazakago.cueue.repository.RecipeRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class RecipeController(private val userRepository: UserRepository, private val recipeRepository: RecipeRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/RecipesController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/RecipesController.kt index a654762..2323f96 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/RecipesController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/RecipesController.kt @@ -6,9 +6,9 @@ import com.kazakago.cueue.model.RecipeRegistrationData import com.kazakago.cueue.model.TagId import com.kazakago.cueue.repository.RecipeRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class RecipesController(private val userRepository: UserRepository, private val recipeRepository: RecipeRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/RootController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/RootController.kt index 9ae49f5..c263ba7 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/RootController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/RootController.kt @@ -1,7 +1,7 @@ package com.kazakago.cueue.controller -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class RootController { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/TagController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/TagController.kt index e37bef1..1a88f94 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/TagController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/TagController.kt @@ -5,9 +5,9 @@ import com.kazakago.cueue.model.TagId import com.kazakago.cueue.model.TagRegistrationData import com.kazakago.cueue.repository.TagRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class TagController(private val userRepository: UserRepository, private val tagRepository: TagRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/TagsController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/TagsController.kt index 3847385..d69b165 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/TagsController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/TagsController.kt @@ -5,9 +5,9 @@ import com.kazakago.cueue.model.TagRegistrationData import com.kazakago.cueue.model.TagSortRegistrationData import com.kazakago.cueue.repository.TagRepository import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class TagsController(private val userRepository: UserRepository, private val tagRepository: TagRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/UserController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/UserController.kt index ae7743d..0213187 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/UserController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/UserController.kt @@ -3,9 +3,9 @@ package com.kazakago.cueue.controller import com.kazakago.cueue.model.FirebaseUser import com.kazakago.cueue.model.UserRegistrationData import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class UserController(private val userRepository: UserRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/UsersController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/UsersController.kt index 5bba37f..36d7bc3 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/UsersController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/UsersController.kt @@ -3,9 +3,9 @@ package com.kazakago.cueue.controller import com.kazakago.cueue.model.FirebaseUser import com.kazakago.cueue.model.UserRegistrationData import com.kazakago.cueue.repository.UserRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class UsersController(private val userRepository: UserRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspaceController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspaceController.kt index 51b6d2c..a0e4211 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspaceController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspaceController.kt @@ -4,9 +4,9 @@ import com.kazakago.cueue.model.FirebaseUser import com.kazakago.cueue.model.WorkspaceRegistrationData import com.kazakago.cueue.repository.UserRepository import com.kazakago.cueue.repository.WorkspaceRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class WorkspaceController(private val userRepository: UserRepository, private val workspaceRepository: WorkspaceRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspacesController.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspacesController.kt index 58ba73b..d8db04d 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspacesController.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/WorkspacesController.kt @@ -4,9 +4,9 @@ import com.kazakago.cueue.model.FirebaseUser import com.kazakago.cueue.model.WorkspaceRegistrationData import com.kazakago.cueue.repository.UserRepository import com.kazakago.cueue.repository.WorkspaceRepository -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.response.respond class WorkspacesController(private val userRepository: UserRepository, private val workspaceRepository: WorkspaceRepository) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/controller/di/ControllerModules.kt b/server/src/main/kotlin/com/kazakago/cueue/controller/di/ControllerModules.kt index e8d0ccd..4389921 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/controller/di/ControllerModules.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/controller/di/ControllerModules.kt @@ -1,6 +1,21 @@ package com.kazakago.cueue.controller.di -import com.kazakago.cueue.controller.* +import com.kazakago.cueue.controller.CallbackController +import com.kazakago.cueue.controller.ContentsController +import com.kazakago.cueue.controller.InvitationAcceptController +import com.kazakago.cueue.controller.InvitationController +import com.kazakago.cueue.controller.InvitationsController +import com.kazakago.cueue.controller.MenuController +import com.kazakago.cueue.controller.MenusController +import com.kazakago.cueue.controller.RecipeController +import com.kazakago.cueue.controller.RecipesController +import com.kazakago.cueue.controller.RootController +import com.kazakago.cueue.controller.TagController +import com.kazakago.cueue.controller.TagsController +import com.kazakago.cueue.controller.UserController +import com.kazakago.cueue.controller.UsersController +import com.kazakago.cueue.controller.WorkspaceController +import com.kazakago.cueue.controller.WorkspacesController import org.koin.dsl.module val controllerModules = module { diff --git a/server/src/main/kotlin/com/kazakago/cueue/database/entity/WorkspaceEntity.kt b/server/src/main/kotlin/com/kazakago/cueue/database/entity/WorkspaceEntity.kt index 1fa9cf0..3b2670c 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/database/entity/WorkspaceEntity.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/database/entity/WorkspaceEntity.kt @@ -1,6 +1,10 @@ package com.kazakago.cueue.database.entity -import com.kazakago.cueue.database.table.* +import com.kazakago.cueue.database.table.MenusTable +import com.kazakago.cueue.database.table.RecipesTable +import com.kazakago.cueue.database.table.TagsTable +import com.kazakago.cueue.database.table.UsersTable +import com.kazakago.cueue.database.table.WorkspacesTable import org.jetbrains.exposed.dao.LongEntity import org.jetbrains.exposed.dao.LongEntityClass import org.jetbrains.exposed.dao.id.EntityID diff --git a/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuMapper.kt b/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuMapper.kt index a3e7764..b8d95ab 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuMapper.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuMapper.kt @@ -1,10 +1,8 @@ package com.kazakago.cueue.mapper import com.kazakago.cueue.database.entity.MenuEntity -import com.kazakago.cueue.database.table.RecipesTable import com.kazakago.cueue.model.Menu import com.kazakago.cueue.model.MenuId -import org.jetbrains.exposed.sql.SortOrder class MenuMapper(private val timeFrameMapper: TimeFrameMapper, private val recipeSummaryMapper: RecipeSummaryMapper) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuSummaryMapper.kt b/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuSummaryMapper.kt index baa54f9..ac777c5 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuSummaryMapper.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/mapper/MenuSummaryMapper.kt @@ -1,10 +1,8 @@ package com.kazakago.cueue.mapper import com.kazakago.cueue.database.entity.MenuEntity -import com.kazakago.cueue.database.table.RecipesTable import com.kazakago.cueue.model.MenuId import com.kazakago.cueue.model.MenuSummary -import org.jetbrains.exposed.sql.SortOrder class MenuSummaryMapper(private val timeFrameMapper: TimeFrameMapper, private val recipeSummaryMapper: RecipeSummaryMapper) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/mapper/di/MapperModules.kt b/server/src/main/kotlin/com/kazakago/cueue/mapper/di/MapperModules.kt index 066d26a..508108b 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/mapper/di/MapperModules.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/mapper/di/MapperModules.kt @@ -1,6 +1,15 @@ package com.kazakago.cueue.mapper.di -import com.kazakago.cueue.mapper.* +import com.kazakago.cueue.mapper.InvitationMapper +import com.kazakago.cueue.mapper.MenuMapper +import com.kazakago.cueue.mapper.MenuSummaryMapper +import com.kazakago.cueue.mapper.RecipeMapper +import com.kazakago.cueue.mapper.RecipeSummaryMapper +import com.kazakago.cueue.mapper.TagMapper +import com.kazakago.cueue.mapper.TimeFrameMapper +import com.kazakago.cueue.mapper.UserMapper +import com.kazakago.cueue.mapper.UserSummaryMapper +import com.kazakago.cueue.mapper.WorkspaceMapper import org.koin.dsl.module val mapperModules = module { diff --git a/server/src/main/kotlin/com/kazakago/cueue/model/DecodedImage.kt b/server/src/main/kotlin/com/kazakago/cueue/model/DecodedImage.kt index 0adf1bf..4190ff6 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/model/DecodedImage.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/model/DecodedImage.kt @@ -8,9 +8,14 @@ import java.awt.image.BufferedImage import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.InputStream -import java.util.* +import java.util.Base64 +import java.util.UUID import javax.imageio.ImageIO -import kotlin.math.* +import kotlin.math.abs +import kotlin.math.cos +import kotlin.math.floor +import kotlin.math.max +import kotlin.math.sin class DecodedImage(imageDataUri: String) : Content { diff --git a/server/src/main/kotlin/com/kazakago/cueue/model/FirebaseUser.kt b/server/src/main/kotlin/com/kazakago/cueue/model/FirebaseUser.kt index e4dd383..2265c28 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/model/FirebaseUser.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/model/FirebaseUser.kt @@ -1,6 +1,6 @@ package com.kazakago.cueue.model -import io.ktor.server.auth.* +import io.ktor.server.auth.Principal import java.net.URL data class FirebaseUser( diff --git a/server/src/main/kotlin/com/kazakago/cueue/model/Invitation.kt b/server/src/main/kotlin/com/kazakago/cueue/model/Invitation.kt index 5eead1a..c3129e2 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/model/Invitation.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/model/Invitation.kt @@ -1,6 +1,10 @@ package com.kazakago.cueue.model -import kotlinx.datetime.* +import kotlinx.datetime.Clock +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.TimeZone +import kotlinx.datetime.toInstant +import kotlinx.datetime.toLocalDateTime import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.Transient diff --git a/server/src/main/kotlin/com/kazakago/cueue/repository/MenuRepository.kt b/server/src/main/kotlin/com/kazakago/cueue/repository/MenuRepository.kt index 9b0b4c2..963713c 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/repository/MenuRepository.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/repository/MenuRepository.kt @@ -8,13 +8,23 @@ import com.kazakago.cueue.database.table.RecipesTable import com.kazakago.cueue.mapper.MenuMapper import com.kazakago.cueue.mapper.MenuSummaryMapper import com.kazakago.cueue.mapper.rawValue -import com.kazakago.cueue.model.* +import com.kazakago.cueue.model.Menu +import com.kazakago.cueue.model.MenuId +import com.kazakago.cueue.model.MenuRegistrationData +import com.kazakago.cueue.model.MenuSummary +import com.kazakago.cueue.model.TimeFrame +import com.kazakago.cueue.model.WorkspaceId import kotlinx.datetime.Clock import kotlinx.datetime.TimeZone import kotlinx.datetime.toLocalDateTime import org.jetbrains.exposed.dao.load import org.jetbrains.exposed.dao.with -import org.jetbrains.exposed.sql.* +import org.jetbrains.exposed.sql.Case +import org.jetbrains.exposed.sql.Expression +import org.jetbrains.exposed.sql.Op +import org.jetbrains.exposed.sql.SortOrder +import org.jetbrains.exposed.sql.and +import org.jetbrains.exposed.sql.intLiteral import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction class MenuRepository(private val menuMapper: MenuMapper, private val menuSummaryMapper: MenuSummaryMapper) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/repository/Offsetter.kt b/server/src/main/kotlin/com/kazakago/cueue/repository/Offsetter.kt index 47ae62c..f8da244 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/repository/Offsetter.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/repository/Offsetter.kt @@ -1,6 +1,6 @@ package com.kazakago.cueue.repository -import io.ktor.server.plugins.* +import io.ktor.server.plugins.MissingRequestParameterException import org.jetbrains.exposed.dao.Entity fun > Iterable.getOffset(afterId: ID?): Long { diff --git a/server/src/main/kotlin/com/kazakago/cueue/repository/RecipeRepository.kt b/server/src/main/kotlin/com/kazakago/cueue/repository/RecipeRepository.kt index f7ecd54..f29b20f 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/repository/RecipeRepository.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/repository/RecipeRepository.kt @@ -10,15 +10,24 @@ import com.kazakago.cueue.database.table.RecipesTable import com.kazakago.cueue.database.table.TagsTable import com.kazakago.cueue.mapper.RecipeMapper import com.kazakago.cueue.mapper.RecipeSummaryMapper -import com.kazakago.cueue.model.* +import com.kazakago.cueue.model.Recipe +import com.kazakago.cueue.model.RecipeId +import com.kazakago.cueue.model.RecipeRegistrationData +import com.kazakago.cueue.model.RecipeSummary +import com.kazakago.cueue.model.TagId +import com.kazakago.cueue.model.WorkspaceId import kotlinx.datetime.Clock import kotlinx.datetime.TimeZone import kotlinx.datetime.toLocalDateTime import org.jetbrains.exposed.dao.load import org.jetbrains.exposed.dao.with -import org.jetbrains.exposed.sql.* +import org.jetbrains.exposed.sql.ColumnSet +import org.jetbrains.exposed.sql.Op +import org.jetbrains.exposed.sql.SortOrder import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.jetbrains.exposed.sql.SqlExpressionBuilder.like +import org.jetbrains.exposed.sql.and +import org.jetbrains.exposed.sql.or import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction class RecipeRepository(private val recipeMapper: RecipeMapper, private val recipeSummaryMapper: RecipeSummaryMapper) { diff --git a/server/src/main/kotlin/com/kazakago/cueue/repository/TagRepository.kt b/server/src/main/kotlin/com/kazakago/cueue/repository/TagRepository.kt index 08957e1..7ee2dee 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/repository/TagRepository.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/repository/TagRepository.kt @@ -4,7 +4,11 @@ import com.kazakago.cueue.database.entity.TagEntity import com.kazakago.cueue.database.entity.WorkspaceEntity import com.kazakago.cueue.database.table.TagsTable import com.kazakago.cueue.mapper.TagMapper -import com.kazakago.cueue.model.* +import com.kazakago.cueue.model.Tag +import com.kazakago.cueue.model.TagId +import com.kazakago.cueue.model.TagRegistrationData +import com.kazakago.cueue.model.TagSortRegistrationData +import com.kazakago.cueue.model.WorkspaceId import kotlinx.datetime.Clock import kotlinx.datetime.TimeZone import kotlinx.datetime.toLocalDateTime diff --git a/server/src/main/kotlin/com/kazakago/cueue/repository/di/RepositoryModules.kt b/server/src/main/kotlin/com/kazakago/cueue/repository/di/RepositoryModules.kt index dee8503..1d064f2 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/repository/di/RepositoryModules.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/repository/di/RepositoryModules.kt @@ -1,6 +1,12 @@ package com.kazakago.cueue.repository.di -import com.kazakago.cueue.repository.* +import com.kazakago.cueue.repository.ContentRepository +import com.kazakago.cueue.repository.InvitationRepository +import com.kazakago.cueue.repository.MenuRepository +import com.kazakago.cueue.repository.RecipeRepository +import com.kazakago.cueue.repository.TagRepository +import com.kazakago.cueue.repository.UserRepository +import com.kazakago.cueue.repository.WorkspaceRepository import org.koin.dsl.module val repositoryModules = module { diff --git a/server/src/main/kotlin/com/kazakago/cueue/route/AppRouter.kt b/server/src/main/kotlin/com/kazakago/cueue/route/AppRouter.kt index 59acb9c..e5f0713 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/route/AppRouter.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/route/AppRouter.kt @@ -3,16 +3,38 @@ package com.kazakago.cueue.route import com.kazakago.cueue.config.koin.inject import com.kazakago.cueue.config.maintenance.maintenanceCheck import com.kazakago.cueue.config.version.versionCheck -import com.kazakago.cueue.controller.* +import com.kazakago.cueue.controller.CallbackController +import com.kazakago.cueue.controller.ContentsController +import com.kazakago.cueue.controller.InvitationAcceptController +import com.kazakago.cueue.controller.InvitationController +import com.kazakago.cueue.controller.InvitationsController +import com.kazakago.cueue.controller.MenuController +import com.kazakago.cueue.controller.MenusController +import com.kazakago.cueue.controller.RecipeController +import com.kazakago.cueue.controller.RecipesController +import com.kazakago.cueue.controller.RootController +import com.kazakago.cueue.controller.TagController +import com.kazakago.cueue.controller.TagsController +import com.kazakago.cueue.controller.UserController +import com.kazakago.cueue.controller.UsersController +import com.kazakago.cueue.controller.WorkspaceController +import com.kazakago.cueue.controller.WorkspacesController import com.kazakago.cueue.model.InvitationCode import com.kazakago.cueue.model.MenuId import com.kazakago.cueue.model.RecipeId import com.kazakago.cueue.model.TagId -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.auth.* -import io.ktor.server.request.* -import io.ktor.server.routing.* +import io.ktor.http.Parameters +import io.ktor.server.application.Application +import io.ktor.server.application.call +import io.ktor.server.auth.authenticate +import io.ktor.server.request.receiveText +import io.ktor.server.routing.delete +import io.ktor.server.routing.get +import io.ktor.server.routing.patch +import io.ktor.server.routing.post +import io.ktor.server.routing.put +import io.ktor.server.routing.route +import io.ktor.server.routing.routing fun Application.appRouting() { val rootController by inject() diff --git a/server/src/main/kotlin/com/kazakago/cueue/route/ApplicationCallExtension.kt b/server/src/main/kotlin/com/kazakago/cueue/route/ApplicationCallExtension.kt index 83aadc0..fae99ce 100644 --- a/server/src/main/kotlin/com/kazakago/cueue/route/ApplicationCallExtension.kt +++ b/server/src/main/kotlin/com/kazakago/cueue/route/ApplicationCallExtension.kt @@ -1,11 +1,13 @@ package com.kazakago.cueue.route import com.kazakago.cueue.exception.UnauthorizedException -import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.auth.* -import io.ktor.server.plugins.* -import io.ktor.server.request.* +import io.ktor.http.Parameters +import io.ktor.server.application.ApplicationCall +import io.ktor.server.auth.Principal +import io.ktor.server.auth.principal +import io.ktor.server.plugins.MissingRequestParameterException +import io.ktor.server.plugins.ParameterConversionException +import io.ktor.server.request.receive suspend inline fun ApplicationCall.requireReceive(): T { try {