Skip to content

Commit b78fb2d

Browse files
committed
FUP
1 parent 1e88f0a commit b78fb2d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

_project/api/_src/Usecases/Graph.Controllers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { dropUndefined } from "@effect-app/core/utils"
99
import { makeRequestId, RequestContext } from "@effect-app/infra/RequestContext"
1010
import { RequestContextContainer } from "@effect-app/infra/services/RequestContextContainer"
1111
import type { CTX } from "api/lib/routing.js"
12-
import { BlogControllers } from "./Blog.Controllers.js"
12+
import BlogControllers from "./Blog.Controllers.js"
1313

1414
// TODO: Apply roles&rights to individual actions.
1515

@@ -26,7 +26,7 @@ function request<Key extends string>(
2626
const q = req[name]
2727
return q
2828
? Effect.gen(function*($) {
29-
yield* $(RequestContextContainer.accessWithEffect(_ =>
29+
yield* $(RequestContextContainer.flatMap(_ =>
3030
_.update(ctx =>
3131
RequestContext.inherit(ctx, {
3232
id: makeRequestId(),
@@ -47,10 +47,10 @@ function request<Key extends string>(
4747
}
4848
}
4949

50-
const { controllers, matchWithEffect } = matchFor(GraphRsc)
50+
const graph = matchFor(GraphRsc)
5151

5252
// TODO: Auto generate from the clients
53-
const Query = matchWithEffect("Query")(
53+
const Query = graph.matchQuery.withEffect(
5454
Effect.gen(function*($) {
5555
const blogPostControllers = yield* $(BlogControllers)
5656
return (req, ctx) =>
@@ -104,7 +104,7 @@ function mutation<Key extends string>(
104104
}
105105
}
106106

107-
const Mutation = matchWithEffect("Mutation")(
107+
const Mutation = graph.matchMutation.withEffect(
108108
Effect.gen(function*($) {
109109
const blogPostControllers = yield* $(BlogControllers)
110110
return (req, ctx) =>
@@ -168,7 +168,7 @@ const Mutation = matchWithEffect("Mutation")(
168168
// }
169169
// }
170170

171-
export const GraphControllers = controllers({ Query, Mutation })
171+
export default graph.controllers({ Query, Mutation })
172172

173173
// export const GraphControllers = Effect.struct({
174174
// GraphQuery: match(GraphQuery, defaultErrorHandler, handleRequestEnv),

0 commit comments

Comments
 (0)