adding schema for harvard courses via cs50.net
authorSeth Woodworth <seth@sethish.com>
Sat, 7 Jan 2012 17:38:40 +0000 (12:38 -0500)
committerSeth Woodworth <seth@sethish.com>
Sat, 7 Jan 2012 17:38:40 +0000 (12:38 -0500)
models.js

index 15b812521b5b662a9a3dce6143b83408d7483629..ee349313c8d557f540c17676c056c4798a317f5b 100644 (file)
--- a/models.js
+++ b/models.js
@@ -161,6 +161,39 @@ SchoolSchema.method( 'authorize', function( user, cb ) {
 
 var School = mongoose.model( 'School', SchoolSchema );
 
+// harvardcourses
+
+var HarvardCourses = new Schema( {
+    cat_num         : Number,   // Catalog numb, unique_togther w/ term
+    term            : String,   // FALL or SPRING
+    bracketed       : Boolean,
+    field           : String,   // TODO: Add docs
+    number          : Number,   // string, int, float, intStringFloat
+    title           : String,
+    faculty         : String,   // hash fk to faculty table
+    description     : String,
+    prerequisites   : String,
+    notes           : String,
+    meetings        : String,   // TODO: try to auto parse this
+    building        : String,   // FIXME: Most == '', this is why we have to update
+    room            : String
+});
+
+HarvardCourses.virtual( 'sanitized' ).get(function() {
+    var class = {
+        _id     : this._id,
+        title   : this.name,
+        field   : this.field,
+        number  : this.number,
+        desc    : this.description,
+        meetings: this.meetings,
+        building: this.building,
+        room    : this.room,
+        faculty : this.faculty
+        }
+    return class
+})
+
 // courses
 
 var CourseSchema = new Schema( {