Skip to content

Commit

Permalink
optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvpm committed Mar 31, 2024
1 parent 9312297 commit bbf73cb
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 35 deletions.
8 changes: 4 additions & 4 deletions service/src/main/scala/com/github/mmvpm/service/Main.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.github.mmvpm.service

import cats.data.EitherT
import cats.effect.{ExitCode, IO, IOApp}
import cats.effect.std.Random
import cats.effect.{ExitCode, IO, IOApp}
import com.comcast.ip4s.{Host, Port}
import com.github.mmvpm.service.api.{AuthHandler, OfferHandler, UserHandler}
import com.github.mmvpm.service.dao.offer.{OfferDao, OfferDaoPostgresql}
import com.github.mmvpm.service.dao.session.{SessionDao, SessionDaoInMemory, SessionDaoRedis}
import com.github.mmvpm.service.dao.session.{SessionDao, SessionDaoRedis}
import com.github.mmvpm.service.dao.user.{UserDao, UserDaoPostgresql}
import com.github.mmvpm.service.dao.util.FlywayMigration
import com.github.mmvpm.service.dao.util.Postgresql.makeTransactor
Expand All @@ -15,13 +15,13 @@ import com.github.mmvpm.service.service.offer.{OfferService, OfferServiceImpl}
import com.github.mmvpm.service.service.user.{UserService, UserServiceImpl}
import com.redis.RedisClient
import doobie.Transactor
import org.http4s.HttpRoutes
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.server.Router
import org.http4s.HttpRoutes
import pureconfig.ConfigSource
import pureconfig.generic.auto._
import sttp.tapir.server.http4s.Http4sServerInterpreter
import sttp.tapir.server.ServerEndpoint
import sttp.tapir.server.http4s.Http4sServerInterpreter
import sttp.tapir.swagger.bundle.SwaggerInterpreter

object Main extends IOApp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package com.github.mmvpm.service.api

import cats.Monad
import com.github.mmvpm.model.Session
import com.github.mmvpm.service.api.request.SignUpRequest
import com.github.mmvpm.service.api.response.{SessionResponse, UserIdResponse, UserResponse}
import com.github.mmvpm.service.api.support.{ApiErrorSupport, AuthBasicSupport}
import com.github.mmvpm.service.api.util.CirceInstances._
import com.github.mmvpm.service.api.util.SchemaInstances._
import com.github.mmvpm.service.service.auth.AuthService
import com.github.mmvpm.service.service.user.UserService
import com.github.mmvpm.model.{Session, UserID}
import com.github.mmvpm.service.api.support.{ApiErrorSupport, AuthBasicSupport}
import sttp.model.headers.WWWAuthenticateChallenge
import sttp.tapir._
import sttp.tapir.json.circe._
import sttp.tapir.model.UsernamePassword
import sttp.tapir.server.ServerEndpoint

class AuthHandler[F[_]: Monad](override val authService: AuthService[F], userService: UserService[F])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.github.mmvpm.service.api

import cats.Functor
import com.github.mmvpm.model.UserID
import com.github.mmvpm.service.api.response.{OkResponse, UserResponse}
import com.github.mmvpm.service.api.support.{ApiErrorSupport, AuthSessionSupport}
import com.github.mmvpm.service.api.util.CirceInstances._
import com.github.mmvpm.service.api.util.SchemaInstances._
import com.github.mmvpm.service.service.auth.AuthService
import com.github.mmvpm.service.service.user.UserService
import com.github.mmvpm.model.UserID
import sttp.tapir._
import sttp.tapir.json.circe._
import sttp.tapir.server.ServerEndpoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.github.mmvpm.service.api

import com.github.mmvpm.model.{OfferID, Session, UserID}
import io.circe.Decoder.Result
import sttp.model.StatusCode
import sttp.tapir.{FieldName, Schema, SchemaType}
import sttp.tapir.SchemaType.{SInteger, SProduct, SProductField, SString}
import sttp.tapir.SchemaType.{SInteger, SProduct, SProductField}
import sttp.tapir.{FieldName, Schema}

package object error {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.mmvpm.service.api.support

import com.github.mmvpm.service.api.error._
import com.github.mmvpm.service.api.error.CirceInstances._
import com.github.mmvpm.service.api.error.SchemaInstances._
import com.github.mmvpm.service.api.error._
import sttp.model.StatusCode
import sttp.tapir._
import sttp.tapir.json.circe._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.github.mmvpm.model.UserID
import com.github.mmvpm.service.api.error.ApiError
import com.github.mmvpm.service.service.auth.AuthService
import sttp.model.headers.WWWAuthenticateChallenge
import sttp.tapir.{PublicEndpoint, auth}
import sttp.tapir.model.UsernamePassword
import sttp.tapir.server.PartialServerEndpoint
import sttp.tapir.{PublicEndpoint, auth}

trait AuthBasicSupport[F[_]] {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.github.mmvpm.service.api.SessionHeaderName
import com.github.mmvpm.service.api.error.ApiError
import com.github.mmvpm.service.service.auth.AuthService
import sttp.model.headers.WWWAuthenticateChallenge
import sttp.tapir.{Endpoint, PublicEndpoint, auth, header}
import sttp.tapir.server.PartialServerEndpoint
import sttp.tapir.{PublicEndpoint, auth, header}

trait AuthSessionSupport[F[_]] {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.mmvpm.service.api.util

import com.github.mmvpm.service.api.request._
import com.github.mmvpm.service.api.response._
import com.github.mmvpm.model._
import com.github.mmvpm.model.OfferStatus.OfferStatus
import com.github.mmvpm.model.UserStatus.UserStatus
import com.github.mmvpm.model._
import com.github.mmvpm.service.api.request._
import com.github.mmvpm.service.api.response._
import io.circe._
import io.circe.generic.semiauto._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.mmvpm.service.api.util

import com.github.mmvpm.service.api.request._
import com.github.mmvpm.service.api.response._
import com.github.mmvpm.model._
import com.github.mmvpm.model.OfferStatus.OfferStatus
import com.github.mmvpm.model.UserStatus.UserStatus
import com.github.mmvpm.model._
import com.github.mmvpm.service.api.request._
import com.github.mmvpm.service.api.response._
import sttp.tapir.Schema

object SchemaInstances {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.mmvpm.service.dao.session

import cats.data.EitherT
import cats.Applicative
import cats.data.EitherT
import cats.effect.Sync
import com.github.mmvpm.model.{Session, UserID}
import com.github.mmvpm.service.dao.error._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.github.mmvpm.service.dao.session

import cats.data.EitherT
import cats.effect.Sync
import com.github.mmvpm.service.dao.session.SessionDaoRedis._
import com.github.mmvpm.model.{Session, UserID}
import com.github.mmvpm.service.dao.error._
import com.github.mmvpm.service.dao.session.SessionDaoRedis._
import com.github.mmvpm.util.EitherUtils.safe
import com.github.mmvpm.util.Logging
import com.redis._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.mmvpm.service.service.auth

import cats.data.EitherT
import com.github.mmvpm.service.api.response.{SessionResponse, UserIdResponse}
import com.github.mmvpm.model.{Session, UserID}
import com.github.mmvpm.service.api.error.ApiError
import com.github.mmvpm.service.api.response.{SessionResponse, UserIdResponse}

trait AuthService[F[_]] {
def checkPassword(login: String, password: String): EitherT[F, ApiError, UserID]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
package com.github.mmvpm.service.service.auth

import cats.data.EitherT
import cats.{Functor, Monad}
import cats.effect.std.UUIDGen
import cats.effect.Clock
import cats.implicits.{catsSyntaxApplicativeId, toBifunctorOps}
import com.github.mmvpm.service.api.response.{SessionResponse, UserIdResponse}
import com.github.mmvpm.service.dao.session.SessionDao
import com.github.mmvpm.service.dao.user.UserDao
import cats.{Functor, Monad}
import com.github.mmvpm.model.{Session, UserID, UserStatus}
import com.github.mmvpm.service.api.error._
import com.github.mmvpm.service.api.response.{SessionResponse, UserIdResponse}
import com.github.mmvpm.service.dao.error._
import com.github.mmvpm.service.dao.session.SessionDao
import com.github.mmvpm.service.dao.user.UserDao
import com.github.mmvpm.service.service.auth.AuthServiceImpl.RichAuthResponse
import sttp.model.headers.CookieValueWithMeta

import java.time.Instant

class AuthServiceImpl[F[_]: Monad: UUIDGen](
userDao: UserDao[F],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.mmvpm.service.service.offer

import cats.data.EitherT
import com.github.mmvpm.service.api.request.{CreateOfferRequest, UpdateOfferRequest}
import com.github.mmvpm.service.api.response.{OfferResponse, OffersResponse, OkResponse}
import com.github.mmvpm.model.{OfferID, UserID}
import com.github.mmvpm.service.api.error.ApiError
import com.github.mmvpm.service.api.request.{CreateOfferRequest, UpdateOfferRequest}
import com.github.mmvpm.service.api.response.{OfferResponse, OffersResponse, OkResponse}

trait OfferService[F[_]] {
def getOffer(offerId: OfferID): EitherT[F, ApiError, OfferResponse]
Expand Down

0 comments on commit bbf73cb

Please sign in to comment.