Skip to content

feat: add API endpoint to finalize and execute draft payrolls#502

Merged
codeZe-us merged 1 commit into
SafeVault:mainfrom
mansory-01:main
Jun 1, 2026
Merged

feat: add API endpoint to finalize and execute draft payrolls#502
codeZe-us merged 1 commit into
SafeVault:mainfrom
mansory-01:main

Conversation

@mansory-01
Copy link
Copy Markdown
Contributor

This PR introduces the functionality to execute a draft payroll, lock it from further modifications, and automatically queue the respective fiat payout transactions to distribute net pay to employee accounts.
Additionally, it adds the necessary database schema to persist draft payroll states and addresses a few existing TypeScript compiler issues that were preventing the build from passing cleanly.

What was changed

  • Database Schema: Added payrolls table and payrollStatusEnum (draft, processing, completed, failed) to src/server/db/schema.ts to manage draft payroll lifecycles.
  • Draft Execution Endpoint: Created POST /api/v1/payroll/[draftId]/execute which:
    • Authenticates the organization and retrieves the specified draft payroll.
    • Verifies that the internal draft totals correctly match the calculated sums.
    • Updates the payroll status to processing.
    • Queues individual payout transactions in the fiat_transactions table for each employee.
    • Locks the process by updating the payroll status to completed.
  • TypeScript Fixes: Fixed Zod regex constraint order in tax-rates API and added missing index signatures for generic records in activity.service.ts.

closese #480

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@mansory-01 is attempting to deploy a commit to the vestroll's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeZe-us codeZe-us merged commit e40afc2 into SafeVault:main Jun 1, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants