Modelo - lern-edu/lern GitHub Wiki
User
Model
{
_id: String
roles: [String],
emails: [Object],
services: [Object],
profile: {
name: String,
firstName: String,
lastName: String,
gender: String,
role: String,
companies: [Object],
cousers: [String],
tests: [String],
}
}
Helpers
- getRole
- getRoles
- getEmail
- getSocialEmail
- getSettingsRoute
- getHomeRoute
- getSetupRoute
- getFullName
Hooks
- beforeSave - Set full name
Company Model
Model
{
_id: String,
admins: [String], \\ Reference for _id
name: String,
plan: Object, \\ Optional for now
users: [String], \\ Optional
tags: [String] \\ Reference for _id
}
Hooks
- afterSave - Update company on user and course model
Tag Model
Model
{
_id: String,
name: String,
parents: [String], \\ Optional
childrens: [String], \\ Optional
}
Couse Model
Model
{
_id: String,
name: String,
company: String,
author: Object,
admins: [Object],
createdAt: new Date(),
students: [Object],
info: Object,
}
Tests Model
Model
const Test = Class.create({
name: 'Test',
collection: Tests,
fields: {
name: String,
students: {
type: [String],
validators: [{ type: 'References' }],
optional: true,
},
tags: [Object],
pages: {
type: [{
content: {
type: [Object],
validators: [{ type: 'minLength', param: 1 }],
},
}],
validators: [{ type: 'minLength', param: 1 }],
},
time: {
type: {
type: String,
},
timeout: {
type: Number,
optional: true,
},
range: {
type: [Object],
optional: true,
},
},
resolution: String,
help: {
type: [Content],
optional: true,
},
availableAt: {
type: {
start: Date,
end: {
type: Date,
optional: true,
},
},
optional: true,
},
},
behaviors: {
timestamp: {
hasCreatedField: true,
createdFieldName: 'createdAt',
hasUpdatedField: true,
updatedFieldName: 'updatedAt',
},
author: true,
},
});
Post Model
Model
{
_id: String,
name: String,
tags: [Object],
type: String,
content: [Object],
createdBy: Object,
comments: [Object]
}
Correction Model
{
_id: rew90ujfdsw,
attempt: Object,
corrector: Object,
corrected: _id
evaluation Object,
comments: String,
finalGrade: Number,
feedback: bool
}
Question Model
{
_id: rew90ujfdsw,
name: String,
tag: Object,
type: String,
data: [],
answer: ?,
createdBy: Object,
criteria: {timeRange: [{initial, final, score}], done: bool, moves: Number, correct: bool, level: Object, classification: Object, weight: [Object]}
}