@@ -9,7 +9,7 @@ import { dropUndefined } from "@effect-app/core/utils"
99import { makeRequestId , RequestContext } from "@effect-app/infra/RequestContext"
1010import { RequestContextContainer } from "@effect-app/infra/services/RequestContextContainer"
1111import 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