add experimental provider auth HttpApi slice (#22389)
This commit is contained in:
@@ -10,8 +10,10 @@ import { InstanceBootstrap } from "@/project/bootstrap"
|
||||
import { Instance } from "@/project/instance"
|
||||
import { Filesystem } from "@/util/filesystem"
|
||||
import { Permission } from "@/permission"
|
||||
import { ProviderAuth } from "@/provider/auth"
|
||||
import { Question } from "@/question"
|
||||
import { PermissionApi, PermissionLive } from "./permission"
|
||||
import { ProviderApi, ProviderLive } from "./provider"
|
||||
import { QuestionApi, QuestionLive } from "./question"
|
||||
|
||||
const Query = Schema.Struct({
|
||||
@@ -108,6 +110,7 @@ export namespace ExperimentalHttpApiServer {
|
||||
|
||||
const QuestionSecured = QuestionApi.middleware(Authorization)
|
||||
const PermissionSecured = PermissionApi.middleware(Authorization)
|
||||
const ProviderSecured = ProviderApi.middleware(Authorization)
|
||||
|
||||
export const routes = Layer.mergeAll(
|
||||
HttpApiBuilder.layer(QuestionSecured, { openapiPath: "/experimental/httpapi/question/doc" }).pipe(
|
||||
@@ -116,6 +119,9 @@ export namespace ExperimentalHttpApiServer {
|
||||
HttpApiBuilder.layer(PermissionSecured, { openapiPath: "/experimental/httpapi/permission/doc" }).pipe(
|
||||
Layer.provide(PermissionLive),
|
||||
),
|
||||
HttpApiBuilder.layer(ProviderSecured, { openapiPath: "/experimental/httpapi/provider/doc" }).pipe(
|
||||
Layer.provide(ProviderLive),
|
||||
),
|
||||
).pipe(Layer.provide(auth), Layer.provide(normalize), Layer.provide(instance))
|
||||
|
||||
export const layer = (opts: { hostname: string; port: number }) =>
|
||||
@@ -127,5 +133,6 @@ export namespace ExperimentalHttpApiServer {
|
||||
Layer.provideMerge(NodeHttpServer.layerTest),
|
||||
Layer.provideMerge(Question.defaultLayer),
|
||||
Layer.provideMerge(Permission.defaultLayer),
|
||||
Layer.provideMerge(ProviderAuth.defaultLayer),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user