-
Notifications
You must be signed in to change notification settings - Fork 170
[WIP] feat: Approvals workflow #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ayushsoni1010
wants to merge
40
commits into
main
Choose a base branch
from
feat/approvals-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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
barbinbrad
reviewed
Jan 20, 2026
packages/database/supabase/migrations/20260119191608_approvals-workflow.sql
Outdated
Show resolved
Hide resolved
barbinbrad
reviewed
Jan 20, 2026
packages/database/supabase/migrations/20260119191608_approvals-workflow.sql
Outdated
Show resolved
Hide resolved
barbinbrad
reviewed
Jan 20, 2026
packages/database/supabase/migrations/20260119191608_approvals-workflow.sql
Outdated
Show resolved
Hide resolved
barbinbrad
reviewed
Jan 20, 2026
packages/database/supabase/migrations/20260119191608_approvals-workflow.sql
Outdated
Show resolved
Hide resolved
Open
…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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
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):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist