Skip to Content
gentlemans-stack
ReferenceContracts

todo-contracts

oRPC contract for todo: the typed request/response surface todo-service implements and clients call against.

API

  • todoContract: the oRPC contract for todo procedures.
  • createTodoInputSchema, deleteTodoResultSchema: request and result schemas.
  • Type: TodoContractMeta (cache tags, rate limit, and intent, the WorkspaceIntent a caller's role must allow).
FileExports
todo.contract.tstodoContract, createTodoInputSchema, deleteTodoResultSchema

todoContract has four procedures over the portable Todo model (id, title, done, createdAt, ownerId, workspaceId). Every input carries workspaceId, and every procedure declares the intent its intent meta names (checked by createRequireIntent in todo-service).

  • list (GET /): { workspaceId } in, the workspace's todos out. Intent todo:read.
  • create (POST /): { title, workspaceId } in, the created todo out. Intent todo:create.
  • complete (POST /{id}/complete): marks a todo done. Intent todo:complete.
  • delete (DELETE /{id}): removes a todo. Intent todo:delete; a member may delete only their own todos (the handler enforces that).

create declares rateLimitContractError (429) and a per-IP rateLimit rule of 30 calls per minute. complete and delete also declare resourceNotFoundContractError for the missing-id case. This is the worked example referenced from CLAUDE.md's "adding an endpoint" recipe.

The named input/result schemas are registered by todo-service as reusable OpenAPI components; portable entity schemas remain owned by todo-model.

Commands

pnpm nx run todo-contracts:typecheck   # type-check the package

On this page