优化构架

This commit is contained in:
2026-08-03 18:52:30 +08:00
parent 35c713a7ca
commit fed46f42ef
59 changed files with 691 additions and 325 deletions
@@ -3,8 +3,9 @@ import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./merchantIam.ts', import.meta.url), 'utf8')
const storeSource = readFileSync(new URL('../stores/tenantAdministration.ts', import.meta.url), 'utf8')
const authSource = readFileSync(new URL('../stores/auth.ts', import.meta.url), 'utf8')
const storeSource = readFileSync(new URL('../store/tenantAdministration.ts', import.meta.url), 'utf8')
const contractsSource = readFileSync(new URL('../contracts.ts', import.meta.url), 'utf8')
const authSource = readFileSync(new URL('../../auth/store/auth.ts', import.meta.url), 'utf8')
test('declares the documented merchant role and member endpoints', () => {
assert.match(source, /url: '\/merchant\/v1\/iam\/roles'/)
@@ -50,9 +51,11 @@ test('starts empty and only loads server role and member records', () => {
})
test('shares the merchant permission map and preserves resources not rendered by the role editor', () => {
assert.match(storeSource, /export const FRONTEND_TO_MERCHANT_PERMISSION_CODES/)
assert.match(storeSource, /'order:first-leg:cancel': \['merchant:order:cancel'\]/)
assert.match(contractsSource, /export const FRONTEND_TO_MERCHANT_PERMISSION_CODES/)
assert.match(contractsSource, /'order:first-leg:cancel': \['merchant:order:cancel'\]/)
assert.match(storeSource, /from '@\/modules\/tenant-management\/contracts'/)
assert.match(authSource, /FRONTEND_TO_MERCHANT_PERMISSION_CODES/)
assert.match(authSource, /from '@\/modules\/tenant-management\/public'/)
assert.match(authSource, /Object\.entries\(FRONTEND_TO_MERCHANT_PERMISSION_CODES\)/)
assert.match(storeSource, /const preservedPermissionIds = role\.permissionIds\.filter/)
assert.match(storeSource, /const nextPermissionIds = \[\.\.\.new Set\(\[\.\.\.preservedPermissionIds, \.\.\.selectedPermissionIds\]\)\]/)
@@ -1,6 +1,5 @@
import { apiBlobRequest, apiRequest } from '@/api/http'
export type MerchantTenantStatus = 'PROFILE_REQUIRED' | 'PENDING' | 'ACTIVE' | 'REJECTED' | 'DISABLED'
import type { MerchantTenantStatus } from '../contracts'
export type QualificationStatus = 'PENDING' | 'APPROVED' | 'REJECTED'
export interface MerchantTenantProfile {