@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 21 lines 898 Bytes
Raw
1 import { Schema } from "effect"
2 import { Model } from "effect/schema"
3
4 export const UserId = Schema.String.pipe(Schema.brand("UserId"))
5 export type UserId = typeof UserId.Type
6
7 // `Model.Class` derives variants for the database (`User`, `User.insert`,
8 // `User.update`) and the JSON API (`User.json`, `User.jsonCreate`,
9 // `User.jsonUpdate`) from a single field declaration.
10 export class User extends Model.Class<User>("User")({
11 // A UUID v4 primary key generated by the application on insert. It is
12 // excluded from the `jsonCreate` / `jsonUpdate` variants, so API clients can
13 // never set it.
14 id: Model.UuidV4Insert(UserId),
15 name: Schema.String,
16 email: Schema.String,
17 // Timestamps are managed by the model: set on insert, refreshed on update,
18 // and also excluded from the JSON create / update variants.
19 createdAt: Model.DateTimeInsert,
20 updatedAt: Model.DateTimeUpdate
21 }) {}