Skip to content

Commit

Permalink
Create Event.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Allison67 authored Dec 6, 2023
1 parent d31a977 commit bb4c4cc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions back-end/models/Event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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 bb4c4cc

Please sign in to comment.