diff --git a/frontend/admin/src/js/api/userOperations.graphql b/frontend/admin/src/js/api/userOperations.graphql index 78e1824f9c6..bbaa6dbf1f4 100644 --- a/frontend/admin/src/js/api/userOperations.graphql +++ b/frontend/admin/src/js/api/userOperations.graphql @@ -97,6 +97,7 @@ mutation CreateUser($user: CreateUserInput!) { mutation UpdateUserAsUser($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id sub firstName lastName @@ -167,6 +168,7 @@ mutation UpdateUserAsUser($id: ID!, $user: UpdateUserAsUserInput!) { mutation UpdateUserAsAdmin($id: ID!, $user: UpdateUserAsAdminInput!) { updateUserAsAdmin(id: $id, user: $user) { + id sub roles diff --git a/frontend/admin/src/js/components/user/UpdateUser.tsx b/frontend/admin/src/js/components/user/UpdateUser.tsx index 8b403f8c3f8..509fc0f8f59 100644 --- a/frontend/admin/src/js/components/user/UpdateUser.tsx +++ b/frontend/admin/src/js/components/user/UpdateUser.tsx @@ -53,6 +53,7 @@ export const UpdateUserForm: React.FunctionComponent = ({ values: FormValues, ): UpdateUserAsAdminInput => ({ ...values, + id: initialUser.id, // empty string isn't valid according to API validation regex pattern, but null is valid. telephone: emptyToNull(values.telephone), // empty string will violate uniqueness constraints @@ -240,15 +241,18 @@ const UpdateUser: React.FunctionComponent<{ userId: string }> = ({ graphql operation to fail. */ executeMutation({ id, - user: pick(data, [ - "email", - "firstName", - "lastName", - "telephone", - "preferredLang", - "sub", - "roles", - ]), + user: { + id, + ...pick(data, [ + "email", + "firstName", + "lastName", + "telephone", + "preferredLang", + "sub", + "roles", + ]), + }, }).then((result) => { if (result.data?.updateUserAsAdmin) { return result.data.updateUserAsAdmin; @@ -258,7 +262,6 @@ const UpdateUser: React.FunctionComponent<{ userId: string }> = ({ return ( - {" "} {userData?.user ? ( = ({ }); const formValuesToSubmitData = (data: FormValues): UpdateUserAsUserInput => { - return data; + return { + ...data, + id: initialUser.id, + }; }; const handleSubmit: SubmitHandler = async (formValues) => { diff --git a/frontend/talentsearch/src/js/components/aboutMeForm/aboutMeFormOperations.graphql b/frontend/talentsearch/src/js/components/aboutMeForm/aboutMeFormOperations.graphql index 72c825716f7..7b1329058e9 100644 --- a/frontend/talentsearch/src/js/components/aboutMeForm/aboutMeFormOperations.graphql +++ b/frontend/talentsearch/src/js/components/aboutMeForm/aboutMeFormOperations.graphql @@ -16,6 +16,7 @@ query getAboutMe { mutation UpdateUserAsUser($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id preferredLang currentProvince currentCity diff --git a/frontend/talentsearch/src/js/components/createAccount/CreateAccountPage.tsx b/frontend/talentsearch/src/js/components/createAccount/CreateAccountPage.tsx index fb1472690c5..8f1b5625486 100644 --- a/frontend/talentsearch/src/js/components/createAccount/CreateAccountPage.tsx +++ b/frontend/talentsearch/src/js/components/createAccount/CreateAccountPage.tsx @@ -304,7 +304,10 @@ const CreateAccount: React.FunctionComponent = () => { const handleCreateAccount = (id: string, data: UpdateUserAsUserInput) => executeMutation({ id, - user: data, + user: { + ...data, + id, + }, }).then((result) => { if (result.data?.updateUserAsUser) { return result.data.updateUserAsUser; diff --git a/frontend/talentsearch/src/js/components/createAccount/createAccountOperations.graphql b/frontend/talentsearch/src/js/components/createAccount/createAccountOperations.graphql index d60055baa96..1bf7f34bb2b 100644 --- a/frontend/talentsearch/src/js/components/createAccount/createAccountOperations.graphql +++ b/frontend/talentsearch/src/js/components/createAccount/createAccountOperations.graphql @@ -25,6 +25,7 @@ query getCreateAccountFormData { mutation CreateAccount($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id email firstName lastName diff --git a/frontend/talentsearch/src/js/components/employmentEquityForm/EmploymentEquityForm.test.tsx b/frontend/talentsearch/src/js/components/employmentEquityForm/EmploymentEquityForm.test.tsx index 216a9673d75..625b38dd1bc 100644 --- a/frontend/talentsearch/src/js/components/employmentEquityForm/EmploymentEquityForm.test.tsx +++ b/frontend/talentsearch/src/js/components/employmentEquityForm/EmploymentEquityForm.test.tsx @@ -136,7 +136,9 @@ describe("DiversityEquityInclusionForm", () => { }); it("should update on save", async () => { - const mockSave = jest.fn(() => Promise.resolve({ data: {} })); + const mockSave = jest.fn(() => + Promise.resolve({ id: "", data: { id: "" } }), + ); renderDiversityEquityInclusionForm({ user: { ...mockUser, diff --git a/frontend/talentsearch/src/js/components/employmentEquityForm/employmentEquityOperations.graphql b/frontend/talentsearch/src/js/components/employmentEquityForm/employmentEquityOperations.graphql index 916d253e2ce..dc6d2696872 100644 --- a/frontend/talentsearch/src/js/components/employmentEquityForm/employmentEquityOperations.graphql +++ b/frontend/talentsearch/src/js/components/employmentEquityForm/employmentEquityOperations.graphql @@ -10,6 +10,7 @@ query getMyDiversityInfo { mutation updateMyDiversityInfo($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id isWoman isIndigenous isVisibleMinority diff --git a/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationForm.stories.tsx b/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationForm.stories.tsx index 5db8a5f9e9f..a2dde86491c 100644 --- a/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationForm.stories.tsx +++ b/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationForm.stories.tsx @@ -3,6 +3,7 @@ import { action } from "@storybook/addon-actions"; import { Meta, Story } from "@storybook/react"; import { fakeUsers } from "@common/fakeData"; import { pick } from "lodash"; +import { UpdateUserAsUserInput } from "@common/api/generated"; import { LanguageInformationForm } from "./LanguageInformationForm"; export default { @@ -19,9 +20,9 @@ const TemplateLangInfoForm: Story = (args) => { return ( { + submitHandler={async (id: string, data: UpdateUserAsUserInput) => { action("Update Language Information")(id, data); - return Promise.resolve(data); + return Promise.resolve(null); }} /> ); diff --git a/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationOperations.graphql b/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationOperations.graphql index 14e6dc99820..871485633bb 100644 --- a/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationOperations.graphql +++ b/frontend/talentsearch/src/js/components/languageInformationForm/LanguageInformationOperations.graphql @@ -15,6 +15,7 @@ query GetLanguageInformation { mutation UpdateLanguageInformation($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id lookingForEnglish lookingForFrench lookingForBilingual diff --git a/frontend/talentsearch/src/js/components/myStatusForm/myStatusOperations.graphql b/frontend/talentsearch/src/js/components/myStatusForm/myStatusOperations.graphql index c3fe19b91d1..5d9e2627844 100644 --- a/frontend/talentsearch/src/js/components/myStatusForm/myStatusOperations.graphql +++ b/frontend/talentsearch/src/js/components/myStatusForm/myStatusOperations.graphql @@ -8,6 +8,7 @@ query getMyStatus { mutation UpdateMyStatus($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id jobLookingStatus } } diff --git a/frontend/talentsearch/src/js/components/roleSalaryForm/RoleSalaryFormOperations.graphql b/frontend/talentsearch/src/js/components/roleSalaryForm/RoleSalaryFormOperations.graphql index a8660302c28..53c34a39413 100644 --- a/frontend/talentsearch/src/js/components/roleSalaryForm/RoleSalaryFormOperations.graphql +++ b/frontend/talentsearch/src/js/components/roleSalaryForm/RoleSalaryFormOperations.graphql @@ -19,6 +19,7 @@ query getRoleSalaryInfo { mutation UpdateRoleSalary($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id expectedGenericJobTitles { id key diff --git a/frontend/talentsearch/src/js/components/workLocationPreferenceForm/workLocationPreferenceOperations.graphql b/frontend/talentsearch/src/js/components/workLocationPreferenceForm/workLocationPreferenceOperations.graphql index 88edbf52ef8..ecd3a05c1fd 100644 --- a/frontend/talentsearch/src/js/components/workLocationPreferenceForm/workLocationPreferenceOperations.graphql +++ b/frontend/talentsearch/src/js/components/workLocationPreferenceForm/workLocationPreferenceOperations.graphql @@ -9,6 +9,7 @@ query WorkLocationPreference { mutation createWorkLocationPreference($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id locationPreferences locationExemptions isProfileComplete diff --git a/frontend/talentsearch/src/js/components/workPreferencesForm/workPreferenceOperations.graphql b/frontend/talentsearch/src/js/components/workPreferencesForm/workPreferenceOperations.graphql index dff1aa018da..c13298bea7d 100644 --- a/frontend/talentsearch/src/js/components/workPreferencesForm/workPreferenceOperations.graphql +++ b/frontend/talentsearch/src/js/components/workPreferencesForm/workPreferenceOperations.graphql @@ -9,6 +9,7 @@ query getWorkPreferences { mutation UpdateWorkPreferences($id: ID!, $user: UpdateUserAsUserInput!) { updateUserAsUser(id: $id, user: $user) { + id wouldAcceptTemporary acceptedOperationalRequirements isProfileComplete