Skip to content

feat: dual approvals, audit log search, bulk SKU mapping, and compliance calendar - #1180

Merged
vjuliaife merged 1 commit into
vjuliaife:mainfrom
chizzy192:fix/tariffshield-issues-1038-1039-1040-1041
Aug 30, 2026
Merged

feat: dual approvals, audit log search, bulk SKU mapping, and compliance calendar#1180
vjuliaife merged 1 commit into
vjuliaife:mainfrom
chizzy192:fix/tariffshield-issues-1038-1039-1040-1041

Conversation

@chizzy192

Copy link
Copy Markdown
Contributor

Description

This pull request addresses and resolves Issues #1038, #1039, #1040, and #1041.

1. Dual Sign-Off Approval Workflow for Large Collateral Withdrawals (#1038)

  • Added schema migration adding dual_approval_enabled, dual_approval_threshold_stroops, second_approver_id, and second_approver_email columns on importers.
  • Created withdrawal_requests table tracking pending, approved, rejected, and cancelled requests with full actor timestamps.
  • Updated POST /importers/:id/withdraw to detect withdrawals meeting or exceeding the configured threshold and place them into pending approval state instead of immediate on-chain submission.
  • Added approval, rejection, and cancellation endpoints with validation preventing self-approval by the requesting user.
  • Emitted audit log events for all stages (withdraw_requested_pending_approval, withdraw_approved, withdraw_rejected, withdraw_cancelled, dual_approval_configured).

2. Search and Filter UI for Surety Admin Audit Log (#1039)

  • Extended GET /admin/audit-log with free-text search across action names, actor emails, target IDs, and payload contents.
  • Added support for filtering by action type, actor user ID, and date range (from/to), along with limit/offset pagination.
  • Added streaming RFC 4180 CSV export endpoint (format=csv).
  • Created SuretyAuditLogPage (/surety/audit-log) in Next.js with shareable URL search parameter syncing, collapsible payload viewer, and CSV download.

3. Bulk HS Code Mapping Table Import for Product Catalogs (#1040)

  • Created importer_sku_mappings database table with catalog versioning, SKU uniqueness constraints, and active flags.
  • Added POST /importers/:id/sku-mappings/bulk supporting batch JSON payloads and raw CSV parsing.
  • Added mapping CRUD endpoints (GET, POST, PUT, DELETE).
  • Updated POST /importers/:id/upload-tariff-csv to resolve line items by product SKU against active mapping catalog and return HTTP 422 with unmappedSkus when unmapped SKUs are supplied.

4. Document Expiration Calendar View for Importer Compliance Documents (#1041)

  • Added expiration_date and metadata columns to kyc_documents and surety_state_licenses.
  • Created GET /importers/:id/compliance-calendar aggregating compliance document expirations and classifying urgency (critical ≤ 30d, warning ≤ 60d, upcoming ≤ 90d, normal > 90d).
  • Created ComplianceExpirationCalendar UI component adhering to the month-grid layout pattern with visual urgency badges, empty state, and deep links to document renewal flows.

Related Issues

Closes #1038
Closes #1039
Closes #1040
Closes #1041

…and vjuliaife#1041

- Issue vjuliaife#1038: Dual Sign-Off Approval Workflow
  - Added dual sign-off settings & withdrawal requests table
  - Intercepted withdrawals exceeding threshold
  - Added approve, reject, and cancel workflow endpoints

- Issue vjuliaife#1039: Surety Admin Audit Log Search & Filter UI
  - Added search across action, email, target ID, and payload
  - Filter by action type, actor, and date range
  - Added CSV export and URL search sync

- Issue vjuliaife#1040: Bulk HS Code Mapping Table Import
  - Added SKU mapping table with versioning and bulk endpoints
  - Auto-resolved SKU to HTS codes in tariff uploads
  - Flagged unmapped SKUs with HTTP 422

- Issue vjuliaife#1041: Document Expiration Calendar View
  - Added expiration date tracking on KYC and license records
  - Aggregated 30/60/90-day upcoming expirations
  - Built ComplianceExpirationCalendar UI component
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@chizzy192 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deployment failed for project tariff-shield-web with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `rootDirectory`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
tariff-shield-web Error Error Aug 30, 2026 9:55am

@vjuliaife
vjuliaife merged commit b189d66 into vjuliaife:main Aug 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants