Skip to content

Commit

Permalink
PROD-2211 moves some property-specific endpoints from OSS -> plus (#5096
Browse files Browse the repository at this point in the history
)
  • Loading branch information
eastandwestwind authored Jul 30, 2024
1 parent 1ff4d8c commit 139d0a6
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 634 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The types of changes are:
- Serve GVL languages as they are requested [#5112](https://github.com/ethyca/fides/pull/5112)
- Changed text on system integrations tab to direct to new integration management [#5097](https://github.com/ethyca/fides/pull/5097)
- Updates to consent experience styling [#5085](https://github.com/ethyca/fides/pull/5085)
- Moves some endpoints for property-specific messaging from OSS -> plus [#5069](https://github.com/ethyca/fides/pull/5069)

### Developer Experience
- Add `.syncignore` to reduce file sync size with new volumes [#5104](https://github.com/ethyca/fides/pull/5104)
Expand Down
6 changes: 3 additions & 3 deletions clients/admin-ui/cypress/e2e/messaging.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Messaging", () => {
cy.login();
stubPlus(true);

cy.intercept("/api/v1/messaging/templates/summary?*", {
cy.intercept("/api/v1/plus/messaging/templates/summary?*", {
fixture: "messaging/summary.json",
}).as("getEmailTemplatesSummary");

Expand All @@ -20,13 +20,13 @@ describe("Messaging", () => {
fixture: "properties/properties.json",
}).as("getProperties");

cy.intercept("PATCH", "/api/v1/messaging/templates/*", {}).as(
cy.intercept("PATCH", "/api/v1/plus/messaging/templates/*", {}).as(
"patchTemplate"
);

cy.intercept(
"POST",
"/api/v1/messaging/templates/privacy_request_complete_access",
"/api/v1/plus/messaging/templates/privacy_request_complete_access",
{}
).as("postTemplate");
});
Expand Down
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;
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { baseApi } from "~/features/common/api.slice";
import {
MinimalProperty,
Page_MessagingTemplateWithPropertiesSummary_,
} from "~/types/api";
import { MinimalProperty } from "~/types/api";
import { BulkUpdateFailed } from "~/types/api/models/BulkUpdateFailed";

export type MessagingTemplate = {
Expand Down Expand Up @@ -70,17 +67,6 @@ const messagingTemplatesApi = baseApi.injectEndpoints({
query: () => ({ url: `messaging/templates` }),
providesTags: () => ["Messaging Templates"],
}),
getSummaryMessagingTemplates: build.query<
Page_MessagingTemplateWithPropertiesSummary_,
any
>({
query: (params) => ({
method: "GET",
url: `messaging/templates/summary`,
params,
}),
providesTags: () => ["Property-Specific Messaging Templates"],
}),
updateMessagingTemplates: build.mutation<
BulkPutMessagingTemplateResponse,
MessagingTemplate[]
Expand All @@ -90,7 +76,7 @@ const messagingTemplatesApi = baseApi.injectEndpoints({
method: "PUT",
body: templates,
}),
invalidatesTags: () => ["Property-Specific Messaging Templates"],
invalidatesTags: () => ["Messaging Templates"],
}),
// Render data from existing template- GET by id
getMessagingTemplateById: build.query<MessagingTemplateResponse, string>({
Expand All @@ -99,30 +85,6 @@ const messagingTemplatesApi = baseApi.injectEndpoints({
}),
providesTags: () => ["Property-Specific Messaging Templates"],
}),
// Update existing template
putMessagingTemplateById: build.mutation<
MessagingTemplateResponse,
MessagingTemplateUpdate
>({
query: ({ templateId, template }) => ({
url: `/messaging/templates/${templateId}`,
method: "PUT",
body: template,
}),
invalidatesTags: () => ["Property-Specific Messaging Templates"],
}),
// Update existing template
patchMessagingTemplateById: build.mutation<
MessagingTemplateResponse,
MessagingTemplatePatch
>({
query: ({ templateId, template }) => ({
url: `/messaging/templates/${templateId}`,
method: "PATCH",
body: template,
}),
invalidatesTags: () => ["Property-Specific Messaging Templates"],
}),
// endpoint for rendering data for default template- GET by type
getMessagingTemplateDefault: build.query<
MessagingTemplateDefaultResponse,
Expand All @@ -132,18 +94,6 @@ const messagingTemplatesApi = baseApi.injectEndpoints({
url: `/messaging/templates/default/${templateType}`,
}),
}),
// endpoint for creating new messaging template- POST by type
createMessagingTemplateByType: build.mutation<
MessagingTemplateResponse,
MessagingTemplateCreate
>({
query: ({ templateType, template }) => ({
url: `/messaging/templates/${templateType}`,
method: "POST",
body: template,
}),
invalidatesTags: () => ["Property-Specific Messaging Templates"],
}),
// delete template by id
deleteMessagingTemplateById: build.mutation<void, string>({
query: (templateId: string) => ({
Expand All @@ -158,11 +108,7 @@ const messagingTemplatesApi = baseApi.injectEndpoints({
export const {
useGetMessagingTemplatesQuery,
useUpdateMessagingTemplatesMutation,
useGetSummaryMessagingTemplatesQuery,
useGetMessagingTemplateByIdQuery,
usePutMessagingTemplateByIdMutation,
useGetMessagingTemplateDefaultQuery,
useCreateMessagingTemplateByTypeMutation,
useDeleteMessagingTemplateByIdMutation,
usePatchMessagingTemplateByIdMutation,
} = messagingTemplatesApi;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useToast } from "fidesui";
import { useCallback } from "react";

import { errorToastParams, successToastParams } from "~/features/common/toast";
import { usePatchMessagingTemplateByIdMutation } from "~/features/messaging-templates/messaging-templates.slice";
import { usePatchMessagingTemplateByIdMutation } from "~/features/messaging-templates/messaging-templates.slice.plus";
import { isErrorResult } from "~/types/errors";

const useMessagingTemplateToggle = () => {
Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/pages/messaging/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
MessagingTemplateCreateOrUpdate,
useDeleteMessagingTemplateByIdMutation,
useGetMessagingTemplateByIdQuery,
usePutMessagingTemplateByIdMutation,
} from "~/features/messaging-templates/messaging-templates.slice";
import { usePutMessagingTemplateByIdMutation } from "~/features/messaging-templates/messaging-templates.slice.plus";
import PropertySpecificMessagingTemplateForm, {
FormValues,
} from "~/features/messaging-templates/PropertySpecificMessagingTemplateForm";
Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/pages/messaging/add-template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import Layout from "~/features/common/Layout";
import { errorToastParams, successToastParams } from "~/features/common/toast";
import {
MessagingTemplateCreateOrUpdate,
useCreateMessagingTemplateByTypeMutation,
useGetMessagingTemplateDefaultQuery,
} from "~/features/messaging-templates/messaging-templates.slice";
import { useCreateMessagingTemplateByTypeMutation } from "~/features/messaging-templates/messaging-templates.slice.plus";
import PropertySpecificMessagingTemplateForm, {
FormValues,
} from "~/features/messaging-templates/PropertySpecificMessagingTemplateForm";
Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/pages/messaging/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { PaginationBar } from "~/features/common/table/v2/PaginationBar";
import AddMessagingTemplateModal from "~/features/messaging-templates/AddMessagingTemplateModal";
import { CustomizableMessagingTemplatesEnum } from "~/features/messaging-templates/CustomizableMessagingTemplatesEnum";
import CustomizableMessagingTemplatesLabelEnum from "~/features/messaging-templates/CustomizableMessagingTemplatesLabelEnum";
import { useGetSummaryMessagingTemplatesQuery } from "~/features/messaging-templates/messaging-templates.slice";
import { useGetSummaryMessagingTemplatesQuery } from "~/features/messaging-templates/messaging-templates.slice.plus";
import useMessagingTemplateToggle from "~/features/messaging-templates/useMessagingTemplateToggle";
import { useGetConfigurationSettingsQuery } from "~/features/privacy-requests";
import { useGetAllPropertiesQuery } from "~/features/properties";
Expand Down
Loading

0 comments on commit 139d0a6

Please sign in to comment.