Skip to content

Commit 296ac6c

Browse files
committed
fix(example-todo): exclude id from POST request body
1 parent 53ac940 commit 296ac6c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/todo/src/controllers/todo.controller.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ export class TodoController {
3434
},
3535
},
3636
})
37-
async createTodo(@requestBody() todo: Todo): Promise<Todo> {
37+
async createTodo(
38+
@requestBody({
39+
content: {
40+
'application/json': {
41+
schema: getModelSchemaRef(Todo, {exclude: ['id']}),
42+
},
43+
},
44+
})
45+
todo: Omit<Todo, 'id'>,
46+
): Promise<Todo> {
3847
if (todo.remindAtAddress) {
3948
// TODO(bajtos) handle "address not found"
4049
const geo = await this.geoService.geocode(todo.remindAtAddress);

0 commit comments

Comments
 (0)