mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 20:05:42 +00:00
feat: implement license type management with creation and status toggling functionality
This commit is contained in:
@@ -74,6 +74,51 @@ const handlers: MockHandler[] = [
|
||||
pattern: /^\/license-types$/,
|
||||
respond: () => paginated(clone(mockLicenseTypes)),
|
||||
},
|
||||
{
|
||||
method: 'POST',
|
||||
pattern: /^\/license-types$/,
|
||||
respond: (req) => {
|
||||
const body = (req.body ?? {}) as Record<string, unknown>;
|
||||
const key = String(body.key ?? '').trim().toUpperCase();
|
||||
if (mockLicenseTypes.some((t) => t.key === key)) return undefined;
|
||||
const created = {
|
||||
id: `lt-${key.toLowerCase()}`,
|
||||
category: 'MARITIME_PERSONNEL',
|
||||
familyKind: 'LOGISTICS_LICENSE',
|
||||
serviceKind: 'LICENSE',
|
||||
workflowProfile: 'STANDARD',
|
||||
feeNewApplication: null,
|
||||
feeRenewal: null,
|
||||
feeCurrency: 'ETB',
|
||||
capitalThreshold: null,
|
||||
validityMonths: 12,
|
||||
slaHours: null,
|
||||
inspectionRequired: true,
|
||||
issuesCertificate: true,
|
||||
renewalEnabled: true,
|
||||
requiresIssuanceScheduling: false,
|
||||
requiresOperatorMode: true,
|
||||
formSchema: { sections: [] },
|
||||
isActive: true,
|
||||
sortOrder: mockLicenseTypes.length,
|
||||
...body,
|
||||
key,
|
||||
};
|
||||
(mockLicenseTypes as unknown[]).push(created);
|
||||
return clone(created);
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'PATCH',
|
||||
pattern: /^\/license-types\/([\w-]+)\/status$/,
|
||||
respond: (req, match) => {
|
||||
const found = mockLicenseTypes.find((t) => t.id === match[1]);
|
||||
if (!found) return undefined;
|
||||
const body = (req.body ?? {}) as { isActive?: boolean };
|
||||
(found as { isActive: boolean }).isActive = body.isActive ?? found.isActive;
|
||||
return clone(found);
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'GET',
|
||||
pattern: /^\/license-types\/requirements\/([\w-]+)$/,
|
||||
|
||||
Reference in New Issue
Block a user