18 lines
351 B
TypeScript
18 lines
351 B
TypeScript
export class Todo {
|
|
something?: boolean;
|
|
|
|
constructor(private readonly id: string, private content: string) {}
|
|
|
|
// Update the todo's content.
|
|
setContent(content: string) {
|
|
this.content = content;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @post /api/todos
|
|
*/
|
|
export function createTodo(content: string): Todo {
|
|
return new Todo(new Date().toISOString(), content);
|
|
}
|