move routes installation into component bis

This commit is contained in:
2021-01-21 22:01:10 +01:00
parent 667339979b
commit 93aa47c6cc
5 changed files with 80 additions and 36 deletions

View File

@@ -0,0 +1,20 @@
package fr.dcproject.component.follow.routes.article
import fr.dcproject.component.follow.routes.article.FollowArticle.followArticle
import fr.dcproject.component.follow.routes.article.GetFollowArticle.getFollowArticle
import fr.dcproject.component.follow.routes.article.GetMyFollowsArticle.getMyFollowsArticle
import fr.dcproject.component.follow.routes.article.UnfollowArticle.unfollowArticle
import io.ktor.auth.authenticate
import io.ktor.locations.KtorExperimentalLocationsAPI
import io.ktor.routing.Routing
import org.koin.ktor.ext.get
@KtorExperimentalLocationsAPI
fun Routing.installFollowArticleRoutes() {
authenticate(optional = true) {
followArticle(get(), get())
unfollowArticle(get(), get())
getFollowArticle(get(), get())
getMyFollowsArticle(get(), get())
}
}

View File

@@ -0,0 +1,24 @@
package fr.dcproject.component.follow.routes.constitution
import fr.dcproject.component.follow.routes.article.FollowArticle.followArticle
import fr.dcproject.component.follow.routes.article.GetFollowArticle.getFollowArticle
import fr.dcproject.component.follow.routes.article.GetMyFollowsArticle.getMyFollowsArticle
import fr.dcproject.component.follow.routes.article.UnfollowArticle.unfollowArticle
import fr.dcproject.component.follow.routes.constitution.FollowConstitution.followConstitution
import fr.dcproject.component.follow.routes.constitution.GetFollowConstitution.getFollowConstitution
import fr.dcproject.component.follow.routes.constitution.GetMyFollowsConstitution.getMyFollowsConstitution
import fr.dcproject.component.follow.routes.constitution.UnfollowConstitution.unfollowConstitution
import io.ktor.auth.authenticate
import io.ktor.locations.KtorExperimentalLocationsAPI
import io.ktor.routing.Routing
import org.koin.ktor.ext.get
@KtorExperimentalLocationsAPI
fun Routing.installFollowConstitutionRoutes() {
authenticate(optional = true) {
followConstitution(get(), get())
unfollowConstitution(get(), get())
getFollowConstitution(get(), get())
getMyFollowsConstitution(get(), get())
}
}