2
0
Fork 0
tcrud/lib/default/default-tentity.js
2017-06-10 16:53:29 +02:00

29 lines
693 B
JavaScript

module.exports = (function () {
return function DefaultTEntityPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'defaultTEntity';
ctx.description = 'Adds the basic data and structure of the tentity.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'default-tentity.json';
};
this.fillTEntity = function(ctx) {
if (ctx.tentity === undefined) {
throw new Error('no tentity');
}
if (ctx.tentity.tid === undefined) {
throw new Error('no tentity.tid');
}
if (ctx.tentity.tid === null) {
throw new Error('null tentity.tid');
}
if (ctx.tentity.tid.length === 0) {
throw new Error('empty tentity.tid');
}
};
};
})();