WaspW
Wasp2y ago
Suchitk

How to add custom Sign up field that refers another entity

I am trying to create a custom sign up where a User can select college and university through a drop down. This is my defineUserSignupFields method call:
export const getEmailUserFields = defineUserSignupFields({
  username: (data: any) => data.email,
  isAdmin: (data: any) => adminEmails.includes(data.email),
  email: (data: any) => data.email,
  firstName: (data: any) => data.firstName,
  lastName: (data: any) => data.lastName,
  academicYearLevel: (data: any) => data.academicYearLevel,
  university: (data: any) => ({
    connect: { id: data.universityId } // Assuming `universityId` is the ID of the selected university
  }),
  college: (data: any) => ({
    connect: { id: data.collegeId } // Assuming `collegeId` is the ID of the selected college
  }),
});

All of these attributes exist in my User entity however I get this error:
Unknown arg university in data.university for type UserUncheckedCreateInput. Did you mean universityId?

trying to use universityId/collegeId instead of university/college yields the same error but with typ UserCreateInput
Was this page helpful?