when student deleted, license is removed

parent f910fd07
...@@ -48,22 +48,6 @@ COMMENT="This table registers and action performed by a user at a given time, al ...@@ -48,22 +48,6 @@ COMMENT="This table registers and action performed by a user at a given time, al
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Estructura de tabla para la tabla `catexp`
--
CREATE TABLE IF NOT EXISTS `catexp`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_cat` int(11) NOT NULL,
`lang` char(5),
`exp` varchar(30) NOT NULL,
PRIMARY KEY(`id`),
UNIQUE(exp,lang),
CHECK (lang IN ('es-es','en-gb','en-us'))
)
COMMENT="Stores the expressions available in several languages for a given category (id_cat)";
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `method` -- Estructura de tabla para la tabla `method`
-- --
...@@ -174,20 +158,6 @@ CREATE TABLE IF NOT EXISTS `picto` ( ...@@ -174,20 +158,6 @@ CREATE TABLE IF NOT EXISTS `picto` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=104142 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=104142
COMMENT="Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)"; COMMENT="Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)";
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pictocat`
--
CREATE TABLE IF NOT EXISTS `pictocat`(
`id` int(11) PRIMARY KEY,
`id_supercat` int(11)
)
COMMENT="Identifies a category, which, itself, may belong to another category";
-- --------------------------------------------------------
-- --
-- Estructura de tabla para la tabla `picto_acl` -- Estructura de tabla para la tabla `picto_acl`
-- NOT IN USE (candidate for removal) -- NOT IN USE (candidate for removal)
......
...@@ -245,7 +245,7 @@ module.exports = { ...@@ -245,7 +245,7 @@ module.exports = {
beforeCreate: function (attrs, next) { beforeCreate: function (attrs, next) {
attrs.attributes = Student.getValidAttributes(attrs.attributes); attrs.attributes = Student.getValidAttributes(attrs.attributes);
attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync()); attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync());
attrs.pic = sails.config.pictogram.urls.getStudentAvatarUrl(); attrs.pic = sails.config.pictogram.paths.defaultAvatarFileName;
next(); next();
}, },
...@@ -519,7 +519,9 @@ module.exports = { ...@@ -519,7 +519,9 @@ module.exports = {
username: Math.floor((Math.random() * 100000000) + 1) + "_" + student.username, username: Math.floor((Math.random() * 100000000) + 1) + "_" + student.username,
id_off: null id_off: null
}) })
.then((updated) => {cb()}) .then((updated) => {
License.destroy({id_stu: id_stu}).exec(cb);
})
.catch((err) => {cb(err)}); .catch((err) => {cb(err)});
}); });
} }
......
...@@ -235,7 +235,7 @@ module.exports = { ...@@ -235,7 +235,7 @@ module.exports = {
async.eachSeries(stuSups, function(stuSup, next_cb) { async.eachSeries(stuSups, function(stuSup, next_cb) {
// Filter logically deleted students // Filter logically deleted students
if (stuSup.student.office == null) if (stuSup.student.office == null)
next_cb(); return next_cb();
// set current method and instruction if any // set current method and instruction if any
Student.findOne(stuSup.student.id) Student.findOne(stuSup.student.id)
......
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