-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tried to do a relationship and ended in failure
- Loading branch information
Showing
5 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
var mongoose = require('mongoose'); | ||
var moment = require('moment'); | ||
var Schema = mongoose.Schema; | ||
|
||
var AssignmentType = require('./assignmenttype'); | ||
var AssignmentSchema = new Schema ({ | ||
_assign: {type: Number, ref: 'AssignmentType'}, | ||
title: String, | ||
course: Array, | ||
dueDate: {type: Date, min: moment().subtract(1, 'day'), max: moment().add(2, 'years').calendar()}, | ||
progress: {type: Number, min: 0, max: 100}, | ||
complete: Boolean, | ||
category: String | ||
}); | ||
|
||
module.exports = mongoose.model('Assignment', AssignmentSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var mongoose = require('mongoose'); | ||
var Schema = mongoose.Schema; | ||
var Assignment = require('./assignment'); | ||
|
||
|
||
|
||
var AssignmentTypeSchema = new Schema({ | ||
_id: Number, | ||
category: String, | ||
fieldOne: { | ||
name: {type: String}, | ||
length: {type: Number} | ||
}, | ||
fieldTwo: { | ||
name: {type: String}, | ||
length: {type: Number} | ||
}, | ||
fieldThree: { | ||
name: {type: String}, | ||
length: {type: Number} | ||
}, | ||
assignment: [{type: Schema.Types.ObjectId, ref: 'Assignment'}] | ||
}); | ||
|
||
module.exports = mongoose.model('AssignmentType', AssignmentTypeSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters