Todo work
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Todo } from "@todo-tests/common/data"
|
import { Todo } from "@todo-tests/common/data"
|
||||||
import { Array, Context, Data, Effect, Equal, Layer, Option, Ref, SubscriptionRef } from "effect"
|
import { Array, Context, Data, Effect, Equal, Layer, Option, Order, Ref, SubscriptionRef } from "effect"
|
||||||
import crypto from "node:crypto"
|
import crypto from "node:crypto"
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ export class TodoRepositoryService {
|
|||||||
yield* Ref.update(this.todos, Array.append(new Todo({
|
yield* Ref.update(this.todos, Array.append(new Todo({
|
||||||
...todo,
|
...todo,
|
||||||
id: Option.some(id),
|
id: Option.some(id),
|
||||||
}) as Todo & { id: Option.Some<string> }))
|
}, { disableValidation: true }) as Todo & { id: Option.Some<string> }))
|
||||||
|
|
||||||
return id
|
return id
|
||||||
})
|
})
|
||||||
@@ -80,6 +80,15 @@ export class TodoRepositoryService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sortTodos = Array.sortBy<(Todo & { id: Option.Some<string> })[]>(
|
||||||
|
Order.mapInput(Order.number, todo => todo.order)
|
||||||
|
)
|
||||||
|
|
||||||
|
const updateTodoOrders = Array.map<
|
||||||
|
(Todo & { id: Option.Some<string> })[],
|
||||||
|
(Todo & { id: Option.Some<string> })[]
|
||||||
|
>()
|
||||||
|
|
||||||
export class TodoHasID extends Data.TaggedError("TodoHasID")<{ todo: Todo }> {}
|
export class TodoHasID extends Data.TaggedError("TodoHasID")<{ todo: Todo }> {}
|
||||||
export class TodoHasNoID extends Data.TaggedError("TodoHasNoID")<{ todo: Todo }> {}
|
export class TodoHasNoID extends Data.TaggedError("TodoHasNoID")<{ todo: Todo }> {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user