Skip to content
Snippets Groups Projects
Commit f55d87ae authored by Ricardo's avatar Ricardo
Browse files

FIX update id verification

parent 5ca4e83a
No related branches found
No related tags found
No related merge requests found
......@@ -23,13 +23,19 @@ export default class User{
}
static async updateUser (id: number, req: Request, res:Response): Promise<any>{
static async updateUser (req: Request, res:Response): Promise<any>{
if (!this.userRequestValidation(req))
{
return res.status(400).json({ erro: "Invalid Request" });
}
if (!(await this.userExistenceValidation(id)))
const { id } = req.params;
const parsedId = parseInt(id, 10);
if (isNaN(parsedId)) {
return res.status(400).json({ error: "ID inválido" });
}
if (!(await this.userExistenceValidation(parsedId)))
{
return res.status(404).json({ error: "Not Found "});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment