Skip to content

Commit c34418c

Browse files
committedDec 6, 2023
[add] admin event(detail)
1 parent c7e1571 commit c34418c

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
 

‎controllers/organizerSidePaymentController.js

+17
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ const getAllPaymentsByOrganizerId = async (req, res) => {
2525
}
2626
};
2727

28+
29+
const getAllPaymentsByOrganizerIdAdmin = async (req, res) => {
30+
const id = await req.params.organizerId
31+
console.log(id);
32+
try {
33+
const allPaymentsByOrganizer = await get_payment_by_organizer_id(id);
34+
35+
if (allPaymentsByOrganizer.length <= 0) {
36+
return res.status(404).json({ message: messages.notFound });
37+
}
38+
return res.status(200).json(allPaymentsByOrganizer);
39+
} catch (error) {
40+
return res.status(500).json({ message: messages.serverError });
41+
}
42+
};
43+
2844
const addOrganizerPayment = async (req, res) => {
2945
const id = await getOrganizerIdFromToken(req, res);
3046
const paymentData = req.body.payment;
@@ -59,4 +75,5 @@ module.exports = {
5975
getAllPaymentsByOrganizerId,
6076
updateOrganizerPayment,
6177
addOrganizerPayment,
78+
getAllPaymentsByOrganizerIdAdmin
6279
};

‎routers/organizerSidePaymentRoutes.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ const {
22
getAllPaymentsByOrganizerId,
33
addOrganizerPayment,
44
updateOrganizerPayment,
5+
getAllPaymentsByOrganizerIdAdmin,
56
} = require("../controllers/organizerSidePaymentController");
67
const express = require("express");
78
const router = express.Router();
89

10+
router.get("/all/:organizerId", getAllPaymentsByOrganizerIdAdmin);
911
router.get("/all", getAllPaymentsByOrganizerId);
1012
router.post("/create", addOrganizerPayment);
1113
router.put("/update/:paymentId", updateOrganizerPayment);

0 commit comments

Comments
 (0)
Please sign in to comment.