Skip to content

Commit

Permalink
Merge pull request #205 from agiledev-students-fall2023/joyc7-patch-1
Browse files Browse the repository at this point in the history
Create Event.js
  • Loading branch information
joyc7 authored Dec 6, 2023
2 parents 86dca5a + 7c748aa commit 15944ea
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions back-end/models/Event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const User = require("./User");
const Expense = require("./Expense");

const eventSchema = new Schema({
name: {
type: String,
required: true,
},
description: String,
date: {
type: Date,
required: true,
},
participants: [
{
type: Schema.Types.ObjectId,
ref: "User",
},
],
expenses: [
{
type: Schema.Types.ObjectId,
ref: "Expense",
},
],
});

const Event = mongoose.model("Event", eventSchema);

module.exports = Event;

0 comments on commit 15944ea

Please sign in to comment.