Skip to content

Scheduling infrastructure for absolutely everyone.

omit id as it is autocreated, should not be req (#10982)

Syed Ali Shahbaz3223beb9acee
diff --git a/apps/api/lib/validations/membership.ts b/apps/api/lib/validations/membership.ts
index 24740eaa52f..4f6a5cbd8d4 100644
--- a/apps/api/lib/validations/membership.ts
+++ b/apps/api/lib/validations/membership.ts
@@ -13,16 +13,18 @@ const schemaMembershipRequiredParams = z.object({
teamId: z.number(),
});
-export const membershipCreateBodySchema = Membership.partial({
- accepted: true,
- role: true,
- disableImpersonation: true,
-}).transform((v) => ({
- accepted: false,
- role: MembershipRole.MEMBER,
- disableImpersonation: false,
- ...v,
-}));
+export const membershipCreateBodySchema = Membership.omit({ id: true })
+ .partial({
+ accepted: true,
+ role: true,
+ disableImpersonation: true,
+ })
+ .transform((v) => ({
+ accepted: false,
+ role: MembershipRole.MEMBER,
+ disableImpersonation: false,
+ ...v,
+ }));
export const membershipEditBodySchema = Membership.omit({
/** To avoid complication, let's avoid updating these, instead you can delete and create a new invite */