TodoRepository work

This commit is contained in:
Julien Valverdé
2024-06-29 16:56:11 +02:00
parent 7ea85ae2ae
commit abc8668d25
2 changed files with 6 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import { Todo } from "@todo-tests/common/data"
import { Array, Context, Data, Effect, Layer, Option, Ref, SubscriptionRef } from "effect"
import { Array, Context, Data, Effect, Equal, Layer, Option, Ref, SubscriptionRef } from "effect"
import crypto from "node:crypto"
@@ -19,13 +19,13 @@ export class TodoRepositoryService {
get(id: string) {
return this.todos.get.pipe(
Effect.map(Array.findFirst(todo => todo.id.value === id))
Effect.map(Array.findFirst(todo => Equal.equals(todo.id.value, id)))
)
}
getIndex(id: string) {
return this.todos.get.pipe(
Effect.map(Array.findFirstIndex(todo => todo.id.value === id))
Effect.map(Array.findFirstIndex(todo => Equal.equals(todo.id.value, id)))
)
}