Skip to content

Commit

Permalink
Cyberleague: Rename module in CLModule to avoid problems with klesia
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Sep 26, 2024
1 parent 0ed9e7a commit feb33fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions backend/web/server/models/CLModules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const mongoose = require('mongoose')
const {getDataModel} = require('../../config/config')

let CLModuleSchema=null

try {
CLModuleSchema=require(`../plugins/${getDataModel()}/schemas/CLModuleSchema`)
CLModuleSchema.plugin(require('mongoose-lean-virtuals'))
}
catch(err) {
if (err.code !== 'MODULE_NOT_FOUND') {
throw err
}
}

module.exports = CLModuleSchema ? mongoose.model('clModule', CLModuleSchema) : null
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const {schemaOptions} = require('../../../utils/schemas')

const Schema = mongoose.Schema

const ModuleSchema = new Schema({
const CLModuleSchema = new Schema({
resources: {
type: [{
type: Schema.Types.ObjectID,
Expand All @@ -26,4 +26,4 @@ const ModuleSchema = new Schema({
/* eslint-disable prefer-arrow-callback */
/* eslint-enable prefer-arrow-callback */

module.exports = ModuleSchema
module.exports = CLModuleSchema
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Schema = mongoose.Schema
const ProgramSchema = new Schema({
modules: {
type: Schema.Types.ObjectId,
ref: 'module',
ref: 'cLModule',
required: [true, 'Les modules sont obligatoires'],
},
name: {
Expand Down

0 comments on commit feb33fa

Please sign in to comment.