Skip to content

Commit 4860516

Browse files
committed
Added Announcements field
1 parent f744c04 commit 4860516

File tree

2 files changed

+61
-5
lines changed

2 files changed

+61
-5
lines changed

collections/README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ The following document describes the MongoDB Schema used by the TuxLab app:
2828
'administrator': ['global'],
2929
'instructor' : ['574465a21109160b518a4291'], // Array of IDs to Courses
3030
'student': [['574465a21109160b518a4299','574467bc1109160b518a429d']] // Array of Tuples of {CourseID, CourseRecordID}
31-
}
31+
},
32+
announcements: [
33+
{
34+
timeCreated: 1469648536858,
35+
type: 'lab',
36+
message: 'Git Lab is due in 2 Weeks',
37+
link: 'course/1/lab/12'
38+
}
39+
]
3240
},
3341
{
3442
_id : "23123454ab2d765eef993343",
@@ -48,8 +56,15 @@ The following document describes the MongoDB Schema used by the TuxLab app:
4856
},
4957
roles: {
5058
'student' : ['574465a21109160b518a4299','574467a21109160b518a4334']
51-
}
52-
59+
},
60+
announcements: [
61+
{
62+
timeCreated: 1469648536858,
63+
type: 'lab',
64+
message: 'Git Lab is due in 2 Weeks',
65+
link: 'course/1/lab/12'
66+
}
67+
]
5368
}
5469
```
5570

@@ -63,7 +78,7 @@ The following document describes the MongoDB Schema used by the TuxLab app:
6378
{
6479
name: "Derek Bro",
6580
id: "948fhp23irjer9823r3rwef"
66-
},
81+
},
6782
{
6883
name: "Tom Cortina",
6984
id: "573de804b17eca6c452d9ff7"

collections/users.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ declare var nconf: any;
99

1010
if (Meteor.isServer){
1111
Meteor.startup(function(){
12+
13+
// Defines User Profile
1214
var profileSchema = new SimpleSchema({
1315
first_name: {
1416
type: String
@@ -32,6 +34,8 @@ if (Meteor.isServer){
3234
type: String
3335
}
3436
});
37+
38+
// Defines User Abilities
3539
var roleSchema = new SimpleSchema({
3640
administrator: {
3741
type: [String],
@@ -50,8 +54,45 @@ if (Meteor.isServer){
5054
defaultValue: []
5155
}
5256
});
57+
58+
// Defines Notifications presented to user
59+
var announcementSchema = new SimpleSchema({
60+
timeCreated: {
61+
type: Date,
62+
autoValue: function(){
63+
return Date.now();
64+
}
65+
},
66+
type: {
67+
type: String,
68+
allowedValues: ['lab','instructor','tuxlab']
69+
},
70+
message: {
71+
type: String
72+
},
73+
link: {
74+
type: String,
75+
optional: true
76+
}
77+
})
78+
79+
// Overall User Schema
5380
var userSchema = new SimpleSchema({
54-
//TODO @sander
81+
services: {
82+
type: Object,
83+
optional: true,
84+
blackbox: true
85+
},
86+
profile: {
87+
type: profileSchema
88+
},
89+
roles: {
90+
type: roleSchema
91+
},
92+
announcements:{
93+
type: [announcementSchema],
94+
defaultValue: []
95+
}
5596
});
5697
(<any> Meteor.users).attachSchema(userSchema);
5798
});

0 commit comments

Comments
 (0)