edits for trenders attachments & claims

This commit is contained in:
Aya
2026-05-19 11:41:44 +03:00
parent 7732a40726
commit 12c4ca8334
19 changed files with 583 additions and 105 deletions

View File

@@ -0,0 +1,22 @@
-- Add 'mark-as-paid' action to department_expense_claims permission for positions
-- that already have the 'approve' action on it.
-- This is intended for rolling out the new "mark expense claim as paid" feature
-- to managers/accountants who currently approve claims, without granting it to everyone.
--
-- Safe to run multiple times: only updates rows that don't already have the action.
--
-- Run on server:
-- docker-compose exec -T postgres psql -U postgres -d mind14_crm -f - < backend/prisma/add-expense-mark-paid-permission.sql
-- Or from backend:
-- npx prisma db execute --file prisma/add-expense-mark-paid-permission.sql
UPDATE position_permissions
SET
actions = actions || '["mark-as-paid"]'::jsonb,
"updatedAt" = NOW()
WHERE module = 'department_expense_claims'
AND resource = '*'
AND NOT (actions @> '["mark-as-paid"]'::jsonb)
AND NOT (actions @> '["*"]'::jsonb)
AND NOT (actions @> '["all"]'::jsonb)
AND actions @> '["approve"]'::jsonb;

View File

@@ -525,6 +525,8 @@ model ExpenseClaim {
rejectedReason String?
approvalNote String?
isPaid Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt