From 180bf218f2a8e5ac4502f93f081b1adcc78ebb67 Mon Sep 17 00:00:00 2001 From: Elsie Xu Date: Tue, 29 Oct 2024 19:25:04 -0700 Subject: [PATCH] decal start branch --- packages/common/src/models/decal.ts | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 packages/common/src/models/decal.ts diff --git a/packages/common/src/models/decal.ts b/packages/common/src/models/decal.ts new file mode 100644 index 000000000..e4794bbeb --- /dev/null +++ b/packages/common/src/models/decal.ts @@ -0,0 +1,47 @@ +import mongoose, { InferSchemaType, Schema } from "mongoose"; + +import { schemaOptions } from "../lib/common"; + +const decalSection = { + title: String, + faciliators: String, + size: Number, + location: String, + time: String, + starts: String, + status: String, + ccn: Number, +} + +const decalSchemaObject = { + id: { + type: Number, + required: true, + }, + category: { + type: String, + required: true, + }, + units: { + type: Number, + required: true, + }, + date: { + type: Date, + required: true, + }, + title: String, + description: String, + website: String, + application: String, + sections: [decalSection], + enroll: String, + contact: String, + course: String, + semester: String, +} + + +export const decalSchema = new Schema(decalSchemaObject, schemaOptions); +export const decalModel = mongoose.model("Decal", decalSchema, "decal"); +export type decalType = InferSchemaType;