forked from effect-app/boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresources.ts
More file actions
37 lines (31 loc) · 985 Bytes
/
resources.ts
File metadata and controls
37 lines (31 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { User, UserId } from "#Domain/User"
import { S } from "#resources/lib"
import { NotFoundError } from "effect-app/client"
export class UserView extends S.ExtendedClass<UserView, UserView.Encoded>()({
...User.pick("id", "role"),
displayName: S.NonEmptyString2k
}) {}
export class GetMe extends S.Req<GetMe>()("GetMe", {}, { success: User, failure: NotFoundError }) {}
export class IndexUsers extends S.Req<IndexUsers>()("IndexUsers", {
filterByIds: S.NonEmptyArray(UserId)
}, {
allowAnonymous: true,
allowRoles: ["user"],
success: S.Struct({
users: S.Array(UserView)
})
}) {}
// codegen:start {preset: meta, sourcePrefix: src/}
export const meta = { moduleName: "Accounts" } as const
// codegen:end
// codegen:start {preset: model}
//
/* eslint-disable */
export namespace UserView {
export interface Encoded extends S.Struct.Encoded<typeof UserView["fields"]> {}
}
/* eslint-enable */
//
// codegen:end
//
export * as AccountsRsc from "./resources.js"