Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Update OrderController.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
angelip2303 authored May 3, 2022
1 parent 6563456 commit c976b38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion restapi/orders/OrderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { orderModel } from "./Order";

export const getOrder: RequestHandler = async (req, res) => {
const webId = req.headers.token + "";
const user = await userModel.findOne({ webId: webId });

if (await verifyWebID(webId)) {
const orderFound = await orderModel.findOne({
code: req.params.code,
});
if (orderFound) {
if (webId === orderFound.webId) {
if (webId === orderFound.webId || user.role !== "user") {
return res.json(orderFound);
} else {
return res.status(409).json();
Expand Down

0 comments on commit c976b38

Please sign in to comment.