I'm giving my first steps in Loopback 4, and I've been trying to follow the tutorial that they have to generate a new REST Api.
The thing is that after creating my model, database and repository, I started to develop my controller class and encountered a piece of code that nowhere in the documentation we have a mention to it.
I have it signaled below:
async createTodo(
@requestBody({
content: {
'application/json': {
schema: getModelSchemaRef(Todo, {title: 'NewTodo', exclude: ['id']}),
},
},
})
todo: **Omit<Todo, 'id'>,** <----------
): Promise<Todo> {
...
return this.todoRepository.create(todo);
}
My question is: For what this omit is for? I've tried to remove it from the code, and the result is the same as the one that I have without it.
Also, in that post request, I'd like to hide the id property from the object, when I receive the answer. How can I do that just for this request' response?
Thanks in advance!