Adding all the license feature and renewal

This commit is contained in:
Mulu Mehari
2026-08-03 12:49:48 +03:00
parent c62ec59655
commit 77bfb01664
21 changed files with 1256 additions and 59 deletions

View File

@@ -14,6 +14,7 @@ import type {
LicenseStatus,
LicenseType,
LicenseTypeRequirements,
OperatorType,
AssignableOfficer,
DocumentDecision,
DocumentReview,
@@ -54,6 +55,7 @@ function serialiseQueueFilter(
const TAGS = [
'LicenseType',
'OperatorType',
'LicenseApplication',
'ApplicationQueue',
'Attachment',
@@ -84,6 +86,33 @@ export const licensingApi = baseApi
providesTags: () => [listTag('LicenseType')],
}),
/**
* The signed-in applicant's declared modes of operation.
*
* Separate from the licence-type catalogue on purpose: the catalogue is
* the same for everyone and heavily cached, while this is per-user and
* changes the moment they edit their profile.
*/
getMyOperatorTypes: builder.query<{ items: OperatorType[] }, void>({
query: () => ({ url: '/profiles/me/operations' }),
providesTags: () => [listTag('OperatorType')],
}),
/** Replaces the set — see the Operations tab in the portal profile. */
updateMyOperatorTypes: builder.mutation<
{ items: OperatorType[] },
{ licenseTypeIds: string[] }
>({
query: (body) => ({
url: '/profiles/me/operations',
method: 'PUT',
body,
}),
// The catalogue is filtered by this, so it has to refetch too.
invalidatesTags: (_r, error) =>
error ? [] : [listTag('OperatorType'), listTag('LicenseType')],
}),
/**
* Category catalogue used to group the licence cards. Static on the
* server, so it is cached under the licence-type list tag.
@@ -758,4 +787,6 @@ export const {
useGetNotificationsQuery,
useGetUnseenNotificationsQuery,
useMarkNotificationReadMutation,
useGetMyOperatorTypesQuery,
useUpdateMyOperatorTypesMutation,
} = licensingApi;