This commit is contained in:
Julien Valverdé
2024-07-06 00:02:47 +02:00
parent bb1a422097
commit 89a76f85ac
4 changed files with 62 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
import { BunRuntime } from "@effect/platform-bun"
import { Todo } from "@todo-tests/common/data"
import { Identifiable } from "@todo-tests/common/traits"
import { Array, Duration, Effect, Layer, Option, Stream } from "effect"
import { Array, Effect, Layer, Option, Stream } from "effect"
import { ServicesLive } from "./Services"
import { TodoRepository, createDefaultTodos } from "./TodoRepository"
import { ExpressApp } from "./express/ExpressApp"
@@ -41,10 +41,10 @@ const watchTodoChanges = Effect.gen(function*() {
})
const main = Effect.gen(function*() {
const watcher = yield* Effect.fork(watchTodoChanges)
// const watcher = yield* Effect.fork(watchTodoChanges)
yield* createDefaultTodos
const todos = yield* TodoRepository
// const todos = yield* TodoRepository
// const secondTodo = yield* yield* todos.todos.get.pipe(
// Effect.map(Array.get(1))
@@ -55,17 +55,17 @@ const main = Effect.gen(function*() {
// })
// yield* todos.update(secondTodoModified)
yield* todos.add(new Todo({
id: Option.none(),
title: "Put the dishes in the dishwasher",
content: "Lorem ipsum",
due: Option.none(),
completed: false,
createdAt: new Date(),
updatedAt: new Date(),
})).pipe(
Effect.delay(Duration.seconds(1))
)
// yield* todos.add(new Todo({
// id: Option.none(),
// title: "Put the dishes in the dishwasher",
// content: "Lorem ipsum",
// due: Option.none(),
// completed: false,
// createdAt: new Date(),
// updatedAt: new Date(),
// })).pipe(
// Effect.delay(Duration.seconds(1))
// )
// yield* Fiber.join(watcher)
yield* Layer.launch(ServerLive)