diff --git a/src/services/attendees/attendee-schema.ts b/src/services/attendees/attendee-schema.ts index 79baebe..358795d 100644 --- a/src/services/attendees/attendee-schema.ts +++ b/src/services/attendees/attendee-schema.ts @@ -3,51 +3,23 @@ import { z } from "zod"; // Zod schema for attendee const AttendeeValidator = z.object({ + userId: z.string(), name: z.string(), email: z.string().email(), - studentInfo: z.object({ - university: z.string().nonempty(), - graduation: z.string().nullable().optional(), - major: z.string().nullable().optional(), - }), events: z.array(z.string()), dietary_restrictions: z.string(), - age: z.number().nullable().optional(), - gender: z.string().nullable().optional(), - race: z.array(z.string()).nullable().optional(), - ethnicity: z.string().nullable().optional(), - first_gen: z.string().nullable().optional(), - hear_about_rp: z.array(z.string()).nullable().optional(), - portfolio: z.string().nullable().optional(), - job_interest: z.array(z.string()).nullable().optional(), - interest_mech_puzzle: z.array(z.string()).nullable().optional(), priority_expiry: z.date().nullable().optional(), - has_resume: z.boolean().optional(), - points: z.number().min(0).default(0), // + points: z.number().min(0).default(0), }); // Mongoose schema for attendee const AttendeeSchema = new mongoose.Schema({ + userId: { type: String, required: true, unique: true }, name: { type: String, required: true }, email: { type: String, required: true, unique: true }, - studentInfo: { - university: { type: String, required: true }, - graduation: { type: String, default: null }, - major: { type: String, default: null }, - }, events: [{ type: mongoose.Schema.Types.ObjectId, ref: "Event" }], dietary_restrictions: { type: String, required: true }, - age: { type: Number, default: null }, - gender: { type: String, default: null }, - race: [{ type: String }], - ethnicity: { type: String, default: null }, - first_gen: { type: String, default: null }, - hear_about_rp: [{ type: String }], - portfolio: { type: String, default: null }, - job_interest: [{ type: String }], - interest_mech_puzzle: [{ type: String }], priority_expiry: { type: Date, default: null }, - has_resume: { type: Boolean, default: false }, points: { type: Number, default: 0 }, }); diff --git a/src/services/registration/registration-schema.ts b/src/services/registration/registration-schema.ts index 2a35c14..ede0edc 100644 --- a/src/services/registration/registration-schema.ts +++ b/src/services/registration/registration-schema.ts @@ -1,22 +1,50 @@ import mongoose from "mongoose"; -import { z } from "zod"; +import { boolean, z } from "zod"; // Zod schema for registration const RegistrationValidator = z.object({ + userId: z.string(), name: z.string(), email: z.string().email(), - events: z.array(z.string()), + studentInfo: z.object({ + university: z.string().nonempty(), + graduation: z.string().nullable().optional(), + major: z.string().nullable().optional(), + }), dietary_restrictions: z.string(), - points: z.number().min(0).default(0), + age: z.number().nullable().optional(), + gender: z.string().nullable().optional(), + race: z.array(z.string()).nullable().optional(), + ethnicity: z.array(z.string()).nullable().optional(), + first_gen: z.string().nullable().optional(), + hear_about_rp: z.array(z.string()).nullable().optional(), + portfolio: z.string().nullable().optional(), + job_interest: z.array(z.string()).nullable().optional(), + interest_mech_puzzle: z.array(z.string()).nullable().optional(), + has_resume: z.boolean() }); // Mongoose schema for registration const RegistrationSchema = new mongoose.Schema({ + userId: {type: String, required: true, unique: true }, name: { type: String, required: true }, email: { type: String, required: true, unique: true }, - events: [{ type: mongoose.Schema.Types.ObjectId, ref: "Event" }], + studentInfo: { + university: { type: String, required: true }, + graduation: { type: String, default: null }, + major: { type: String, default: null }, + }, dietary_restrictions: { type: String, required: true }, - points: { type: Number, default: 0 }, + age: { type: Number, default: null }, + gender: { type: String, default: null }, + race: [{ type: String }], + ethnicity: [{ type: String }], + first_gen: { type: String, default: null }, + hear_about_rp: [{ type: String }], + portfolio: { type: String, default: null }, + job_interest: [{ type: String }], + interest_mech_puzzle: [{ type: String }], + has_resume: { type: Boolean, default: false }, }); export { RegistrationSchema, RegistrationValidator };