feat(identity): align auth flow with reference theme

This commit is contained in:
2026-10-04 21:10:12 +08:00
parent 5a17b399a0
commit 59901b9e10
34 changed files with 753 additions and 3871 deletions
+4 -29
View File
@@ -18,47 +18,24 @@ trait DBMigratorIdentity {
client_request_id CHAR(36) NOT NULL,
request_payload_hash CHAR(64) NOT NULL,
user_id BIGINT UNSIGNED NOT NULL,
type VARCHAR(20) NOT NULL,
channel VARCHAR(20) NOT NULL DEFAULT 'cloud',
provider VARCHAR(20) NOT NULL DEFAULT '',
provider_flow VARCHAR(80) NOT NULL DEFAULT '',
provider_session_id VARCHAR(191) NOT NULL DEFAULT '',
provider_request_id VARCHAR(191) NOT NULL DEFAULT '',
redirect_url TEXT DEFAULT NULL,
qr_payload TEXT DEFAULT NULL,
type VARCHAR(20) NOT NULL DEFAULT 'general',
channel VARCHAR(20) NOT NULL DEFAULT 'manual',
status VARCHAR(32) NOT NULL DEFAULT 'created',
public_name VARCHAR(64) NOT NULL DEFAULT '',
person_name_masked VARCHAR(64) NOT NULL DEFAULT '',
id_number_masked VARCHAR(32) NOT NULL DEFAULT '',
id_number_hash CHAR(64) NOT NULL DEFAULT '',
company_name VARCHAR(191) NOT NULL DEFAULT '',
company_code_masked VARCHAR(32) NOT NULL DEFAULT '',
company_code_hash CHAR(64) NOT NULL DEFAULT '',
sensitive_blob LONGTEXT DEFAULT NULL,
provider_result_code VARCHAR(128) NOT NULL DEFAULT '',
provider_result_summary TEXT DEFAULT NULL,
manual_reason TEXT DEFAULT NULL,
review_note TEXT DEFAULT NULL,
reviewer_id BIGINT UNSIGNED DEFAULT NULL,
evidence_ids TEXT DEFAULT NULL,
fee_amount DECIMAL(10,2) NOT NULL DEFAULT 0,
fee_status VARCHAR(20) NOT NULL DEFAULT 'not_required',
attempt_ordinal INT UNSIGNED NOT NULL DEFAULT 0,
retry_count INT UNSIGNED NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
provider_started_at DATETIME DEFAULT NULL,
completed_at DATETIME DEFAULT NULL,
expires_at DATETIME DEFAULT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY uniq_application_uuid (application_uuid),
UNIQUE KEY uniq_user_client_request (user_id, client_request_id),
KEY idx_user_created (user_id, created_at),
KEY idx_user_type_status (user_id, type, status),
KEY idx_provider_session (provider, provider_session_id),
KEY idx_status_updated (status, updated_at),
KEY idx_id_number_hash (id_number_hash),
KEY idx_company_code_hash (company_code_hash)
KEY idx_user_auth_status (user_id, type, channel, status)
) ENGINE=InnoDB {$charset_collate};";
dbDelta($application);
@@ -68,7 +45,6 @@ trait DBMigratorIdentity {
event_uuid CHAR(36) NOT NULL,
source VARCHAR(20) NOT NULL,
event_type VARCHAR(64) NOT NULL,
external_event_id VARCHAR(191) NOT NULL DEFAULT '',
dedupe_key CHAR(64) NOT NULL,
from_status VARCHAR(32) NOT NULL DEFAULT '',
to_status VARCHAR(32) NOT NULL DEFAULT '',
@@ -79,8 +55,7 @@ trait DBMigratorIdentity {
PRIMARY KEY (id),
UNIQUE KEY uniq_event_uuid (event_uuid),
UNIQUE KEY uniq_dedupe_key (dedupe_key),
KEY idx_application_created (application_id, created_at),
KEY idx_source_external (source, external_event_id)
KEY idx_application_created (application_id, created_at)
) ENGINE=InnoDB {$charset_collate};";
dbDelta($event);
}