Added new attributes for picto

parent 48be7663
...@@ -95,24 +95,42 @@ module.exports = { ...@@ -95,24 +95,42 @@ module.exports = {
* @param {request} req {} (with studentId specified as url parameters) * @param {request} req {} (with studentId specified as url parameters)
* @param {response} res * @param {response} res
* { * {
* id: 12, "office": 383,
* office: 1234, "id": 92,
* username: 'johnydoe', "username": "jose",
* name: 'Johny', "name": "AAjose",
* surname: 'Doe', "surname": "AAjose antonio",
* birthdate: '2009-12-10T00:00:00.000Z', "birthdate": "2009-05-12T00:00:00.000Z",
* gender: 'F', "gender": "M",
* country: 'ES', "country": "ES",
* pic: 'avatar/nice/url.jpg', "pic": "/upload/studentAvatar/defaultAvatar.jpg",
* notes: null, "notes": "",
* lang: 'en-en', "lang": "es-es",
* iat: 123512, "current_method": "Comunicación Aumentativa y Adaptativa", // May be "no method"
* exp: 1231292, "current_instruction": "Fase 4 - Estructura de la oración", // May be "no instruction"
* attributes: { @see Student.getValidAttributes() }, "supervision": 2 // supervision level according to requester 0 -> office admin, 1 -> tutor, 2 -> therapist, 3 -> student himself
* current_method: 'Do Things', // May be null "attributes": { @see Student.getValidAttributes()
* current_instruction: 'Do Stuff', // May be null "categories": true,
* supervision: 0|1|2, // supervision level according to requester 0 -> office admin, 1 -> tutor, 2 -> therapist "input_feedback": {
* } "vibration": true,
"read": false,
"beep": false,
"highlight": false
},
"input_selection": {
"click": true,
"double_click": false,
"long_press": false,
"drag": true
},
"legend": false,
"legend_size": "normal",
"size": "large",
"picto_background": "#0000ff",
"tape_background": "#00ffff",
"delivery": 0
}
}
*/ */
getInfo: function (req, res) { getInfo: function (req, res) {
Student.findOne({id: req.params.id_stu}) Student.findOne({id: req.params.id_stu})
...@@ -966,7 +984,9 @@ module.exports = { ...@@ -966,7 +984,9 @@ module.exports = {
* legend: true/[false], * legend: true/[false],
* legend_size: '[small]/large', * legend_size: '[small]/large',
* expression: 'custom expression', * expression: 'custom expression',
* color: any valid HEX color or [null] * color: any valid HEX color or [null],
* sound_uri: path to sound file,
* user_avatar: email (supervisor) or username (student) for associated account
* } * }
* }, * },
* } * }
......
...@@ -90,6 +90,8 @@ module.exports = { ...@@ -90,6 +90,8 @@ module.exports = {
color: null, color: null,
expression: null, expression: null,
legend: 'none', legend: 'none',
uri_sound: null,
user_avatar: null
}; };
if (typeof attributes === 'object') { if (typeof attributes === 'object') {
...@@ -135,6 +137,12 @@ module.exports = { ...@@ -135,6 +137,12 @@ module.exports = {
if (!((/^#([0-9a-f]{3}){1,2}$/i).test(validAttributes.color))) { if (!((/^#([0-9a-f]{3}){1,2}$/i).test(validAttributes.color))) {
delete validAttributes.color; delete validAttributes.color;
} }
if (typeof validAttributes.sound_uri!== 'string') {
delete validAttributes.sound_uri;
}
if (typeof validAttributes.user_avatar !== 'string') {
delete validAttributes.user_avatar;
}
} }
sails.log.verbose('Valid attributes for StuPicto', validAttributes); sails.log.verbose('Valid attributes for StuPicto', validAttributes);
return Object.assign({}, defaultAttributes, validAttributes); return Object.assign({}, defaultAttributes, validAttributes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment