summaryrefslogtreecommitdiff
path: root/src/models/EventGroup.js
blob: 1a4ac64e4bcbba96af7b24e2b169a017086c9053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const mongoose = require("mongoose");

const Subscriber = new mongoose.Schema({
  email: {
    type: String,
    trim: true,
  },
});

const EventGroupSchema = new mongoose.Schema({
  id: {
    type: String,
    required: true,
    unique: true,
  },
  name: {
    type: String,
    trim: true,
    required: true,
  },
  description: {
    type: String,
    trim: true,
    required: true,
  },
  image: {
    type: String,
    trim: true,
  },
  url: {
    type: String,
    trim: true,
  },
  creatorEmail: {
    type: String,
    trim: true,
  },
  hostName: {
    type: String,
    trim: true,
  },
  editToken: {
    type: String,
    trim: true,
    minlength: 32,
    maxlength: 32,
  },
  firstLoad: {
    type: Boolean,
    trim: true,
    default: true,
  },
  events: [{ type: mongoose.Schema.Types.ObjectId, ref: "Event" }],
  subscribers: [Subscriber],
});

module.exports = mongoose.model("EventGroup", EventGroupSchema);