#5666 - Loggable to mixin #1826

Merged
alexm merged 29 commits from 5666-loggable_to_mixin into dev 2024-01-04 09:21:57 +00:00
92 changed files with 369 additions and 187 deletions

View File

@ -16,6 +16,7 @@
}, },
"cSpell.words": [ "cSpell.words": [
"salix", "salix",
"fdescribe" "fdescribe",
"Loggable"
] ]
} }

View File

@ -68,7 +68,7 @@ module.exports = Self => {
userToUpdate.hasGrant = hasGrant; userToUpdate.hasGrant = hasGrant;
if (roleFk) { if (roleFk) {
const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions); const role = await models.VnRole.findById(roleFk, {fields: ['name']}, myOptions);
const hasRole = await Self.hasRole(userId, role.name, myOptions); const hasRole = await Self.hasRole(userId, role.name, myOptions);
if (!hasRole) if (!hasRole)

View File

@ -70,7 +70,7 @@ describe('VnUser privileges()', () => {
const tx = await models.VnUser.beginTransaction({}); const tx = await models.VnUser.beginTransaction({});
const options = {transaction: tx}; const options = {transaction: tx};
const agency = await models.Role.findOne({ const agency = await models.VnRole.findOne({
where: { where: {
name: 'agency' name: 'agency'
} }

View File

@ -139,9 +139,6 @@
"Warehouse": { "Warehouse": {
"dataSource": "vn" "dataSource": "vn"
}, },
"VnUser": {
"dataSource": "vn"
},
"OsTicket": { "OsTicket": {
"dataSource": "osticket" "dataSource": "osticket"
}, },
@ -156,6 +153,12 @@
}, },
"ViaexpressConfig": { "ViaexpressConfig": {
"dataSource": "vn" "dataSource": "vn"
},
"VnUser": {
"dataSource": "vn"
},
"VnRole": {
"dataSource": "vn"
} }
} }

View File

@ -29,12 +29,12 @@
"relations": { "relations": {
"readRole": { "readRole": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "readRoleFk" "foreignKey": "readRoleFk"
}, },
"writeRole": { "writeRole": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "writeRoleFk" "foreignKey": "writeRoleFk"
} }
}, },

View File

@ -46,12 +46,12 @@
}, },
"readRole": { "readRole": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "readRoleFk" "foreignKey": "readRoleFk"
}, },
"writeRole": { "writeRole": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "writeRoleFk" "foreignKey": "writeRoleFk"
} }
}, },
@ -64,4 +64,3 @@
} }
] ]
} }

View File

@ -24,7 +24,7 @@
}, },
"role": { "role": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "roleFk" "foreignKey": "roleFk"
} }
} }

13
back/models/vn-role.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "VnRole",
"base": "Role",
"validateUpsert": true,
"options": {
"mysql": {
"table": "account.role"
}
},
"mixins": {
"Loggable": true
}
}
jsegarra marked this conversation as resolved
Review

A parte de crear el modelo habria que substituir todas las ocurrencias del modelo Role por VnRole

A parte de crear el modelo habria que substituir todas las ocurrencias del modelo Role por VnRole

View File

@ -7,6 +7,9 @@
"table": "account.user" "table": "account.user"
} }
}, },
"mixins": {
"Loggable": true
},
"resetPasswordTokenTTL": "604800", "resetPasswordTokenTTL": "604800",
"properties": { "properties": {
"id": { "id": {
@ -63,7 +66,7 @@
"relations": { "relations": {
"role": { "role": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "roleFk" "foreignKey": "roleFk"
}, },
"roles": { "roles": {

View File

@ -0,0 +1,6 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES
('VnRole','*','READ','ALLOW','ROLE','employee'),
('VnRole','*','WRITE','ALLOW','ROLE','it');
DELETE FROM`salix`.`ACL` WHERE model='Role';

View File

@ -23,7 +23,6 @@ export function directive($translate, $window) {
let rule = $attrs.rule.split('.'); let rule = $attrs.rule.split('.');
let modelName = rule.shift(); let modelName = rule.shift();
let fieldName = rule.shift(); let fieldName = rule.shift();
let split = $attrs.ngModel.split('.'); let split = $attrs.ngModel.split('.');
if (!fieldName) fieldName = split.pop() || null; if (!fieldName) fieldName = split.pop() || null;
if (!modelName) modelName = firstUpper(split.pop() || ''); if (!modelName) modelName = firstUpper(split.pop() || '');

View File

@ -0,0 +1,12 @@
const LoopBackContext = require('loopback-context');
async function handleObserve(ctx) {
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
}
module.exports = function(Self) {
let Mixin = {
'before save': handleObserve,
'before delete': handleObserve,
};
for (const [listener, handler] of Object.entries(Mixin))
Self.observe(listener, handler);
};

View File

@ -1,15 +0,0 @@
const LoopBackContext = require('loopback-context');
module.exports = function(Self) {
Self.setup = function() {
Self.super_.setup.call(this);
};
Self.observe('before save', async function(ctx) {
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
});
Self.observe('before delete', async function(ctx) {
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
});
};

View File

@ -1,5 +0,0 @@
{
"name": "Loggable",
"base": "VnModel",
"validateUpsert": true
}

View File

@ -25,20 +25,19 @@
"FieldAcl": { "FieldAcl": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Role": {
"dataSource": "vn",
"options": {
"mysql": {
"table": "salix.Role"
}
}
},
"RoleMapping": { "RoleMapping": {
"dataSource": "vn", "dataSource": "vn",
"options": { "options": {
"mysql": { "mysql": {
"table": "salix.RoleMapping" "table": "salix.RoleMapping"
} }
},
"relations": {
"role": {
"type": "belongsTo",
"model": "VnRole",
"foreignKey": "roleId"
}
} }
}, },
"Schema": { "Schema": {

View File

@ -239,7 +239,7 @@ module.exports = Self => {
// Prepare data // Prepare data
let roles = await $.Role.find({ let roles = await $.VnRole.find({
fields: ['id', 'name', 'description'] fields: ['id', 'name', 'description']
}); });
let roleRoles = await $.RoleRole.find({ let roleRoles = await $.RoleRole.find({

View File

@ -15,12 +15,12 @@
"relations": { "relations": {
"owner": { "owner": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "role" "foreignKey": "role"
}, },
"inherits": { "inherits": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "inheritsFrom" "foreignKey": "inheritsFrom"
} }
} }

View File

@ -14,12 +14,12 @@
"relations": { "relations": {
"owner": { "owner": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "role" "foreignKey": "role"
}, },
"inherits": { "inherits": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "inheritsFrom" "foreignKey": "inheritsFrom"
} }
} }

View File

@ -15,7 +15,7 @@
<vn-autocomplete <vn-autocomplete
label="Role" label="Role"
ng-model="$ctrl.acl.principalId" ng-model="$ctrl.acl.principalId"
url="Roles" url="VnRoles"
id-field="name" id-field="name"
value-field="name" value-field="name"
vn-focus> vn-focus>

View File

@ -4,7 +4,7 @@
<vn-autocomplete <vn-autocomplete
label="Role" label="Role"
ng-model="filter.principalId" ng-model="filter.principalId"
url="Roles" url="VnRoles"
value-field="name"> value-field="name">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete

View File

@ -30,7 +30,7 @@
<vn-autocomplete <vn-autocomplete
label="Role" label="Role"
ng-model="$ctrl.user.roleFk" ng-model="$ctrl.user.roleFk"
url="Roles" url="VnRoles"
rule="VnUser"> rule="VnUser">
</vn-autocomplete> </vn-autocomplete>
<vn-textfield <vn-textfield

View File

@ -22,7 +22,7 @@
<vn-autocomplete <vn-autocomplete
label="Role" label="Role"
ng-model="$ctrl.user.roleFk" ng-model="$ctrl.user.roleFk"
url="Roles"> url="VnRoles">
</vn-autocomplete> </vn-autocomplete>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>

View File

@ -1,25 +1,27 @@
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
url="Roles" url="VnRoles"
data="$ctrl.role" data="$ctrl.role"
form="form"> form="form">
</vn-watcher> </vn-watcher>
<form <form
name="form" name="form"
ng-submit="watcher.submit()" ng-submit="watcher.submit()"
class="vn-w-md"> class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-vertical> <vn-vertical>
<vn-textfield <vn-textfield
label="Name" label="Name"
ng-model="$ctrl.role.name" ng-model="$ctrl.role.name"
rule rule="VnRole.name"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Description" label="Description"
ng-model="$ctrl.role.description" ng-model="$ctrl.role.description"
rule> rule="VnRole.description"
>
</vn-textfield> </vn-textfield>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>

View File

@ -3,7 +3,7 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard { class Controller extends ModuleCard {
reload() { reload() {
this.$http.get(`Roles/${this.$params.id}`) this.$http.get(`VnRoles/${this.$params.id}`)
.then(res => this.role = res.data); .then(res => this.role = res.data);
} }
} }

View File

@ -1,6 +1,6 @@
import './index'; import './index';
describe('component vnRoleCard', () => { fdescribe('component vnRoleCard', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;
@ -15,7 +15,7 @@ describe('component vnRoleCard', () => {
it('should reload the controller data', () => { it('should reload the controller data', () => {
controller.$params.id = 1; controller.$params.id = 1;
$httpBackend.expectGET('Roles/1').respond('foo'); $httpBackend.expectGET('VnRoles/1').respond('foo');
controller.reload(); controller.reload();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,6 +1,6 @@
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
url="Roles" url="VnRoles"
data="$ctrl.role" data="$ctrl.role"
insert-mode="true" insert-mode="true"
form="form"> form="form">
@ -14,13 +14,13 @@
<vn-textfield <vn-textfield
label="Name" label="Name"
ng-model="$ctrl.role.name" ng-model="$ctrl.role.name"
rule rule="VnRole.name"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
label="Description" label="Description"
ng-model="$ctrl.role.description" ng-model="$ctrl.role.description"
rule> rule="VnRole.description">
</vn-textfield> </vn-textfield>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>

View File

@ -11,7 +11,7 @@ class Controller extends Descriptor {
} }
onDelete() { onDelete() {
return this.$http.delete(`Roles/${this.id}`) return this.$http.delete(`VnRoles/${this.id}`)
.then(() => this.$state.go('account.role')) .then(() => this.$state.go('account.role'))
.then(() => this.vnApp.showSuccess(this.$t('Role removed'))); .then(() => this.vnApp.showSuccess(this.$t('Role removed')));
} }

View File

@ -1,6 +1,6 @@
import './index'; import './index';
describe('component vnRoleDescriptor', () => { fdescribe('component vnRoleDescriptor', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;
@ -18,7 +18,7 @@ describe('component vnRoleDescriptor', () => {
controller.$state.go = jest.fn(); controller.$state.go = jest.fn();
jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectDELETE('Roles/1').respond(); $httpBackend.expectDELETE('VnRoles/1').respond();
controller.onDelete(); controller.onDelete();
$httpBackend.flush(); $httpBackend.flush();

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="Roles" url="VnRoles"
filter="::$ctrl.filter" filter="::$ctrl.filter"
limit="20"> limit="20">
</vn-crud-model> </vn-crud-model>

View File

@ -40,7 +40,7 @@
<vn-autocomplete <vn-autocomplete
label="Role" label="Role"
ng-model="$ctrl.addData.inheritsFrom" ng-model="$ctrl.addData.inheritsFrom"
url="Roles" url="VnRoles"
vn-focus> vn-focus>
</vn-autocomplete> </vn-autocomplete>
</tpl-body> </tpl-body>

View File

@ -6,7 +6,7 @@ class Controller extends Component {
this._role = value; this._role = value;
this.$.summary = null; this.$.summary = null;
if (!value) return; if (!value) return;
this.$http.get(`Roles/${value.id}`) this.$http.get(`VnRoles/${value.id}`)
.then(res => this.$.summary = res.data); .then(res => this.$.summary = res.data);
} }

View File

@ -19,7 +19,7 @@
vn-one vn-one
label="Role" label="Role"
ng-model="filter.roleFk" ng-model="filter.roleFk"
url="Roles" url="VnRoles"
value-field="id" value-field="id"
show-field="name"> show-field="name">
</vn-autocomplete> </vn-autocomplete>

View File

@ -1,6 +1,9 @@
{ {
"name": "ClaimBeginning", "name": "ClaimBeginning",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claimBeginning" "table": "claimBeginning"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClaimDevelopment", "name": "ClaimDevelopment",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claimDevelopment" "table": "claimDevelopment"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClaimDms", "name": "ClaimDms",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claimDms" "table": "claimDms"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClaimEnd", "name": "ClaimEnd",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claimEnd" "table": "claimEnd"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClaimObservation", "name": "ClaimObservation",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claimObservation" "table": "claimObservation"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClaimState", "name": "ClaimState",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claimState" "table": "claimState"
@ -32,7 +35,7 @@
"relations": { "relations": {
"writeRole": { "writeRole": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "roleFk" "foreignKey": "roleFk"
} }
}, },

View File

@ -1,6 +1,9 @@
{ {
"name": "Claim", "name": "Claim",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "claim" "table": "claim"

View File

@ -1,7 +1,10 @@
{ {
"name": "Address", "name": "Address",
"description": "Client addresses", "description": "Client addresses",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "address" "table": "address"

View File

@ -1,7 +1,10 @@
{ {
"name": "ClientContact", "name": "ClientContact",
"description": "Client phone contacts", "description": "Client phone contacts",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "clientContact" "table": "clientContact"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClientDms", "name": "ClientDms",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "clientDms" "table": "clientDms"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClientInforma", "name": "ClientInforma",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"log": { "log": {
"model":"ClientLog", "model":"ClientLog",
"relation": "client", "relation": "client",

View File

@ -1,7 +1,10 @@
{ {
"name": "ClientObservation", "name": "ClientObservation",
"description": "Client notes", "description": "Client notes",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "clientObservation" "table": "clientObservation"

View File

@ -1,6 +1,9 @@
{ {
"name": "ClientSample", "name": "ClientSample",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "clientSample" "table": "clientSample"

View File

@ -1,6 +1,9 @@
{ {
"name": "Client", "name": "Client",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "client" "table": "client"

View File

@ -1,6 +1,9 @@
{ {
"name": "Greuge", "name": "Greuge",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "greuge" "table": "greuge"

View File

@ -1,6 +1,9 @@
{ {
"name": "Recovery", "name": "Recovery",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "recovery" "table": "recovery"

View File

@ -19,7 +19,7 @@
"relations": { "relations": {
"role": { "role": {
"type": "belongsTo", "type": "belongsTo",
"model": "Role", "model": "VnRole",
"foreignKey": "roleFk" "foreignKey": "roleFk"
} }
} }

View File

@ -1,6 +1,9 @@
{ {
"name": "Buy", "name": "Buy",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "buy" "table": "buy"

View File

@ -1,6 +1,9 @@
{ {
"name": "EntryObservation", "name": "EntryObservation",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "entryObservation" "table": "entryObservation"

View File

@ -1,6 +1,9 @@
{ {
"name": "Entry", "name": "Entry",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "entry" "table": "entry"

View File

@ -1,6 +1,9 @@
{ {
"name": "InvoiceInTax", "name": "InvoiceInTax",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "invoiceInTax" "table": "invoiceInTax"

View File

@ -1,6 +1,9 @@
{ {
"name": "InvoiceIn", "name": "InvoiceIn",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "invoiceIn" "table": "invoiceIn"

View File

@ -1,6 +1,9 @@
{ {
"name": "ItemBarcode", "name": "ItemBarcode",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "itemBarcode" "table": "itemBarcode"

View File

@ -1,6 +1,9 @@
{ {
"name": "ItemBotanical", "name": "ItemBotanical",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "itemBotanical" "table": "itemBotanical"

View File

@ -1,6 +1,9 @@
{ {
"name": "ItemShelving", "name": "ItemShelving",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "itemShelving" "table": "itemShelving"

View File

@ -1,6 +1,9 @@
{ {
"name": "ItemTag", "name": "ItemTag",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "itemTag" "table": "itemTag"

View File

@ -1,6 +1,9 @@
{ {
"name": "ItemTaxCountry", "name": "ItemTaxCountry",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "itemTaxCountry" "table": "itemTaxCountry"

View File

@ -1,6 +1,9 @@
{ {
"name": "Item", "name": "Item",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "item" "table": "item"

View File

@ -1,6 +1,9 @@
{ {
"name": "Route", "name": "Route",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "route" "table": "route"

View File

@ -1,6 +1,9 @@
{ {
"name": "Shelving", "name": "Shelving",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "shelving" "table": "shelving"

View File

@ -1,6 +1,9 @@
{ {
"name": "SupplierAccount", "name": "SupplierAccount",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "supplierAccount" "table": "supplierAccount"

View File

@ -1,7 +1,10 @@
{ {
"name": "SupplierAddress", "name": "SupplierAddress",
"description": "Supplier addresses", "description": "Supplier addresses",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "supplierAddress" "table": "supplierAddress"

View File

@ -1,6 +1,9 @@
{ {
"name": "SupplierContact", "name": "SupplierContact",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "supplierContact" "table": "supplierContact"

View File

@ -1,6 +1,9 @@
{ {
"name": "Supplier", "name": "Supplier",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "supplier" "table": "supplier"

View File

@ -102,7 +102,7 @@ describe('sale canEdit()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
const role = await models.Role.findOne({ const role = await models.VnRole.findOne({
where: { where: {
name: roleEnabled.principalId name: roleEnabled.principalId
} }
@ -159,7 +159,7 @@ describe('sale canEdit()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
const role = await models.Role.findOne({ const role = await models.VnRole.findOne({
where: { where: {
name: roleEnabled.principalId name: roleEnabled.principalId
} }

View File

@ -1,6 +1,9 @@
{ {
"name": "Expedition", "name": "Expedition",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "expedition" "table": "expedition"

View File

@ -1,6 +1,9 @@
{ {
"name": "Sale", "name": "Sale",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "sale" "table": "sale"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketDms", "name": "TicketDms",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketDms" "table": "ticketDms"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketObservation", "name": "TicketObservation",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketObservation" "table": "ticketObservation"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketPackaging", "name": "TicketPackaging",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketPackaging" "table": "ticketPackaging"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketRefund", "name": "TicketRefund",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketRefund" "table": "ticketRefund"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketRequest", "name": "TicketRequest",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketRequest" "table": "ticketRequest"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketService", "name": "TicketService",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketService" "table": "ticketService"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketTracking", "name": "TicketTracking",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketTracking" "table": "ticketTracking"

View File

@ -1,6 +1,9 @@
{ {
"name": "TicketWeekly", "name": "TicketWeekly",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticketWeekly" "table": "ticketWeekly"

View File

@ -1,6 +1,9 @@
{ {
"name": "Ticket", "name": "Ticket",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "ticket" "table": "ticket"

View File

@ -1,6 +1,9 @@
{ {
"name": "TravelThermograph", "name": "TravelThermograph",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "travelThermograph" "table": "travelThermograph"

View File

@ -1,6 +1,9 @@
{ {
"name": "Travel", "name": "Travel",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "travel" "table": "travel"

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('Worker activeWithInheritedRole', () => { describe('Worker activeWithInheritedRole', () => {
let allRolesCount; let allRolesCount;
beforeAll(async() => { beforeAll(async() => {
allRolesCount = await app.models.Role.count(); allRolesCount = await app.models.VnRole.count();
}); });
it('should return the workers with an inherited role of salesPerson', async() => { it('should return the workers with an inherited role of salesPerson', async() => {

View File

@ -1,6 +1,9 @@
{ {
"name": "DeviceProductionUser", "name": "DeviceProductionUser",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"log": { "log": {
"model": "DeviceProductionLog", "model": "DeviceProductionLog",
"relation": "deviceProduction" "relation": "deviceProduction"

View File

@ -1,6 +1,9 @@
{ {
"name": "DeviceProduction", "name": "DeviceProduction",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"log": { "log": {
"model": "DeviceProductionLog" "model": "DeviceProductionLog"
}, },

View File

@ -1,6 +1,9 @@
{ {
"name": "WorkerDms", "name": "WorkerDms",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "workerDocument" "table": "workerDocument"

View File

@ -1,7 +1,10 @@
{ {
"name": "Worker", "name": "Worker",
"description": "Company employees", "description": "Company employees",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "worker" "table": "worker"

View File

@ -1,6 +1,9 @@
{ {
"name": "ZoneEvent", "name": "ZoneEvent",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneEvent" "table": "zoneEvent"

View File

@ -1,6 +1,9 @@
{ {
"name": "ZoneExclusion", "name": "ZoneExclusion",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneExclusion" "table": "zoneExclusion"

View File

@ -1,6 +1,9 @@
{ {
"name": "ZoneIncluded", "name": "ZoneIncluded",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneIncluded" "table": "zoneIncluded"

View File

@ -1,6 +1,9 @@
{ {
"name": "ZoneWarehouse", "name": "ZoneWarehouse",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneWarehouse" "table": "zoneWarehouse"

View File

@ -1,6 +1,9 @@
{ {
"name": "Zone", "name": "Zone",
"base": "Loggable", "base": "VnModel",
"mixins": {
"Loggable": true
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zone" "table": "zone"