edx-modulestore
Advanced tools
Comparing version 2.6.0 to 2.7.0
@@ -67,2 +67,4 @@ 'use strict'; | ||
models.cleanup(); | ||
this.removeAllListeners(this.connection); | ||
@@ -69,0 +71,0 @@ delete this.connection; |
'use strict'; | ||
var mongoose = require('mongoose'); | ||
var mongoose = require('mongoose'); | ||
@@ -8,8 +8,8 @@ // Register `Long' type | ||
var ModuleSchema = require('./module'); | ||
var CourseSchema = require('./course'); | ||
var AboutSchema = require('./about'); | ||
var ChapterSchema = require('./chapter'); | ||
var ModuleSchema = require('./module'); | ||
var CourseSchema = require('./course'); | ||
var AboutSchema = require('./about'); | ||
var ChapterSchema = require('./chapter'); | ||
var SequentialSchema = require('./sequential'); | ||
var ProblemSchema = require('./problem'); | ||
var ProblemSchema = require('./problem'); | ||
@@ -22,2 +22,3 @@ // ## // | ||
Module = connection.model('Module', ModuleSchema); | ||
Course = Module.discriminator('course', CourseSchema); | ||
@@ -30,5 +31,21 @@ About = Module.discriminator('about', AboutSchema); | ||
var cleanup = function () { | ||
// This removes the discriminatorKey from the schemas. | ||
// We’re doing this to make sure that the schema/models | ||
// are re-usable. | ||
// Model.discriminator will call Schema.add() with the | ||
// configured discriminatorKey. Calling Model.discriminator() | ||
// when the discriminatorKey is already defined will fail. | ||
CourseSchema.remove(CourseSchema.options.discriminatorKey); | ||
AboutSchema.remove(AboutSchema.options.discriminatorKey); | ||
ChapterSchema.remove(ChapterSchema.options.discriminatorKey); | ||
SequentialSchema.remove(SequentialSchema.options.discriminatorKey); | ||
ProblemSchema.remove(ProblemSchema.options.discriminatorKey); | ||
}; | ||
// ## // | ||
exports.setup = setup; | ||
exports.cleanup = cleanup; | ||
@@ -35,0 +52,0 @@ exports.__defineGetter__('Module', function () { return Module; }); |
{ | ||
"name": "edx-modulestore", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "Easy browsing of Open edX Modulestores", | ||
@@ -5,0 +5,0 @@ "author": "Bertrand Marron", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39281
1258