feat: implement license type management with creation and status toggling functionality

This commit is contained in:
estifanos
2026-09-02 11:10:27 +00:00
parent 3b5bdfb6d1
commit 5eeb9602b0
8 changed files with 767 additions and 17 deletions

View File

@@ -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-]+)$/,