{"size": 1452, "ext": "js", "max_stars_repo_path": "models/Lecture.js", "max_stars_repo_name": "kaist-mnlab/kaisquare_renewal", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/Lecture.js", "max_issues_repo_name": "kaist-mnlab/kaisquare_renewal", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/Lecture.js", "max_forks_repo_name": "kaist-mnlab/kaisquare_renewal", "max_forks_repo_forks_event_min_datetime": "2015-09-22T09:40:50.000Z", "max_forks_repo_forks_event_max_datetime": "2015-09-22T09:40:50.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 26.8888888889, "max_line_length": 65, "alphanum_fraction": 0.708677686}
var mongoose = require('mongoose');
var filePluginLib = require('mongoose-file');
var path = require('path');
var filePlugin = filePluginLib.filePlugin;
var make_upload_to_model = filePluginLib.make_upload_to_model;
var qSchema = require('./Q').QSchema;
var chatSchema = require('./Chat').ChatSchema;
var quizSchema = require('./Quiz').QuizSchema;

var uploads_base = path.join(__dirname, "uploads");
var uploads = path.join(uploads_base, "u");

// Document schema for polls
var LectureSchema = exports.LectureSchema = new mongoose.Schema({
	index: Number,
	date: {type:Date, default: Date.now, required: true},
	startTime: {type:Date, default: Date.now, required: true},
	endTime: {type:Date, default: Date.now },
	duration: Number,
	title: { type: String, required: true },
	description: { type: String, required: true },
	vod_url: String,
	//File?
	presentation_url: String,
	ppt_page: Number,

	// JSON string
	ppt_event_log: String,
	
	material_url:[{url: String}],
	course: {type: mongoose.Schema.Types.ObjectId, ref:'course'},
	
	status: Number,
	/*
	qs: [{type: mongoose.Schema.Types.ObjectId, ref:'q'}],
	chats: [{type: mongoose.Schema.Types.ObjectId, ref:'chat'}],
	quizs: [{type: mongoose.Schema.Types.ObjectId, ref:'quiz'}],
	*/
	
	
	
	hidden: Boolean,
	meta: {
		votes: Number,
		favs:  Number
		}
});

LectureSchema.plugin( filePlugin, {
	name: "video",
	upload_to: make_upload_to_model(uploads, "videos"),
	relative_to: uploads_base
});
