forked from Bitbox-Connect/Bitbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject.js
41 lines (39 loc) · 970 Bytes
/
Project.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
const mongoose = require("mongoose");
const { Schema } = mongoose;
const ProjectSchema = new Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'user',
},
imageUrl: {
type: String,
},
title: {
type: String,
required: true,
default: "Project",
},
description: {
type: String,
maxlength: 500, // Optional limit
},
gitHubLink: {
type: String,
match: [/^https:\/\/github.com\/.+/, 'Enter a valid GitHub URL'],
},
youTubeLink: {
type: String,
match: [/^https:\/\/(www\.)?youtube.com\/watch\?v=.+/, 'Enter a valid YouTube video URL'],
},
date: {
type: Date,
default: Date.now,
required: true,
},
status: {
type: String,
enum: ['In Progress', 'Completed', 'On Hold'],
default: 'In Progress',
}
});
module.exports = mongoose.model('projects', ProjectSchema);