Skip to content

Commit e9fd23d

Browse files
authored
fix: unable to add users from the admin page (calcom#23869)
1 parent badc857 commit e9fd23d

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

packages/features/ee/users/components/UserForm.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ type OptionValues = {
3030
identityProvider: Option;
3131
};
3232

33-
type FormValues = Pick<User, "avatarUrl" | "name" | "username" | "email" | "bio"> & OptionValues;
33+
type FormValues = Pick<
34+
User,
35+
"avatarUrl" | "name" | "username" | "email" | "bio" | "theme" | "defaultScheduleId" | "allowDynamicBooking"
36+
> &
37+
OptionValues;
3438

3539
export const UserForm = ({
3640
defaultValues,
@@ -79,6 +83,9 @@ export const UserForm = ({
7983
username: defaultValues?.username,
8084
email: defaultValues?.email,
8185
bio: defaultValues?.bio,
86+
theme: defaultValues?.theme,
87+
defaultScheduleId: defaultValues?.defaultScheduleId,
88+
allowDynamicBooking: defaultValues?.allowDynamicBooking,
8289
locale: {
8390
value: defaultLocale,
8491
label: new Intl.DisplayNames(defaultLocale, { type: "language" }).of(defaultLocale) || "",

packages/features/ee/users/pages/users-add-view.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { usePathname, useRouter } from "next/navigation";
44

5+
import { getParserWithGeneric } from "@calcom/prisma/zod-utils";
56
import { trpc } from "@calcom/trpc/react";
67
import { showToast } from "@calcom/ui/components/toast";
78

@@ -33,7 +34,8 @@ const UsersAddView = () => {
3334
<UserForm
3435
submitLabel="Add user"
3536
onSubmit={async (values) => {
36-
const parsedValues = userBodySchema.parse(values);
37+
const parser = getParserWithGeneric(userBodySchema);
38+
const parsedValues = parser(values);
3739
mutation.mutate(parsedValues);
3840
}}
3941
/>

0 commit comments

Comments
 (0)