From a1ae67c2b8a8b23d7417530a3b963896ca443bd0 Mon Sep 17 00:00:00 2001
From: Seth Woodworth <seth@sethish.com>
Date: Sat, 7 Jan 2012 12:38:40 -0500
Subject: [PATCH] adding schema for harvard courses via cs50.net

---
 models.js | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/models.js b/models.js
index 15b8125..ee34931 100644
--- 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( {
-- 
2.25.1