import { HttpApiBuilder } from "@effect/platform"
import { TodosApi } from "@template/domain/TodosApi"
import { Effect, Layer } from "effect"
import { TodosRepository } from "./TodosRepository.js"
const TodosApiLive = HttpApiBuilder.group(TodosApi, "todos", (handlers) => // Property '[TypeId]' is missing in type 'typeof TodosApi' but required in type 'HttpApi<string, Any, unknown, unknown>'
Effect.gen(function*() {
const todos = yield* TodosRepository
return handlers
.handle("getAllTodos", () => todos.getAll()) // Argument of type '"getAllTodos"' is not assignable to parameter of type 'never'.
.handle("getTodoById", ({ path: { id } }) => todos.getById(id)) // (Same for every other handle() call)
.handle("createTodo", ({ payload: { text } }) => todos.create(text))
.handle("completeTodo", ({ path: { id } }) => todos.complete(id))
.handle("removeTodo", ({ path: { id } }) => todos.remove(id))
}))
export const ApiLive = HttpApiBuilder.api(TodosApi).pipe( // Argument of type 'typeof TodosApi' is not assignable to parameter of type 'HttpApi<string, Any, unknown, unknown>'.
Layer.provide(TodosApiLive)
)
import { HttpApiBuilder } from "@effect/platform"
import { TodosApi } from "@template/domain/TodosApi"
import { Effect, Layer } from "effect"
import { TodosRepository } from "./TodosRepository.js"
const TodosApiLive = HttpApiBuilder.group(TodosApi, "todos", (handlers) => // Property '[TypeId]' is missing in type 'typeof TodosApi' but required in type 'HttpApi<string, Any, unknown, unknown>'
Effect.gen(function*() {
const todos = yield* TodosRepository
return handlers
.handle("getAllTodos", () => todos.getAll()) // Argument of type '"getAllTodos"' is not assignable to parameter of type 'never'.
.handle("getTodoById", ({ path: { id } }) => todos.getById(id)) // (Same for every other handle() call)
.handle("createTodo", ({ payload: { text } }) => todos.create(text))
.handle("completeTodo", ({ path: { id } }) => todos.complete(id))
.handle("removeTodo", ({ path: { id } }) => todos.remove(id))
}))
export const ApiLive = HttpApiBuilder.api(TodosApi).pipe( // Argument of type 'typeof TodosApi' is not assignable to parameter of type 'HttpApi<string, Any, unknown, unknown>'.
Layer.provide(TodosApiLive)
)