fix: seed IT customer qualifications
This commit is contained in:
@@ -1104,6 +1104,22 @@ ON DUPLICATE KEY UPDATE
|
|||||||
contact_email = VALUES(contact_email), approved_at = COALESCE(approved_at, NOW(3)),
|
contact_email = VALUES(contact_email), approved_at = COALESCE(approved_at, NOW(3)),
|
||||||
approved_by = VALUES(approved_by), deleted = 0;
|
approved_by = VALUES(approved_by), deleted = 0;
|
||||||
|
|
||||||
|
-- The built-in IT customer must be immediately usable for order acceptance tests.
|
||||||
|
-- These approved metadata rows intentionally have no document URL: initialization must not
|
||||||
|
-- point at qualification files that do not exist in File service storage.
|
||||||
|
INSERT INTO iam_tenant_qualification (
|
||||||
|
id, tenant_id, qualification_type, certificate_no, document_url,
|
||||||
|
valid_from, valid_to, status, review_comment, deleted
|
||||||
|
) VALUES
|
||||||
|
(2100001, 10001, 'BUSINESS_LICENSE', '91310000ITTEST0001', NULL,
|
||||||
|
NULL, NULL, 'APPROVED', '开发测试初始化资质,无文件附件', 0),
|
||||||
|
(2100002, 10001, 'LEGAL_PERSON_ID', NULL, NULL,
|
||||||
|
NULL, NULL, 'APPROVED', '开发测试初始化资质,无文件附件', 0)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
tenant_id = VALUES(tenant_id), qualification_type = VALUES(qualification_type),
|
||||||
|
certificate_no = VALUES(certificate_no), status = 'APPROVED',
|
||||||
|
review_comment = VALUES(review_comment), deleted = 0;
|
||||||
|
|
||||||
INSERT INTO iam_user (
|
INSERT INTO iam_user (
|
||||||
id, auth_user_id, user_type, display_name, phone, email, status, deleted, version
|
id, auth_user_id, user_type, display_name, phone, email, status, deleted, version
|
||||||
) VALUES
|
) VALUES
|
||||||
|
|||||||
@@ -38,6 +38,22 @@ ON DUPLICATE KEY UPDATE
|
|||||||
contact_email = VALUES(contact_email), approved_at = COALESCE(approved_at, NOW(3)),
|
contact_email = VALUES(contact_email), approved_at = COALESCE(approved_at, NOW(3)),
|
||||||
approved_by = VALUES(approved_by), deleted = 0;
|
approved_by = VALUES(approved_by), deleted = 0;
|
||||||
|
|
||||||
|
-- The built-in IT customer must be immediately usable for order acceptance tests.
|
||||||
|
-- These approved metadata rows intentionally have no document URL: initialization must not
|
||||||
|
-- point at qualification files that do not exist in File service storage.
|
||||||
|
INSERT INTO iam_tenant_qualification (
|
||||||
|
id, tenant_id, qualification_type, certificate_no, document_url,
|
||||||
|
valid_from, valid_to, status, review_comment, deleted
|
||||||
|
) VALUES
|
||||||
|
(2100001, 10001, 'BUSINESS_LICENSE', '91310000ITTEST0001', NULL,
|
||||||
|
NULL, NULL, 'APPROVED', '开发测试初始化资质,无文件附件', 0),
|
||||||
|
(2100002, 10001, 'LEGAL_PERSON_ID', NULL, NULL,
|
||||||
|
NULL, NULL, 'APPROVED', '开发测试初始化资质,无文件附件', 0)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
tenant_id = VALUES(tenant_id), qualification_type = VALUES(qualification_type),
|
||||||
|
certificate_no = VALUES(certificate_no), status = 'APPROVED',
|
||||||
|
review_comment = VALUES(review_comment), deleted = 0;
|
||||||
|
|
||||||
INSERT INTO iam_user (
|
INSERT INTO iam_user (
|
||||||
id, auth_user_id, user_type, display_name, phone, email, status, deleted, version
|
id, auth_user_id, user_type, display_name, phone, email, status, deleted, version
|
||||||
) VALUES
|
) VALUES
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { readFileSync } from 'node:fs'
|
|||||||
import test from 'node:test'
|
import test from 'node:test'
|
||||||
|
|
||||||
const sql = readFileSync(new URL('../../deploy/sql/头程数据库统一增量-MySQL8.sql', import.meta.url), 'utf8')
|
const sql = readFileSync(new URL('../../deploy/sql/头程数据库统一增量-MySQL8.sql', import.meta.url), 'utf8')
|
||||||
|
const iamSeed = readFileSync(new URL('../../iam/src/main/resources/db/phase1-admin-rbac.sql', import.meta.url), 'utf8')
|
||||||
|
|
||||||
test('统一初始化 SQL 保留最小登录与客户主体', () => {
|
test('统一初始化 SQL 保留最小登录与客户主体', () => {
|
||||||
assert.match(sql, /一个平台系统管理员和一个 IT 测试客户管理员/)
|
assert.match(sql, /一个平台系统管理员和一个 IT 测试客户管理员/)
|
||||||
@@ -11,6 +12,14 @@ test('统一初始化 SQL 保留最小登录与客户主体', () => {
|
|||||||
assert.match(sql, /\(10001, 'IT_TEST', 'IT 测试客户'/)
|
assert.match(sql, /\(10001, 'IT_TEST', 'IT 测试客户'/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('IT 测试客户初始化后具备已审核的必填资质和下单资格', () => {
|
||||||
|
for (const source of [sql, iamSeed]) {
|
||||||
|
assert.match(source, /\(2100001, 10001, 'BUSINESS_LICENSE', '91310000ITTEST0001', NULL,[\s\S]*?'APPROVED'/)
|
||||||
|
assert.match(source, /\(2100002, 10001, 'LEGAL_PERSON_ID', NULL, NULL,[\s\S]*?'APPROVED'/)
|
||||||
|
assert.match(source, /status = 'APPROVED'/)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
test('统一初始化 SQL 提供人工验收所需公共仓储主数据', () => {
|
test('统一初始化 SQL 提供人工验收所需公共仓储主数据', () => {
|
||||||
for (const marker of [
|
for (const marker of [
|
||||||
"'TP-001'", "'TP-002'", "'A1 普通库位'", "'A0 共享溢出位'",
|
"'TP-001'", "'TP-002'", "'A1 普通库位'", "'A0 共享溢出位'",
|
||||||
|
|||||||
Reference in New Issue
Block a user