mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 20:05:42 +00:00
Merge pull request #64 from Tria-plc/createNewLicenseType
feat: add license type management and import personal document requirements
This commit is contained in:
@@ -11,6 +11,7 @@ import type {
|
||||
Attachment,
|
||||
Department,
|
||||
DocumentRequirement,
|
||||
FamilyKind,
|
||||
FormSchemaPalette,
|
||||
FormSectionConfig,
|
||||
InitiatePaymentResult,
|
||||
@@ -21,6 +22,7 @@ import type {
|
||||
LicenseCategoryDefinition,
|
||||
LicenseStatus,
|
||||
LicenseType,
|
||||
LicenseTypeCreate,
|
||||
LicenseTypeRequirements,
|
||||
OperatorType,
|
||||
AssignableOfficer,
|
||||
@@ -175,6 +177,38 @@ export const licensingApi = baseApi
|
||||
providesTags: () => [listTag('LicenseType')],
|
||||
}),
|
||||
|
||||
/**
|
||||
* Creates the licence type row.
|
||||
*
|
||||
* The one write on this resource with no screen until now: everything
|
||||
* after creation — form, documents, staff rules, fees, validity,
|
||||
* certificate design — had an editor, but the type itself had to be
|
||||
* added by seed or by calling the API directly.
|
||||
*/
|
||||
createLicenseType: builder.mutation<LicenseType, LicenseTypeCreate>({
|
||||
query: (body) => ({ url: '/license-types', method: 'POST', body }),
|
||||
invalidatesTags: (_r, error) => (error ? [] : [listTag('LicenseType')]),
|
||||
}),
|
||||
|
||||
/**
|
||||
* Replaces the row's own fields. The narrow routes (`/fees`,
|
||||
* `/validity`, `/behavior`, `/form-schema`) are still the way to change
|
||||
* what they own; this is the catalogue entry itself — key, names,
|
||||
* category, family kind, prefix, sort order, active.
|
||||
*/
|
||||
updateLicenseType: builder.mutation<
|
||||
LicenseType,
|
||||
{ id: string } & Partial<LicenseTypeCreate>
|
||||
>({
|
||||
query: ({ id, ...body }) => ({
|
||||
url: `/license-types/${id}`,
|
||||
method: 'PUT',
|
||||
body,
|
||||
}),
|
||||
invalidatesTags: (_r, error, { id }) =>
|
||||
error ? [] : [listTag('LicenseType'), itemTag('LicenseType', id)],
|
||||
}),
|
||||
|
||||
/**
|
||||
* Fee configuration, for licensing administrators.
|
||||
*
|
||||
@@ -224,6 +258,7 @@ export const licensingApi = baseApi
|
||||
id: string;
|
||||
workflowProfile?: WorkflowProfile;
|
||||
serviceKind?: ServiceKind;
|
||||
familyKind?: FamilyKind;
|
||||
completionEffect?: CompletionEffect | null;
|
||||
certificateCategory?: CertificateCategory | null;
|
||||
requiresExamination?: boolean;
|
||||
@@ -254,6 +289,24 @@ export const licensingApi = baseApi
|
||||
error ? [] : [listTag('LicenseType'), itemTag('LicenseType', id)],
|
||||
}),
|
||||
|
||||
/**
|
||||
* Opens or closes a type to new applications. Applications already in
|
||||
* flight hold the type by id and keep running; only the portal
|
||||
* catalogue changes.
|
||||
*/
|
||||
updateLicenseStatus: builder.mutation<
|
||||
LicenseType,
|
||||
{ id: string; isActive: boolean }
|
||||
>({
|
||||
query: ({ id, isActive }) => ({
|
||||
url: `/license-types/${id}/status`,
|
||||
method: 'PATCH',
|
||||
body: { isActive },
|
||||
}),
|
||||
invalidatesTags: (_r, error, { id }) =>
|
||||
error ? [] : [itemTag('LicenseType', id), listTag('LicenseType')],
|
||||
}),
|
||||
|
||||
/** Validity is edited beside the certificate design, not with the fees. */
|
||||
updateLicenseValidity: builder.mutation<
|
||||
LicenseType,
|
||||
@@ -1382,6 +1435,8 @@ export const licensingApi = baseApi
|
||||
export const {
|
||||
useGetLicenseTypesQuery,
|
||||
useGetLicenseCategoriesQuery,
|
||||
useCreateLicenseTypeMutation,
|
||||
useUpdateLicenseTypeMutation,
|
||||
useUpdateLicenseFeesMutation,
|
||||
useUpdateLicenseBehaviorMutation,
|
||||
useUpdateFormSchemaMutation,
|
||||
@@ -1407,6 +1462,7 @@ export const {
|
||||
useUpdateRankMutation,
|
||||
useDeleteRankMutation,
|
||||
useUpdateLicenseValidityMutation,
|
||||
useUpdateLicenseStatusMutation,
|
||||
useGetLicenseTypeRequirementsQuery,
|
||||
useCreateApplicationMutation,
|
||||
useGetExamStateForApplicationQuery,
|
||||
|
||||
Reference in New Issue
Block a user