From 7a6cb89e7b539f3344d297a2c2485dbc2e9ae354 Mon Sep 17 00:00:00 2001 From: yoshinorin Date: Wed, 29 Nov 2023 00:58:32 +0900 Subject: [PATCH] refactor: use `F[_]` instead of `M[_]` for Higher-Kinded Types --- .../yoshinorin/qualtet/auth/AuthService.scala | 2 +- .../qualtet/cache/CacheService.scala | 8 +++--- .../domains/archives/ArchiveRepository.scala | 4 +-- .../domains/archives/ArchiveService.scala | 8 +++--- .../domains/articles/ArticleRepository.scala | 8 +++--- .../domains/articles/ArticleService.scala | 8 +++--- .../domains/authors/AuthorRepository.scala | 12 ++++----- .../domains/authors/AuthorService.scala | 6 ++--- .../ContentSerializingRepository.scala | 18 ++++++------- .../ContentSerializingService.scala | 4 +-- .../ContentTaggingRepository.scala | 16 ++++++------ .../ContentTaggingService.scala | 6 ++--- .../contentTypes/ContentTypeRepository.scala | 8 +++--- .../contentTypes/ContentTypeService.scala | 6 ++--- .../domains/contents/ContentRepository.scala | 12 ++++----- .../domains/contents/ContentService.scala | 22 ++++++++-------- .../ExternalResourceRepository.scala | 8 +++--- .../ExternalResourceService.scala | 4 +-- .../qualtet/domains/feeds/FeedService.scala | 4 +-- .../domains/robots/RobotsRepository.scala | 6 ++--- .../domains/robots/RobotsService.scala | 4 +-- .../domains/search/SearchRepository.scala | 4 +-- .../domains/search/SearchService.scala | 6 ++--- .../domains/series/SeriesRepository.scala | 8 +++--- .../domains/series/SeriesService.scala | 8 +++--- .../domains/sitemaps/SitemapService.scala | 6 ++--- .../domains/sitemaps/SitemapsRepository.scala | 4 +-- .../qualtet/domains/tags/TagRepository.scala | 16 ++++++------ .../qualtet/domains/tags/TagService.scala | 8 +++--- .../qualtet/http/AuthProvider.scala | 4 +-- .../net/yoshinorin/qualtet/http/Router.scala | 26 +++++++++---------- .../qualtet/http/routes/ArchiveRoute.scala | 4 +-- .../qualtet/http/routes/ArticleRoute.scala | 4 +-- .../qualtet/http/routes/AuthRoute.scala | 2 +- .../qualtet/http/routes/AuthorRoute.scala | 4 +-- .../qualtet/http/routes/CacheRoute.scala | 6 ++--- .../qualtet/http/routes/ContentRoute.scala | 6 ++--- .../http/routes/ContentTypeRoute.scala | 4 +-- .../qualtet/http/routes/FeedRoute.scala | 4 +-- .../qualtet/http/routes/SearchRoute.scala | 4 +-- .../qualtet/http/routes/SeriesRoute.scala | 6 ++--- .../qualtet/http/routes/SitemapRoute.scala | 2 +- .../qualtet/http/routes/TagRoute.scala | 8 +++--- .../qualtet/infrastructure/db/Migrator.scala | 4 +-- .../infrastructure/db/Transactor.scala | 12 ++++----- .../yoshinorin/qualtet/fixture/Fixture.scala | 26 +++++++++---------- 46 files changed, 180 insertions(+), 180 deletions(-) diff --git a/src/main/scala/net/yoshinorin/qualtet/auth/AuthService.scala b/src/main/scala/net/yoshinorin/qualtet/auth/AuthService.scala index dec355dd..b5b9d627 100644 --- a/src/main/scala/net/yoshinorin/qualtet/auth/AuthService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/auth/AuthService.scala @@ -8,7 +8,7 @@ import net.yoshinorin.qualtet.message.Fail.{NotFound, Unauthorized} import net.yoshinorin.qualtet.syntax.* import org.slf4j.LoggerFactory -class AuthService[M[_]: Monad](authorService: AuthorService[M], jwt: Jwt) { +class AuthService[F[_]: Monad](authorService: AuthorService[F], jwt: Jwt) { private[this] val logger = LoggerFactory.getLogger(this.getClass) private[this] val bcryptPasswordEncoder = new BCryptPasswordEncoder() diff --git a/src/main/scala/net/yoshinorin/qualtet/cache/CacheService.scala b/src/main/scala/net/yoshinorin/qualtet/cache/CacheService.scala index e60b617b..b9ef0b0e 100644 --- a/src/main/scala/net/yoshinorin/qualtet/cache/CacheService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/cache/CacheService.scala @@ -7,10 +7,10 @@ import net.yoshinorin.qualtet.domains.contentTypes.ContentTypeService import net.yoshinorin.qualtet.domains.feeds.FeedService import org.slf4j.LoggerFactory -class CacheService[M[_]: Monad]( - sitemapService: SitemapService[M], - contentTypeService: ContentTypeService[M], - feedService: FeedService[M] +class CacheService[F[_]: Monad]( + sitemapService: SitemapService[F], + contentTypeService: ContentTypeService[F], + feedService: FeedService[F] ) { private[this] val logger = LoggerFactory.getLogger(this.getClass) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveRepository.scala index 157197c5..bc6528fa 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveRepository.scala @@ -2,6 +2,6 @@ package net.yoshinorin.qualtet.domains.archives import net.yoshinorin.qualtet.domains.contentTypes.ContentTypeId -trait ArchiveRepository[M[_]] { - def get(contentTypeId: ContentTypeId): M[Seq[ResponseArchive]] +trait ArchiveRepository[F[_]] { + def get(contentTypeId: ContentTypeId): F[Seq[ResponseArchive]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveService.scala index 4cfed3a6..eec3220a 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/archives/ArchiveService.scala @@ -10,10 +10,10 @@ import net.yoshinorin.qualtet.domains.contentTypes.ContentTypeId import net.yoshinorin.qualtet.syntax.* import cats.Monad -class ArchiveService[M[_]: Monad]( - archiveRepository: ArchiveRepository[M], - contentTypeService: ContentTypeService[M] -)(using transactor: Transactor[M]) { +class ArchiveService[F[_]: Monad]( + archiveRepository: ArchiveRepository[F], + contentTypeService: ContentTypeService[F] +)(using transactor: Transactor[F]) { def actions(contentTypeId: ContentTypeId): Action[Seq[ResponseArchive]] = { Continue(archiveRepository.get(contentTypeId), Action.done[Seq[ResponseArchive]]) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleRepository.scala index 40c1b4ec..98ed1b03 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleRepository.scala @@ -5,8 +5,8 @@ import net.yoshinorin.qualtet.domains.series.SeriesName import net.yoshinorin.qualtet.domains.tags.TagName import net.yoshinorin.qualtet.http.QueryParametersAliases.SqlParams -trait ArticleRepository[M[_]] { - def getWithCount(contentTypeId: ContentTypeId, sqlParams: SqlParams): M[Seq[(Int, ResponseArticle)]] - def findByTagNameWithCount(contentTypeId: ContentTypeId, tagName: TagName, sqlParams: SqlParams): M[Seq[(Int, ResponseArticle)]] - def findBySeriesNameWithCount(contentTypeId: ContentTypeId, seriesName: SeriesName): M[Seq[(Int, ResponseArticle)]] +trait ArticleRepository[F[_]] { + def getWithCount(contentTypeId: ContentTypeId, sqlParams: SqlParams): F[Seq[(Int, ResponseArticle)]] + def findByTagNameWithCount(contentTypeId: ContentTypeId, tagName: TagName, sqlParams: SqlParams): F[Seq[(Int, ResponseArticle)]] + def findBySeriesNameWithCount(contentTypeId: ContentTypeId, seriesName: SeriesName): F[Seq[(Int, ResponseArticle)]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleService.scala index 3bae65a8..fd6d403e 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/articles/ArticleService.scala @@ -12,10 +12,10 @@ import net.yoshinorin.qualtet.http.ArticlesQueryParameter import net.yoshinorin.qualtet.infrastructure.db.Transactor import net.yoshinorin.qualtet.syntax.* -class ArticleService[M[_]: Monad]( - articleRepository: ArticleRepository[M], - contentTypeService: ContentTypeService[M] -)(using transactor: Transactor[M]) { +class ArticleService[F[_]: Monad]( + articleRepository: ArticleRepository[F], + contentTypeService: ContentTypeService[F] +)(using transactor: Transactor[F]) { def actions( contentTypeId: ContentTypeId, diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorRepository.scala index 964eaf4b..4532b38e 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorRepository.scala @@ -1,13 +1,13 @@ package net.yoshinorin.qualtet.domains.authors -trait AuthorRepository[M[_]] { +trait AuthorRepository[F[_]] { /** * get all Author * * @return Authors */ - def getAll(): M[Seq[ResponseAuthor]] + def getAll(): F[Seq[ResponseAuthor]] /** * create a authorName @@ -15,7 +15,7 @@ trait AuthorRepository[M[_]] { * @param data Instance of Author * @return dummy long id (Doobie return Int) */ - def upsert(data: Author): M[Int] + def upsert(data: Author): F[Int] /** * find a Author by id @@ -23,7 +23,7 @@ trait AuthorRepository[M[_]] { * @param id authorName's id * @return Author */ - def findById(id: AuthorId): M[Option[ResponseAuthor]] + def findById(id: AuthorId): F[Option[ResponseAuthor]] /** * find a Author by id @@ -31,7 +31,7 @@ trait AuthorRepository[M[_]] { * @param id authorName's id * @return Author */ - def findByIdWithPassword(id: AuthorId): M[Option[Author]] + def findByIdWithPassword(id: AuthorId): F[Option[Author]] /** * find a Author by name @@ -39,5 +39,5 @@ trait AuthorRepository[M[_]] { * @param name authorName's name * @return Author */ - def findByName(name: AuthorName): M[Option[ResponseAuthor]] + def findByName(name: AuthorName): F[Option[ResponseAuthor]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorService.scala index ede0a925..bec6b9cd 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/authors/AuthorService.scala @@ -8,9 +8,9 @@ import net.yoshinorin.qualtet.actions.Action.* import net.yoshinorin.qualtet.actions.{Action, Continue} import net.yoshinorin.qualtet.syntax.* -class AuthorService[M[_]: Monad]( - authorRepository: AuthorRepository[M] -)(using transactor: Transactor[M]) { +class AuthorService[F[_]: Monad]( + authorRepository: AuthorRepository[F] +)(using transactor: Transactor[F]) { def upsertActions(data: Author): Action[Int] = { Continue(authorRepository.upsert(data), Action.done[Int]) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingRepository.scala index 854d3f7f..51d57622 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingRepository.scala @@ -3,14 +3,14 @@ package net.yoshinorin.qualtet.domains.contentSerializing import net.yoshinorin.qualtet.domains.contents.ContentId import net.yoshinorin.qualtet.domains.series.SeriesId -trait ContentSerializingRepository[M[_]] { - def upsert(data: ContentSerializing): M[Int] - def bulkUpsert(data: List[ContentSerializing]): M[Int] - def findBySeriesId(id: SeriesId): M[Seq[ContentSerializing]] - def deleteBySeriesId(id: SeriesId): M[Unit] - def deleteByContentId(id: ContentId): M[Unit] - def delete(seriesId: SeriesId, contentIds: Seq[ContentId]): M[Unit] +trait ContentSerializingRepository[F[_]] { + def upsert(data: ContentSerializing): F[Int] + def bulkUpsert(data: List[ContentSerializing]): F[Int] + def findBySeriesId(id: SeriesId): F[Seq[ContentSerializing]] + def deleteBySeriesId(id: SeriesId): F[Unit] + def deleteByContentId(id: ContentId): F[Unit] + def delete(seriesId: SeriesId, contentIds: Seq[ContentId]): F[Unit] // TODO: generics - def fakeRequestInt: M[Int] - def fakeRequestUnit: M[Unit] + def fakeRequestInt: F[Int] + def fakeRequestUnit: F[Unit] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingService.scala index 8af8e689..33064209 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingService.scala @@ -6,8 +6,8 @@ import net.yoshinorin.qualtet.actions.{Action, Continue} import net.yoshinorin.qualtet.domains.contents.ContentId import net.yoshinorin.qualtet.domains.series.SeriesId -class ContentSerializingService[M[_]: Monad]( - contentSerializingRepository: ContentSerializingRepository[M] +class ContentSerializingService[F[_]: Monad]( + contentSerializingRepository: ContentSerializingRepository[F] ) { def findBySeriesIdActions(id: SeriesId): Action[Seq[ContentSerializing]] = { diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingRepository.scala index 8b634086..d9abe111 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingRepository.scala @@ -3,13 +3,13 @@ package net.yoshinorin.qualtet.domains.contentTaggings import net.yoshinorin.qualtet.domains.contents.ContentId import net.yoshinorin.qualtet.domains.tags.TagId -trait ContentTaggingRepository[M[_]] { - def bulkUpsert(data: List[ContentTagging]): M[Int] - def findByTagId(id: TagId): M[Seq[ContentTagging]] - def deleteByContentId(id: ContentId): M[Unit] - def deleteByTagId(id: TagId): M[Unit] - def delete(contentId: ContentId, tagIds: Seq[TagId]): M[Unit] +trait ContentTaggingRepository[F[_]] { + def bulkUpsert(data: List[ContentTagging]): F[Int] + def findByTagId(id: TagId): F[Seq[ContentTagging]] + def deleteByContentId(id: ContentId): F[Unit] + def deleteByTagId(id: TagId): F[Unit] + def delete(contentId: ContentId, tagIds: Seq[TagId]): F[Unit] // TODO: generics - def fakeRequestInt: M[Int] - def fakeRequestUnit: M[Unit] + def fakeRequestInt: F[Int] + def fakeRequestUnit: F[Unit] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingService.scala index 7e8453d2..c1190d8e 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingService.scala @@ -8,9 +8,9 @@ import net.yoshinorin.qualtet.domains.contents.ContentId import net.yoshinorin.qualtet.domains.tags.TagId import net.yoshinorin.qualtet.infrastructure.db.Transactor -class ContentTaggingService[M[_]: Monad]( - contentTaggingRepository: ContentTaggingRepository[M] -)(using transactor: Transactor[M]) { +class ContentTaggingService[F[_]: Monad]( + contentTaggingRepository: ContentTaggingRepository[F] +)(using transactor: Transactor[F]) { def findByTagIdActions(id: TagId): Action[Seq[ContentTagging]] = { Continue(contentTaggingRepository.findByTagId(id), Action.done[Seq[ContentTagging]]) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeRepository.scala index 464f7bc5..a7542731 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeRepository.scala @@ -1,7 +1,7 @@ package net.yoshinorin.qualtet.domains.contentTypes -trait ContentTypeRepository[M[_]] { - def upsert(data: ContentType): M[Int] - def getAll(): M[Seq[ContentType]] - def findByName(name: String): M[Option[ContentType]] +trait ContentTypeRepository[F[_]] { + def upsert(data: ContentType): F[Int] + def getAll(): F[Seq[ContentType]] + def findByName(name: String): F[Option[ContentType]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeService.scala index 03f4616d..f110b2fc 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contentTypes/ContentTypeService.scala @@ -10,10 +10,10 @@ import net.yoshinorin.qualtet.domains.Cacheable import net.yoshinorin.qualtet.infrastructure.db.Transactor import net.yoshinorin.qualtet.syntax.* -class ContentTypeService[M[_]: Monad]( - contentRepository: ContentTypeRepository[M], +class ContentTypeService[F[_]: Monad]( + contentRepository: ContentTypeRepository[F], cache: CacheModule[String, ContentType] -)(using transactor: Transactor[M]) +)(using transactor: Transactor[F]) extends Cacheable { def upsertActions(data: ContentType): Action[Int] = { diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentRepository.scala index b724d8d2..6c856259 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentRepository.scala @@ -2,10 +2,10 @@ package net.yoshinorin.qualtet.domains.contents import net.yoshinorin.qualtet.domains.contents.{ContentId, Path} -trait ContentRepository[M[_]] { - def upsert(data: Content): M[Int] - def findById(id: ContentId): M[Option[Content]] - def findByPath(path: Path): M[Option[Content]] - def findByPathWithMeta(path: Path): M[Option[ResponseContentDbRow]] - def delete(id: ContentId): M[Unit] +trait ContentRepository[F[_]] { + def upsert(data: Content): F[Int] + def findById(id: ContentId): F[Option[Content]] + def findByPath(path: Path): F[Option[Content]] + def findByPathWithMeta(path: Path): F[Option[ResponseContentDbRow]] + def delete(id: ContentId): F[Unit] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentService.scala index 1a83a374..f143e8a2 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/contents/ContentService.scala @@ -17,18 +17,18 @@ import net.yoshinorin.qualtet.domains.series.{Series, SeriesName, SeriesService} import net.yoshinorin.qualtet.infrastructure.db.Transactor import net.yoshinorin.qualtet.syntax.* -class ContentService[M[_]: Monad]( - contentRepository: ContentRepository[M], - tagService: TagService[M], - contentTaggingService: ContentTaggingService[M], - robotsService: RobotsService[M], - externalResourceService: ExternalResourceService[M], - authorService: AuthorService[M], - contentTypeService: ContentTypeService[M], - seriesService: SeriesService[M], - contentSerializingService: ContentSerializingService[M] +class ContentService[F[_]: Monad]( + contentRepository: ContentRepository[F], + tagService: TagService[F], + contentTaggingService: ContentTaggingService[F], + robotsService: RobotsService[F], + externalResourceService: ExternalResourceService[F], + authorService: AuthorService[F], + contentTypeService: ContentTypeService[F], + seriesService: SeriesService[F], + contentSerializingService: ContentSerializingService[F] )(using - transactor: Transactor[M] + transactor: Transactor[F] ) { def upsertActions(data: Content): Action[Int] = { diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceRepository.scala index 69cced1d..9da474ec 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceRepository.scala @@ -2,8 +2,8 @@ package net.yoshinorin.qualtet.domains.externalResources import net.yoshinorin.qualtet.domains.contents.ContentId -trait ExternalResourceRepository[M[_]] { - def bulkUpsert(data: List[ExternalResource]): M[Int] - def delete(contentId: ContentId): M[Unit] - def fakeRequest(): M[Int] +trait ExternalResourceRepository[F[_]] { + def bulkUpsert(data: List[ExternalResource]): F[Int] + def delete(contentId: ContentId): F[Unit] + def fakeRequest(): F[Int] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceService.scala index 0a656a81..a4395b73 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/externalResources/ExternalResourceService.scala @@ -4,8 +4,8 @@ import cats.Monad import net.yoshinorin.qualtet.actions.{Action, Continue} import net.yoshinorin.qualtet.domains.contents.ContentId -class ExternalResourceService[M[_]: Monad]( - externalResourceRepository: ExternalResourceRepository[M] +class ExternalResourceService[F[_]: Monad]( + externalResourceRepository: ExternalResourceRepository[F] ) { def bulkUpsertActions(data: List[ExternalResource]): Action[Int] = { diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/feeds/FeedService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/feeds/FeedService.scala index ac73c679..cbe2cef3 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/feeds/FeedService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/feeds/FeedService.scala @@ -8,9 +8,9 @@ import net.yoshinorin.qualtet.http.ArticlesQueryParameter import net.yoshinorin.qualtet.domains.articles.ResponseArticleWithCount import net.yoshinorin.qualtet.domains.Cacheable -class FeedService[M[_]: Monad]( +class FeedService[F[_]: Monad]( cache: CacheModule[String, ResponseArticleWithCount], - articleService: ArticleService[M] + articleService: ArticleService[F] ) extends Cacheable { private val cacheKey = "feed-full-cache" diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsRepository.scala index 880fc55a..3907518c 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsRepository.scala @@ -2,7 +2,7 @@ package net.yoshinorin.qualtet.domains.robots import net.yoshinorin.qualtet.domains.contents.ContentId -trait RobotsRepository[M[_]] { - def upsert(data: Robots): M[Int] - def delete(contentId: ContentId): M[Unit] +trait RobotsRepository[F[_]] { + def upsert(data: Robots): F[Int] + def delete(contentId: ContentId): F[Unit] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsService.scala index 10b55635..8483867e 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/robots/RobotsService.scala @@ -4,8 +4,8 @@ import cats.Monad import net.yoshinorin.qualtet.actions.{Action, Continue} import net.yoshinorin.qualtet.domains.contents.ContentId -class RobotsService[M[_]: Monad]( - robotsRepository: RobotsRepository[M] +class RobotsService[F[_]: Monad]( + robotsRepository: RobotsRepository[F] ) { def upsertActions(data: Robots): Action[Int] = { Continue(robotsRepository.upsert(data), Action.done[Int]) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchRepository.scala index 9d2300c6..d12470d9 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchRepository.scala @@ -1,5 +1,5 @@ package net.yoshinorin.qualtet.domains.search -trait SearchRepository[M[_]] { - def search(query: List[String]): M[Seq[(Int, ResponseSearch)]] +trait SearchRepository[F[_]] { + def search(query: List[String]): F[Seq[(Int, ResponseSearch)]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchService.scala index 17b54532..38fbdd80 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/search/SearchService.scala @@ -13,10 +13,10 @@ import net.yoshinorin.qualtet.syntax.* import scala.annotation.tailrec -class SearchService[M[_]: Monad]( +class SearchService[F[_]: Monad]( searchConfig: SearchConfig, - searchRepository: SearchRepository[M] -)(using transactor: Transactor[M]) { + searchRepository: SearchRepository[F] +)(using transactor: Transactor[F]) { def actions(query: List[String]): Action[Seq[(Int, ResponseSearch)]] = { Continue(searchRepository.search(query), Action.done[Seq[(Int, ResponseSearch)]]) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesRepository.scala index c71603fc..a3526c91 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesRepository.scala @@ -1,7 +1,7 @@ package net.yoshinorin.qualtet.domains.series -trait SeriesRepository[M[_]] { - def upsert(data: Series): M[Int] - def findByName(name: SeriesName): M[Option[Series]] - def getAll(): M[Seq[Series]] +trait SeriesRepository[F[_]] { + def upsert(data: Series): F[Int] + def findByName(name: SeriesName): F[Option[Series]] + def getAll(): F[Seq[Series]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesService.scala index 6ec20710..db5b9ada 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/series/SeriesService.scala @@ -10,10 +10,10 @@ import net.yoshinorin.qualtet.message.Fail.NotFound import net.yoshinorin.qualtet.syntax.* import wvlet.airframe.ulid.ULID -class SeriesService[M[_]: Monad]( - seriesRepository: SeriesRepository[M], - articleService: ArticleService[M] -)(using transactor: Transactor[M]) { +class SeriesService[F[_]: Monad]( + seriesRepository: SeriesRepository[F], + articleService: ArticleService[F] +)(using transactor: Transactor[F]) { def upsertActions(data: Series): Action[Int] = { Continue(seriesRepository.upsert(data), Action.done[Int]) diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapService.scala index a86a0500..3016e2cd 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapService.scala @@ -8,10 +8,10 @@ import net.yoshinorin.qualtet.cache.CacheModule import net.yoshinorin.qualtet.infrastructure.db.Transactor import net.yoshinorin.qualtet.domains.Cacheable -class SitemapService[M[_]: Monad]( - sitemapRepository: SitemapsRepository[M], +class SitemapService[F[_]: Monad]( + sitemapRepository: SitemapsRepository[F], cache: CacheModule[String, Seq[Url]] -)(using transactor: Transactor[M]) +)(using transactor: Transactor[F]) extends Cacheable { private val cacheKey = "sitemaps-full-cache" diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapsRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapsRepository.scala index 10c5aa24..4a4f6abe 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapsRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/sitemaps/SitemapsRepository.scala @@ -1,5 +1,5 @@ package net.yoshinorin.qualtet.domains.sitemaps -trait SitemapsRepository[M[_]] { - def get(): M[Seq[Url]] +trait SitemapsRepository[F[_]] { + def get(): F[Seq[Url]] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagRepository.scala b/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagRepository.scala index 21e24a5f..a5365e40 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagRepository.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagRepository.scala @@ -2,12 +2,12 @@ package net.yoshinorin.qualtet.domains.tags import net.yoshinorin.qualtet.domains.contents.ContentId -trait TagRepository[M[_]] { - def bulkUpsert(data: List[Tag]): M[Int] - def getAll(): M[Seq[ResponseTag]] - def findById(id: TagId): M[Option[Tag]] - def findByName(id: TagName): M[Option[Tag]] - def findByContentId(conetntId: ContentId): M[Seq[Tag]] - def delete(id: TagId): M[Unit] - def fakeRequest(): M[Int] +trait TagRepository[F[_]] { + def bulkUpsert(data: List[Tag]): F[Int] + def getAll(): F[Seq[ResponseTag]] + def findById(id: TagId): F[Option[Tag]] + def findByName(id: TagName): F[Option[Tag]] + def findByContentId(conetntId: ContentId): F[Seq[Tag]] + def delete(id: TagId): F[Unit] + def fakeRequest(): F[Int] } diff --git a/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagService.scala b/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagService.scala index 1eefcb52..567ec9ce 100644 --- a/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagService.scala +++ b/src/main/scala/net/yoshinorin/qualtet/domains/tags/TagService.scala @@ -11,10 +11,10 @@ import net.yoshinorin.qualtet.message.Fail.NotFound import net.yoshinorin.qualtet.domains.contents.ContentId import net.yoshinorin.qualtet.syntax.* -class TagService[M[_]: Monad]( - tagRepository: TagRepository[M], - contentTaggingService: ContentTaggingService[M] -)(using transactor: Transactor[M]) { +class TagService[F[_]: Monad]( + tagRepository: TagRepository[F], + contentTaggingService: ContentTaggingService[F] +)(using transactor: Transactor[F]) { def bulkUpsertActions(data: Option[List[Tag]]): Action[Int] = { data match { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/AuthProvider.scala b/src/main/scala/net/yoshinorin/qualtet/http/AuthProvider.scala index 79b59b3b..0fcb6b91 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/AuthProvider.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/AuthProvider.scala @@ -14,8 +14,8 @@ import net.yoshinorin.qualtet.message.Fail import net.yoshinorin.qualtet.message.Fail.{NotFound, Unauthorized} import net.yoshinorin.qualtet.syntax.* -class AuthProvider[M[_]: Monad]( - authService: AuthService[M] +class AuthProvider[F[_]: Monad]( + authService: AuthService[F] ) { private[this] val logger = LoggerFactory.getLogger(this.getClass) diff --git a/src/main/scala/net/yoshinorin/qualtet/http/Router.scala b/src/main/scala/net/yoshinorin/qualtet/http/Router.scala index 56c9ca48..62b8b491 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/Router.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/Router.scala @@ -19,22 +19,22 @@ import net.yoshinorin.qualtet.http.routes.{ TagRoute } -class Router[M[_]: Monad]( +class Router[F[_]: Monad]( corsProvider: CorsProvider, - archiveRoute: ArchiveRoute[M], - articleRoute: ArticleRoute[M], - authorRoute: AuthorRoute[M], - authRoute: AuthRoute[M], - cacheRoute: CacheRoute[M], - contentRoute: ContentRoute[M], - contentTypeRoute: ContentTypeRoute[M], - feedRoute: FeedRoute[M], + archiveRoute: ArchiveRoute[F], + articleRoute: ArticleRoute[F], + authorRoute: AuthorRoute[F], + authRoute: AuthRoute[F], + cacheRoute: CacheRoute[F], + contentRoute: ContentRoute[F], + contentTypeRoute: ContentTypeRoute[F], + feedRoute: FeedRoute[F], homeRoute: HomeRoute, - searchRoute: SearchRoute[M], - seriesRoute: SeriesRoute[M], - sitemapRoute: SitemapRoute[M], + searchRoute: SearchRoute[F], + seriesRoute: SeriesRoute[F], + sitemapRoute: SitemapRoute[F], systemRoute: SystemRoute, - tagRoute: TagRoute[M] + tagRoute: TagRoute[F] ) { def withCors = corsProvider.httpRouter(routes) diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/ArchiveRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/ArchiveRoute.scala index 497d85d7..4254a9d1 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/ArchiveRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/ArchiveRoute.scala @@ -9,8 +9,8 @@ import net.yoshinorin.qualtet.domains.archives.ArchiveService import net.yoshinorin.qualtet.http.MethodNotAllowedSupport import net.yoshinorin.qualtet.syntax.* -class ArchiveRoute[M[_]: Monad]( - archiveService: ArchiveService[M] +class ArchiveRoute[F[_]: Monad]( + archiveService: ArchiveService[F] ) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/ArticleRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/ArticleRoute.scala index 8957ada3..f5c2cec8 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/ArticleRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/ArticleRoute.scala @@ -9,8 +9,8 @@ import net.yoshinorin.qualtet.domains.articles.ArticleService import net.yoshinorin.qualtet.http.{ArticlesQueryParameter, MethodNotAllowedSupport} import net.yoshinorin.qualtet.syntax.* -class ArticleRoute[M[_]: Monad]( - articleService: ArticleService[M] +class ArticleRoute[F[_]: Monad]( + articleService: ArticleService[F] ) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthRoute.scala index 70c81fd3..f8cbdff0 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthRoute.scala @@ -9,7 +9,7 @@ import net.yoshinorin.qualtet.auth.{AuthService, RequestToken} import net.yoshinorin.qualtet.http.{MethodNotAllowedSupport, RequestDecoder} import net.yoshinorin.qualtet.syntax.* -class AuthRoute[M[_]: Monad](authService: AuthService[M]) extends RequestDecoder with MethodNotAllowedSupport { +class AuthRoute[F[_]: Monad](authService: AuthService[F]) extends RequestDecoder with MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { case request @ POST -> Root => this.post(request) diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthorRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthorRoute.scala index abbdcc7c..aa0bc6b4 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthorRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/AuthorRoute.scala @@ -9,8 +9,8 @@ import net.yoshinorin.qualtet.domains.authors.{AuthorName, AuthorService} import net.yoshinorin.qualtet.syntax.* import net.yoshinorin.qualtet.http.MethodNotAllowedSupport -class AuthorRoute[M[_]: Monad]( - authorService: AuthorService[M] +class AuthorRoute[F[_]: Monad]( + authorService: AuthorService[F] ) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/CacheRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/CacheRoute.scala index 11998344..4f090a3a 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/CacheRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/CacheRoute.scala @@ -9,9 +9,9 @@ import net.yoshinorin.qualtet.domains.authors.ResponseAuthor import net.yoshinorin.qualtet.cache.CacheService import net.yoshinorin.qualtet.http.{AuthProvider, MethodNotAllowedSupport} -class CacheRoute[M[_]: Monad]( - authProvider: AuthProvider[M], - cacheService: CacheService[M] +class CacheRoute[F[_]: Monad]( + authProvider: AuthProvider[F], + cacheService: CacheService[F] ) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = authProvider.authenticate(AuthedRoutes.of { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentRoute.scala index 3d01104e..be1b3139 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentRoute.scala @@ -13,9 +13,9 @@ import net.yoshinorin.qualtet.http.{AuthProvider, RequestDecoder} import net.yoshinorin.qualtet.syntax.* import net.yoshinorin.qualtet.http.MethodNotAllowedSupport -class ContentRoute[M[_]: Monad]( - authProvider: AuthProvider[M], - contentService: ContentService[M] +class ContentRoute[F[_]: Monad]( + authProvider: AuthProvider[F], + contentService: ContentService[F] ) extends RequestDecoder with MethodNotAllowedSupport { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentTypeRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentTypeRoute.scala index 6d3abf05..260dd889 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentTypeRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/ContentTypeRoute.scala @@ -9,8 +9,8 @@ import net.yoshinorin.qualtet.domains.contentTypes.ContentTypeService import net.yoshinorin.qualtet.http.MethodNotAllowedSupport import net.yoshinorin.qualtet.syntax.* -class ContentTypeRoute[M[_]: Monad]( - contentTypeService: ContentTypeService[M] +class ContentTypeRoute[F[_]: Monad]( + contentTypeService: ContentTypeService[F] ) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/FeedRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/FeedRoute.scala index 5878db50..e8a10396 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/FeedRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/FeedRoute.scala @@ -10,8 +10,8 @@ import net.yoshinorin.qualtet.domains.feeds.FeedService import net.yoshinorin.qualtet.syntax.* import net.yoshinorin.qualtet.http.MethodNotAllowedSupport -class FeedRoute[M[_]: Monad]( - feedService: FeedService[M] +class FeedRoute[F[_]: Monad]( + feedService: FeedService[F] ) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/SearchRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/SearchRoute.scala index 392d2cda..5060a0ae 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/SearchRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/SearchRoute.scala @@ -10,8 +10,8 @@ import net.yoshinorin.qualtet.domains.search.SearchService import net.yoshinorin.qualtet.syntax.* import net.yoshinorin.qualtet.http.MethodNotAllowedSupport -class SearchRoute[M[_]: Monad]( - searchService: SearchService[M] +class SearchRoute[F[_]: Monad]( + searchService: SearchService[F] ) extends MethodNotAllowedSupport { private[this] val logger = LoggerFactory.getLogger(this.getClass) diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/SeriesRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/SeriesRoute.scala index 4c3ca10c..c0e977aa 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/SeriesRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/SeriesRoute.scala @@ -11,9 +11,9 @@ import net.yoshinorin.qualtet.domains.series.{Series, SeriesName, SeriesService, import net.yoshinorin.qualtet.http.{AuthProvider, MethodNotAllowedSupport, RequestDecoder} import net.yoshinorin.qualtet.syntax.* -class SeriesRoute[M[_]: Monad]( - authProvider: AuthProvider[M], - seriesService: SeriesService[M] +class SeriesRoute[F[_]: Monad]( + authProvider: AuthProvider[F], + seriesService: SeriesService[F] ) extends RequestDecoder with MethodNotAllowedSupport { diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/SitemapRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/SitemapRoute.scala index 7039fae0..c73adb13 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/SitemapRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/SitemapRoute.scala @@ -9,7 +9,7 @@ import net.yoshinorin.qualtet.domains.sitemaps.SitemapService import net.yoshinorin.qualtet.syntax.* import net.yoshinorin.qualtet.http.MethodNotAllowedSupport -class SitemapRoute[M[_]: Monad](sitemapService: SitemapService[M]) extends MethodNotAllowedSupport { +class SitemapRoute[F[_]: Monad](sitemapService: SitemapService[F]) extends MethodNotAllowedSupport { private[http] def index: HttpRoutes[IO] = HttpRoutes.of[IO] { case GET -> Root => this.get diff --git a/src/main/scala/net/yoshinorin/qualtet/http/routes/TagRoute.scala b/src/main/scala/net/yoshinorin/qualtet/http/routes/TagRoute.scala index c100337c..39dfe094 100644 --- a/src/main/scala/net/yoshinorin/qualtet/http/routes/TagRoute.scala +++ b/src/main/scala/net/yoshinorin/qualtet/http/routes/TagRoute.scala @@ -13,10 +13,10 @@ import net.yoshinorin.qualtet.domains.tags.{TagId, TagName, TagService} import net.yoshinorin.qualtet.http.{ArticlesQueryParameter, AuthProvider, MethodNotAllowedSupport} import net.yoshinorin.qualtet.syntax.* -class TagRoute[M[_]: Monad]( - authProvider: AuthProvider[M], - tagService: TagService[M], - articleService: ArticleService[M] +class TagRoute[F[_]: Monad]( + authProvider: AuthProvider[F], + tagService: TagService[F], + articleService: ArticleService[F] ) extends MethodNotAllowedSupport { private[this] val logger = LoggerFactory.getLogger(this.getClass) diff --git a/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Migrator.scala b/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Migrator.scala index c8de04a7..9853dd22 100644 --- a/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Migrator.scala +++ b/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Migrator.scala @@ -15,7 +15,7 @@ class Migrator(config: DBConfig) { /** * Do migration */ - def migrate[M[_]: Monad](contentTypeService: ContentTypeService[M]): Unit = { + def migrate[F[_]: Monad](contentTypeService: ContentTypeService[F]): Unit = { val _ = flyway.migrate() (for { _ <- contentTypeService.create(ContentType(name = "article")) @@ -35,7 +35,7 @@ class Migrator(config: DBConfig) { * DROP all tables and re-create * NOTE: for development */ - def recrate[M[_]: Monad](contentTypeService: ContentTypeService[M]): Unit = { + def recrate[F[_]: Monad](contentTypeService: ContentTypeService[F]): Unit = { this.clean() this.migrate(contentTypeService) } diff --git a/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Transactor.scala b/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Transactor.scala index f10a70a1..19856a71 100644 --- a/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Transactor.scala +++ b/src/main/scala/net/yoshinorin/qualtet/infrastructure/db/Transactor.scala @@ -3,11 +3,11 @@ package net.yoshinorin.qualtet.infrastructure.db import cats.effect.IO import net.yoshinorin.qualtet.actions.Action -trait Transactor[M[_]] { - def perform[R](a: Action[R]): M[R] - def transact[T](t: M[T]): IO[T] +trait Transactor[F[_]] { + def perform[R](a: Action[R]): F[R] + def transact[T](t: F[T]): IO[T] def transact[R](a: Action[R]): IO[R] - def transact2[T1, T2](ts: (M[(T1, T2)])): IO[T2] - def transact4[T1, T2, T3, T4](ts: (M[(T1, T2, T3, T4)])): IO[T4] - def transact8[T1, T2, T3, T4, T5, T6, T7, T8](ts: (M[(T1, T2, T3, T4, T5, T6, T7, T8)])): IO[T8] + def transact2[T1, T2](ts: (F[(T1, T2)])): IO[T2] + def transact4[T1, T2, T3, T4](ts: (F[(T1, T2, T3, T4)])): IO[T4] + def transact8[T1, T2, T3, T4, T5, T6, T7, T8](ts: (F[(T1, T2, T3, T4, T5, T6, T7, T8)])): IO[T8] } diff --git a/src/test/scala/net/yoshinorin/qualtet/fixture/Fixture.scala b/src/test/scala/net/yoshinorin/qualtet/fixture/Fixture.scala index a90a98d1..4b6b1db0 100644 --- a/src/test/scala/net/yoshinorin/qualtet/fixture/Fixture.scala +++ b/src/test/scala/net/yoshinorin/qualtet/fixture/Fixture.scala @@ -111,20 +111,20 @@ object Fixture { tagRoute ) - def makeRouter[M[_]: Monad]( - archiveRoute: ArchiveRoute[M] = archiveRoute, - articleRoute: ArticleRoute[M] = articleRoute, - authorRoute: AuthorRoute[M] = authorRoute, - authRoute: AuthRoute[M] = authRoute, - cacheRoute: CacheRoute[M] = cacheRoute, - contentRoute: ContentRoute[M] = contentRoute, - contentTypeRoute: ContentTypeRoute[M] = contentTypeRoute, - feedRoute: FeedRoute[M] = feedRoute, + def makeRouter[F[_]: Monad]( + archiveRoute: ArchiveRoute[F] = archiveRoute, + articleRoute: ArticleRoute[F] = articleRoute, + authorRoute: AuthorRoute[F] = authorRoute, + authRoute: AuthRoute[F] = authRoute, + cacheRoute: CacheRoute[F] = cacheRoute, + contentRoute: ContentRoute[F] = contentRoute, + contentTypeRoute: ContentTypeRoute[F] = contentTypeRoute, + feedRoute: FeedRoute[F] = feedRoute, homeRoute: HomeRoute = homeRoute, - searchRoute: SearchRoute[M] = searchRoute, - seriesRoute: SeriesRoute[M] = seriesRoute, - sitemapRoute: SitemapRoute[M] = sitemapRoute, - tagRoute: TagRoute[M] = tagRoute, + searchRoute: SearchRoute[F] = searchRoute, + seriesRoute: SeriesRoute[F] = seriesRoute, + sitemapRoute: SitemapRoute[F] = sitemapRoute, + tagRoute: TagRoute[F] = tagRoute, systemRoute: SystemRoute = systemRoute ) = new net.yoshinorin.qualtet.http.Router( corsProvider = corsProvider,