-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PROD-2211 moves some property-specific endpoints from OSS -> plus (#5096
- Loading branch information
1 parent
1ff4d8c
commit 139d0a6
Showing
10 changed files
with
79 additions
and
634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
clients/admin-ui/src/features/messaging-templates/messaging-templates.slice.plus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { baseApi } from "common/api.slice"; | ||
|
||
import { | ||
MessagingTemplateCreate, | ||
MessagingTemplatePatch, | ||
MessagingTemplateResponse, | ||
MessagingTemplateUpdate, | ||
} from "~/features/messaging-templates/messaging-templates.slice"; | ||
import { Page_MessagingTemplateWithPropertiesSummary_ } from "~/types/api"; | ||
|
||
const messagingTemplatesPlusApi = baseApi.injectEndpoints({ | ||
endpoints: (build) => ({ | ||
getSummaryMessagingTemplates: build.query< | ||
Page_MessagingTemplateWithPropertiesSummary_, | ||
any | ||
>({ | ||
query: (params) => ({ | ||
method: "GET", | ||
url: `plus/messaging/templates/summary`, | ||
params, | ||
}), | ||
providesTags: () => ["Property-Specific Messaging Templates"], | ||
}), | ||
// Full update existing template | ||
putMessagingTemplateById: build.mutation< | ||
MessagingTemplateResponse, | ||
MessagingTemplateUpdate | ||
>({ | ||
query: ({ templateId, template }) => ({ | ||
url: `plus/messaging/templates/${templateId}`, | ||
method: "PUT", | ||
body: template, | ||
}), | ||
invalidatesTags: () => ["Property-Specific Messaging Templates"], | ||
}), | ||
// Partial update existing template, e.g. enable it | ||
patchMessagingTemplateById: build.mutation< | ||
MessagingTemplateResponse, | ||
MessagingTemplatePatch | ||
>({ | ||
query: ({ templateId, template }) => ({ | ||
url: `plus/messaging/templates/${templateId}`, | ||
method: "PATCH", | ||
body: template, | ||
}), | ||
invalidatesTags: () => ["Property-Specific Messaging Templates"], | ||
}), | ||
// endpoint for creating new messaging template- POST by type | ||
createMessagingTemplateByType: build.mutation< | ||
MessagingTemplateResponse, | ||
MessagingTemplateCreate | ||
>({ | ||
query: ({ templateType, template }) => ({ | ||
url: `plus/messaging/templates/${templateType}`, | ||
method: "POST", | ||
body: template, | ||
}), | ||
invalidatesTags: () => ["Property-Specific Messaging Templates"], | ||
}), | ||
}), | ||
}); | ||
|
||
export const { | ||
useGetSummaryMessagingTemplatesQuery, | ||
usePutMessagingTemplateByIdMutation, | ||
useCreateMessagingTemplateByTypeMutation, | ||
usePatchMessagingTemplateByIdMutation, | ||
} = messagingTemplatesPlusApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.