-
Notifications
You must be signed in to change notification settings - Fork 0
/
conference.js
55 lines (52 loc) · 1.19 KB
/
conference.js
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
const mongoose = require('mongoose');
const validator = require('validator');
const ConferenceSchema = new mongoose.Schema({
title: {
type: String,
required: true,
},
projects: [String],
location: {
city: {
type: String,
required: true,
},
country: {
type: String,
required: true,
},
},
tags: [String],
dateStart: {
type: Date,
required: true,
},
dateFinish: {
type: Date,
required: true,
},
participants: { type: mongoose.Schema.Types.Mixed, default: {} },
ytLink: {
type: String,
validate(url) {
return new RegExp('(http|https):\\/\\/youtrack\\.jetbrains\\.com\\/issue\\/.+-.+').test(url);
},
},
attendance: Number,
link: {
type: String,
validate(url) {
return validator.isURL(url);
},
},
comments: [String],
status: {
type: String,
enum: ['ACCEPTED', 'PROPOSED', 'REJECTED'],
required: true,
},
}, { minimize: false });
const Model = mongoose.model('Conferences', ConferenceSchema);
module.exports = {
Model,
};