edits for trenders attachments & claims
This commit is contained in:
22
backend/prisma/add-expense-mark-paid-permission.sql
Normal file
22
backend/prisma/add-expense-mark-paid-permission.sql
Normal 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;
|
||||
@@ -525,6 +525,8 @@ model ExpenseClaim {
|
||||
rejectedReason String?
|
||||
approvalNote String?
|
||||
|
||||
isPaid Boolean @default(false)
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user