Skip to content

Commit

Permalink
remove wildcard import
Browse files Browse the repository at this point in the history
  • Loading branch information
KazaKago committed Jan 5, 2024
1 parent 880ae36 commit a68f5ae
Show file tree
Hide file tree
Showing 43 changed files with 211 additions and 111 deletions.
19 changes: 10 additions & 9 deletions server/src/main/kotlin/com/kazakago/cueue/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Exception> { call, cause ->
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ->
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Loading

0 comments on commit a68f5ae

Please sign in to comment.