JsonifiableTodo
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Schema as S } from "@effect/schema"
|
import { Schema as S } from "@effect/schema"
|
||||||
import { Tag } from "@thilawyn/thilalib/effect/schema"
|
import { Jsonifiable, Tag } from "@thilawyn/thilalib/effect/schema"
|
||||||
import { Class } from "@thilawyn/thilalib/effect/schema/class"
|
import { Class } from "@thilawyn/thilalib/effect/schema/class"
|
||||||
|
|
||||||
|
|
||||||
@@ -10,7 +10,16 @@ export class Todo extends Class<Todo>("Todo")({
|
|||||||
title: S.String,
|
title: S.String,
|
||||||
content: S.String,
|
content: S.String,
|
||||||
|
|
||||||
due: S.optional(S.DateFromSelf, { as: "Option" }),
|
due: S.OptionFromSelf(S.DateFromSelf),
|
||||||
createdAt: S.DateFromSelf,
|
createdAt: S.DateFromSelf,
|
||||||
updatedAt: S.DateFromSelf,
|
updatedAt: S.DateFromSelf,
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
|
|
||||||
|
export const JsonifiableTodo = Jsonifiable(Todo, S.Struct({
|
||||||
|
...Todo.fields,
|
||||||
|
|
||||||
|
due: S.OptionFromNullOr(S.DateFromString),
|
||||||
|
createdAt: S.DateFromString,
|
||||||
|
updatedAt: S.DateFromString,
|
||||||
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user