Skip to content

Conversation

@ayushsoni1010
Copy link
Collaborator

What does this PR do?

  • Fixes #XXXX (GitHub issue number)

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

- Create approvalRequest and approvalConfiguration tables
- Add approvalStatus and approvalDocumentType enums
- Create approvalRequests view with related document data
- Add RLS policies for approvals module
- Add Approvals to module enum
- Set up default permissions for Admin and Management roles
- Add approval status and document type enums
- Add validation schemas for approval requests
- Add validation schemas for approval decisions
- Add validation schemas for approval configuration
- Add approval filters validator
- Add getApprovalsForUser to fetch approvals with filters
- Add getPendingApprovalsForApprover to fetch pending approvals
- Support filtering by document type, status, and date range
- Support group-based approver assignment
- Export all approvals models, services, and types
- Prepare for UI module exports
@vercel
Copy link

vercel bot commented Jan 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
carbon Ready Ready Preview, Comment Jan 28, 2026 6:50am
mes Ready Ready Preview, Comment Jan 28, 2026 6:50am
1 Skipped Deployment
Project Deployment Review Updated (UTC)
academy Skipped Skipped Jan 28, 2026 6:50am

Request Review

@ayushsoni1010 ayushsoni1010 linked an issue Jan 20, 2026 that may be closed by this pull request
@ayushsoni1010 ayushsoni1010 self-assigned this Jan 20, 2026
…service role access

BREAKING CHANGE: Approval tables now require service role client access. RLS policies removed.

- Support multiple approver groups via approverGroupIds TEXT[] array
- Remove module-based RLS policies in favor of service role access
Update ApprovalConfiguration type to use getApprovalConfigurationByAmount
from approvals.service instead of getApprovalConfiguration.
- path: approvalRequests, approvalRule, newApprovalRule, deleteApprovalRule; remove submit-for-approval
- useModules: remove Approvals from sidebar (now under Settings)
- Add ApprovalRuleDrawer, ApprovalRulesTable; export from index
- Move approvals under settings: rules tabs (PO/QD), requests list, request detail with approve/reject
- Add rules CRUD routes (rules, rules.new, rules.$id, rules.$id.delete)
- Remove old approvals layout/index and settings/approvals page; update ApprovalDecisionModal
- Add 'Needs Approval' to purchaseOrderStatus; treat as editable in PO forms
- Remove Submit for Approval button; approval on finalize via rules
- Finalize: check rules, create approval request, set status, notify approvers
- path: newApprovalRule uses tab query param instead of documentType
- Rule drawer: ApprovalDocumentType, USD currency format, step 100, trim name helperText
- ApprovalsTable: safe link when doc type unknown
- Settings index: tab in URL (tab param), controlled Tabs
- rules.new: tab from URL, redirect with tab; rules.$id: drop documentType cast
- approveRequest: PO → calculated status from lines; QD → Active
- rejectRequest: PO → Draft; QD unchanged (stays Draft)
- Rename config→rules (getApprovalRuleByAmount, approvalRule table)
- On status update to Active, check rules, create approval request if required
- Notify approvers; keep as Draft when approval pending
- NotificationWorkflow.Approval
- NotificationEvent: ApprovalRequested, ApprovalApproved, ApprovalRejected
- NotificationType.ApprovalInApp
- Map ApprovalRequested/Approved/Rejected to Approval workflow
- getDescription: fetch approval + doc (PO id, QD name), return readable text
- Clearer local skip log with approval requests page hint
- Add disabled prop to dropdown item type; pass through to DropdownMenuItem
- path: approvalSettings → approvalRules (/settings/approval-rules), update rule/new/delete paths
- useSettingsSubmodules: Approvals → Approval Rules, link to approvalRules
- models: approvalDecision id optional; approvalRule enabled → zfd.checkbox
- Add ApprovalRuleCard, ApprovalRuleDetails, ApprovalRules (accordion cards)
- Update RuleDrawer (canEdit, FormBoolean); remove ApprovalRulesTable; drop from index
…lete

- Add approval-rules.tsx (loader + ApprovalRules); move rules.* → approval-rules.*
- Remove approvals _index, rules; layout → approvalRules
- rules.$id: canEdit, creator-only update; $id.delete + .new use approvalRules
… flow

- Header: approve/reject when Needs Approval + has request; SplitButton Mark as Planned disabled
- Route data: approvalRequest, canApprove, canReopen, canDelete
- delete/status/finalize/$orderId + purchasing index/orders updates for approval workflow
- PO finalize, QD update: stop triggering notify on approval request
- requests.$id: stop triggering notify on approve/reject
- notify task: drop Approval workflow and getDescription for approval events
- notifications: remove Approval workflow, events, and type
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.

Approvals

3 participants