Skip to content

updates - #10

Merged
Aditya2550 merged 1 commit into
mainfrom
phase-5-frontend
Aug 10, 2026
Merged

Aditya2550 merged 1 commit into
mainfrom
phase-5-frontend

Conversation

@Aditya2550

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings August 10, 2026 18:29
@Aditya2550
Aditya2550 merged commit 87a04d7 into main Aug 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the notifications payload to link notifications to an associated expense and updates expense-approval notifications to include more contextual details (category/currency/amount).

Changes:

  • Add expense_id to notification queries/returns and allow setting it when creating notifications.
  • Update expense workflow notifications (create/approve/reject) to include category/currency/amount details and pass expenseId.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
backend/src/modules/notifications/notifications.model.js Adds expense_id to SELECT/INSERT/UPDATE return fields and create() signature.
backend/src/modules/expenses/expenses.controller.js Enriches notification bodies for expense events and attaches expenseId when creating notifications.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

userId: firstApprover.id,
title: "New expense pending your approval",
body: `${submitter.name || "An employee"} submitted a new expense for review.`,
body: `${submitter.name || "An employee"} submitted a ${category} expense for ${currency} ${amount}.`,
Comment on lines +6 to +14
"SELECT id, title, body, is_read, expense_id, created_at FROM notifications WHERE user_id = $1 ORDER BY created_at DESC",
[userId],
);
},

create({ userId, title, body }) {
create({ userId, title, body, expenseId = null }) {
return query(
"INSERT INTO notifications (user_id, title, body) VALUES ($1, $2, $3) RETURNING id, title, body, is_read, created_at",
[userId, title, body],
"INSERT INTO notifications (user_id, title, body, expense_id) VALUES ($1, $2, $3, $4) RETURNING id, title, body, is_read, expense_id, created_at",
[userId, title, body, expenseId],
Comment on lines 105 to +107
title: "New expense pending your approval",
body: `${submitter.name || "An employee"} submitted a new expense for review.`,
body: `${submitter.name || "An employee"} submitted a ${category} expense for ${currency} ${amount}.`,
expenseId: expense.id,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants