MCPcopy Create free account
hub / github.com/CodeForBreakfast/eventsourcing / createTodo

Function createTodo

examples/todo-app/src/cli.ts:79–88  ·  view source on GitHub ↗
(title: string)

Source from the content-addressed store, hash-verified

77const executeCreateTodo = (title: string) => TodoAggregateRoot.commands.createTodo(title)();
78
79const createTodo = (title: string) => {
80 const todoId = `todo-${Date.now()}` as TodoId;
81 const state = TodoAggregateRoot.new();
82
83 return pipe(
84 title,
85 executeCreateTodo,
86 Effect.flatMap(commitAndReturnId(todoId, state.nextEventNumber, title))
87 );
88};
89
90const processCommand = (
91 todoState: Readonly<Option.Option<TodoState>>,

Callers 1

cli.tsFile · 0.70

Calls 1

commitAndReturnIdFunction · 0.85

Tested by

no test coverage detected