Initial commit
This commit is contained in:
20
packages/example/src/domain/Todo.ts
Normal file
20
packages/example/src/domain/Todo.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ThSchema } from "@thilawyn/thilaschema"
|
||||
import { Schema } from "effect"
|
||||
|
||||
|
||||
export class Todo extends Schema.Class<Todo>("Todo")({
|
||||
_tag: Schema.tag("Todo"),
|
||||
id: Schema.String,
|
||||
content: Schema.String,
|
||||
completedAt: Schema.OptionFromSelf(Schema.DateTimeUtcFromSelf),
|
||||
}) {}
|
||||
|
||||
|
||||
export const TodoFromJsonStruct = Schema.Struct({
|
||||
...Todo.fields,
|
||||
completedAt: Schema.Option(Schema.DateTimeUtc),
|
||||
}).pipe(
|
||||
ThSchema.assertEncodedJsonifiable
|
||||
)
|
||||
|
||||
export const TodoFromJson = Schema.compose(TodoFromJsonStruct, Todo)
|
||||
1
packages/example/src/domain/index.ts
Normal file
1
packages/example/src/domain/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * as Todo from "./Todo"
|
||||
Reference in New Issue
Block a user