Skip to content

Commit

Permalink
fix(validation): exepenses details validation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoRoblin committed Sep 3, 2024
1 parent 31673ba commit 3e59589
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion api-server/src/resources/expense/ExpenseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ router.get("/:id", verifyToken, async (req: Request, res: Response) => {
let userId = (req as CustomRequest).token.userId;
const { code, message, data } = await ExpenseService.getExpenseDemand(
req.params.id,
userId,
);
res.status(code).json({ message, data });
});
Expand Down
4 changes: 1 addition & 3 deletions api-server/src/resources/expense/ExpenseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class ExpenseService {
}
}

public static async getExpenseDemand(id: string, userId: number) {
public static async getExpenseDemand(id: string) {
try {
const expenseTemp = await ExpenseRepository.getExpenseDemand(id);
let expense: ExpenseListDTO;
Expand All @@ -241,8 +241,6 @@ export class ExpenseService {
} else {
expense = new ExpenseListDTO(expenseTemp);
}
if (expense.id_owner != userId)
return new ControllerResponse(403, "Access denied");

return new ControllerResponse<ExpenseListDTO>(200, "", expense);
} catch (error) {
Expand Down

0 comments on commit 3e59589

Please sign in to comment.