Cleanup
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { BunRuntime } from "@effect/platform-bun"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { Todo } from "@todo-tests/common/data"
|
||||
import { Effect, Layer, Option } from "effect"
|
||||
import { Services } from "./Services"
|
||||
import { createDefaultTodos } from "./todo/TodoRepository"
|
||||
import { ExpressApp } from "./http/ExpressApp"
|
||||
import { ExpressHTTPServer } from "./http/ExpressHTTPServer"
|
||||
import { WebSocketServer } from "./http/WebSocketServer"
|
||||
@@ -10,6 +10,7 @@ import { RPCRoute } from "./rpc/RPCRoute"
|
||||
import { RPCRouter } from "./rpc/RPCRouter"
|
||||
import { RPCWebSocketHandler } from "./rpc/RPCWebSocketHandler"
|
||||
import { RPCProcedureBuilder } from "./rpc/procedures/RPCProcedureBuilder"
|
||||
import { TodoRepository } from "./todo/TodoRepository"
|
||||
import { TRPCBuilder } from "./trpc/TRPCBuilder"
|
||||
import { TRPCContextCreator } from "./trpc/TRPCContextCreator"
|
||||
|
||||
@@ -31,7 +32,39 @@ const ServerDev = Layer.empty.pipe(
|
||||
|
||||
|
||||
const main = Effect.gen(function*() {
|
||||
yield* createDefaultTodos
|
||||
const todos = yield* TodoRepository
|
||||
|
||||
yield* todos.add(new Todo({
|
||||
id: Option.none(),
|
||||
order: 0,
|
||||
content: "Sort the socks",
|
||||
due: Option.none(),
|
||||
completed: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}))
|
||||
|
||||
yield* todos.add(new Todo({
|
||||
id: Option.none(),
|
||||
order: 1,
|
||||
content: "Sort the dog",
|
||||
due: Option.none(),
|
||||
completed: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}))
|
||||
|
||||
yield* todos.add(new Todo({
|
||||
id: Option.none(),
|
||||
order: 2,
|
||||
content: "Sort the car",
|
||||
due: Option.none(),
|
||||
completed: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}))
|
||||
|
||||
|
||||
yield* Layer.launch(ServerDev)
|
||||
})
|
||||
|
||||
|
||||
@@ -101,38 +101,3 @@ const updateTodosOrder = Chunk.map<
|
||||
|
||||
export class TodoHasID extends Data.TaggedError("TodoHasID")<{ todo: Todo }> {}
|
||||
export class TodoHasNoID extends Data.TaggedError("TodoHasNoID")<{ todo: Todo }> {}
|
||||
|
||||
|
||||
export const createDefaultTodos = Effect.gen(function*() {
|
||||
const todos = yield* TodoRepository
|
||||
|
||||
yield* todos.add(new Todo({
|
||||
id: Option.none(),
|
||||
order: 0,
|
||||
content: "Sort the socks",
|
||||
due: Option.none(),
|
||||
completed: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}))
|
||||
|
||||
yield* todos.add(new Todo({
|
||||
id: Option.none(),
|
||||
order: 1,
|
||||
content: "Sort the dog",
|
||||
due: Option.none(),
|
||||
completed: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}))
|
||||
|
||||
yield* todos.add(new Todo({
|
||||
id: Option.none(),
|
||||
order: 2,
|
||||
content: "Sort the car",
|
||||
due: Option.none(),
|
||||
completed: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user