Skip to content

Commit

Permalink
Merge pull request #36 from hack4impact-calpoly/8-createDocumentSchema
Browse files Browse the repository at this point in the history
feat: Create Document Schema #8
  • Loading branch information
ktaschek authored Feb 5, 2025
2 parents 7f733ef + 6f07c3c commit 44e1b2c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/database/documentSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import mongoose, { Schema, Document } from "mongoose";

type IDocument = Document & {
clerkId: string;
eventId: mongoose.Types.ObjectId;
s3DocId: string;
documentType: string;
createdAt: Date;
status: "Completed" | "Pending" | "Not Submitted";
checkList: string[];
};

const DocumentSchema = new Schema<IDocument>({
clerkId: { type: String, required: true },
eventId: { type: Schema.Types.ObjectId, ref: "Event", required: true },
s3DocId: { type: String, required: true },
documentType: { type: String, required: true },
createdAt: { type: Date, default: Date.now },
status: {
type: String,
enum: ["Completed", "Pending", "Not Submitted"],
default: "Not Submitted",
},
checkList: { type: [String], default: [] },
});

export default mongoose.models.Document || mongoose.model<IDocument>("Document", DocumentSchema);

0 comments on commit 44e1b2c

Please sign in to comment.