mirror of
https://github.com/GithubOrgProjectPiza/server.git
synced 2026-09-04 08:36:10 +02:00
Add price to pizza add and update routes
This commit is contained in:
@@ -7,12 +7,14 @@ export const addPizza = async (req: Request, res: Response) => {
|
|||||||
if (
|
if (
|
||||||
typeof req.body.name !== "string" ||
|
typeof req.body.name !== "string" ||
|
||||||
typeof req.body.description !== "string" ||
|
typeof req.body.description !== "string" ||
|
||||||
typeof req.body.restaurantId !== "number"
|
typeof req.body.restaurantId !== "number" ||
|
||||||
|
typeof req.body.price !== "number"
|
||||||
) {
|
) {
|
||||||
res.status(HttpStatusCodes.BAD_REQUEST).json({
|
res.status(HttpStatusCodes.BAD_REQUEST).json({
|
||||||
name: DataType.STRING,
|
name: DataType.STRING,
|
||||||
description: DataType.STRING,
|
description: DataType.STRING,
|
||||||
restaurantId: DataType.NUMBER,
|
restaurantId: DataType.NUMBER,
|
||||||
|
price: DataType.NUMBER
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -22,6 +24,7 @@ export const addPizza = async (req: Request, res: Response) => {
|
|||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
description: req.body.description,
|
description: req.body.description,
|
||||||
restaurantId: req.body.restaurantId,
|
restaurantId: req.body.restaurantId,
|
||||||
|
price: req.body.price
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,6 +47,7 @@ export const updatePizza = async (req: Request, res: Response) => {
|
|||||||
name: DataType.STRING,
|
name: DataType.STRING,
|
||||||
description: DataType.STRING,
|
description: DataType.STRING,
|
||||||
restaurantId: DataType.NUMBER,
|
restaurantId: DataType.NUMBER,
|
||||||
|
price: DataType.NUMBER
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -55,6 +59,7 @@ export const updatePizza = async (req: Request, res: Response) => {
|
|||||||
data: {
|
data: {
|
||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
description: req.body.description,
|
description: req.body.description,
|
||||||
|
price: req.body.price
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user