When admin proposes changes from KRS/CEIDG registry, the application now goes to 'pending_user_approval' status. User must review and accept/reject proposed changes before final approval. Changes: - New status: pending_user_approval - New fields: proposed_changes, proposed_changes_at, proposed_changes_by_id - Admin endpoint: POST /admin/membership/<id>/propose-changes - User endpoints: GET/POST /membership/review-changes/<id>/accept|reject - New template: templates/membership/review_changes.html - Migration: 043_membership_proposed_changes.sql Workflow: submitted → under_review → pending_user_approval → under_review → approved Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
24 lines
1.2 KiB
SQL
24 lines
1.2 KiB
SQL
-- Migration: 043_membership_proposed_changes.sql
|
|
-- Date: 2026-02-01
|
|
-- Description: Add workflow for admin-proposed changes requiring user approval
|
|
|
|
-- Add new columns for proposed changes workflow
|
|
ALTER TABLE membership_applications
|
|
ADD COLUMN IF NOT EXISTS proposed_changes JSONB,
|
|
ADD COLUMN IF NOT EXISTS proposed_changes_at TIMESTAMP,
|
|
ADD COLUMN IF NOT EXISTS proposed_changes_by_id INTEGER REFERENCES users(id),
|
|
ADD COLUMN IF NOT EXISTS proposed_changes_comment TEXT;
|
|
|
|
-- Add index for efficient querying by status
|
|
CREATE INDEX IF NOT EXISTS idx_membership_proposed_status
|
|
ON membership_applications(status)
|
|
WHERE status = 'pending_user_approval';
|
|
|
|
-- Grant permissions
|
|
GRANT ALL ON TABLE membership_applications TO nordabiz_app;
|
|
|
|
COMMENT ON COLUMN membership_applications.proposed_changes IS 'JSONB containing proposed field changes from registry data';
|
|
COMMENT ON COLUMN membership_applications.proposed_changes_at IS 'When the changes were proposed by admin';
|
|
COMMENT ON COLUMN membership_applications.proposed_changes_by_id IS 'Admin user who proposed the changes';
|
|
COMMENT ON COLUMN membership_applications.proposed_changes_comment IS 'Optional comment from admin explaining the changes';
|