Skip to content

Commit

Permalink
fix: correct notification router
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed Aug 3, 2024
1 parent cae48e7 commit b298102
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions routes/notificationRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@ notificationRouter.get('/:id', async (req, res) => {
});

notificationRouter.post('/', async (req, res) => {
const {
business_id: businessId,
message,
timestamp,
been_dismissed: beenDismissed,
type,
} = req.body;
console.log(req.body);
const timestamp = new Date();

const { businessId, message, type, senderId, businessName, donationId } = req.body;

try {
await db.query(
`
INSERT INTO notification (business_id, message, timestamp, been_dismissed, type)
INSERT INTO notification (business_id, message, timestamp, type, sender_id, business_name, donation_id)
VALUES
($(businessId), $(message), $(timestamp), $(beenDismissed), $(type));
($(businessId), $(message), $(timestamp), $(type), $(senderId), $(businessName), $(donationId));
`,
{ businessId, message, timestamp, beenDismissed, type },
{ message, businessId, timestamp, type, senderId, businessName, donationId },
);
res.status(200).json({
status: 'Success',
Expand Down

0 comments on commit b298102

Please sign in to comment.