Skip to content

Commit

Permalink
Add get pno sent messages route in Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Sep 19, 2024
1 parent 47b3966 commit a2b731d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/src/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export enum HttpStatusCode {
export enum RtkCacheTagType {
PriorNotification = 'PriorNotification',
PriorNotificationDocuments = 'PriorNotificationDocuments',
PriorNotificationSentMessages = 'PriorNotificationSentMessages',
PriorNotificationTypes = 'PriorNotificationTypes',
PriorNotifications = 'PriorNotifications',
PriorNotificationsToVerify = 'PriorNotificationsToVerify',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ export namespace PriorNotification {
name: string
}

export type SentMessage = {
communicationMeans: 'EMAIL' | 'FAX' | 'SMS'
dateTimeUtc: string
errorMessage: string | undefined
recipientAddressOrNumber: string
success: boolean
}

export type Upload = {
createdAt: string
fileName: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const CREATE_PRIOR_NOTIFICATION_ERROR_MESSAGE = "Nous n'avons pas pu créé le p
const DELETE_PRIOR_NOTIFICATION_UPLOAD_ERROR_MESSAGE = "Nous n'avons pas pu supprimer ce document attaché."
const GET_PRIOR_NOTIFICATION_UPLOADS_ERROR_MESSAGE =
"Nous n'avons pas pu récupérer les documents attachés à ce préavis."
const GET_PRIOR_NOTIFICATION_SENT_MESSAGES_ERROR_MESSAGE =
"Nous n'avons pas pu récupérer la liste des envois correspondant à ce préavis."
const UPDATE_PRIOR_NOTIFICATION_ERROR_MESSAGE = "Nous n'avons pas pu modifier le préavis."
const GET_PRIOR_NOTIFICATION_DETAIL_ERROR_MESSAGE = "Nous n'avons pas pu récupérer le préavis."
const GET_PRIOR_NOTIFICATIONS_ERROR_MESSAGE = "Nous n'avons pas pu récupérer la liste des préavis."
Expand Down Expand Up @@ -128,6 +130,13 @@ export const priorNotificationApi = monitorfishApi.injectEndpoints({
transformErrorResponse: response => new FrontendApiError(GET_PRIOR_NOTIFICATIONS_ERROR_MESSAGE, response)
}),

getPriorNotificationSentNessages: builder.query<PriorNotification.SentMessage[], string>({
providesTags: () => [{ type: RtkCacheTagType.PriorNotificationSentMessages }],
query: reportId => `/prior_notifications/${reportId}/sent_messages`,
transformErrorResponse: response =>
new FrontendApiError(GET_PRIOR_NOTIFICATION_SENT_MESSAGES_ERROR_MESSAGE, response)
}),

getPriorNotificationsToVerify: builder.query<LogbookMessage.ApiListExtraData, void>({
providesTags: () => [{ type: RtkCacheTagType.PriorNotificationsToVerify }],
query: () => '/prior_notifications/to_verify',
Expand Down

0 comments on commit a2b731d

Please sign in to comment.