Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6276-createNewWarehouse
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
7a64b57a2a
|
@ -16,6 +16,7 @@
|
|||
},
|
||||
"cSpell.words": [
|
||||
"salix",
|
||||
"fdescribe"
|
||||
"fdescribe",
|
||||
"Loggable"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ module.exports = Self => {
|
|||
userToUpdate.hasGrant = hasGrant;
|
||||
|
||||
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);
|
||||
|
||||
if (!hasRole)
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('VnUser privileges()', () => {
|
|||
const tx = await models.VnUser.beginTransaction({});
|
||||
|
||||
const options = {transaction: tx};
|
||||
const agency = await models.Role.findOne({
|
||||
const agency = await models.VnRole.findOne({
|
||||
where: {
|
||||
name: 'agency'
|
||||
}
|
||||
|
|
|
@ -145,9 +145,6 @@
|
|||
"Warehouse": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"VnUser": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"OsTicket": {
|
||||
"dataSource": "osticket"
|
||||
},
|
||||
|
@ -162,6 +159,12 @@
|
|||
},
|
||||
"ViaexpressConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"VnUser": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"VnRole": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
"relations": {
|
||||
"readRole": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "readRoleFk"
|
||||
},
|
||||
"writeRole": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "writeRoleFk"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -46,12 +46,12 @@
|
|||
},
|
||||
"readRole": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "readRoleFk"
|
||||
},
|
||||
"writeRole": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "writeRoleFk"
|
||||
}
|
||||
},
|
||||
|
@ -64,4 +64,3 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -24,8 +24,8 @@
|
|||
},
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "roleFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "VnRole",
|
||||
"base": "Role",
|
||||
"validateUpsert": true,
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "account.role"
|
||||
}
|
||||
},
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@
|
|||
"table": "account.user"
|
||||
}
|
||||
},
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"resetPasswordTokenTTL": "604800",
|
||||
"properties": {
|
||||
"id": {
|
||||
|
@ -63,7 +66,7 @@
|
|||
"relations": {
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "roleFk"
|
||||
},
|
||||
"roles": {
|
||||
|
|
|
@ -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';
|
||||
|
|
@ -23,7 +23,6 @@ export function directive($translate, $window) {
|
|||
let rule = $attrs.rule.split('.');
|
||||
let modelName = rule.shift();
|
||||
let fieldName = rule.shift();
|
||||
|
||||
let split = $attrs.ngModel.split('.');
|
||||
if (!fieldName) fieldName = split.pop() || null;
|
||||
if (!modelName) modelName = firstUpper(split.pop() || '');
|
||||
|
|
|
@ -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);
|
||||
};
|
|
@ -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();
|
||||
});
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"name": "Loggable",
|
||||
"base": "VnModel",
|
||||
"validateUpsert": true
|
||||
}
|
|
@ -25,20 +25,19 @@
|
|||
"FieldAcl": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Role": {
|
||||
"dataSource": "vn",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "salix.Role"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RoleMapping": {
|
||||
"dataSource": "vn",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "salix.RoleMapping"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "roleId"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Schema": {
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
{
|
||||
"name": "Account",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "account.account"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"model": "VnUser",
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"aliases": {
|
||||
"type": "hasMany",
|
||||
"model": "MailAliasAccount",
|
||||
"foreignKey": "account"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"property": "login",
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
"name": "Account",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "account.account"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"model": "VnUser",
|
||||
"foreignKey": "id"
|
||||
},
|
||||
{
|
||||
"aliases": {
|
||||
"type": "hasMany",
|
||||
"model": "MailAliasAccount",
|
||||
"foreignKey": "account"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"property": "login",
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"property": "logout",
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"property": "changePassword",
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ module.exports = Self => {
|
|||
|
||||
// Prepare data
|
||||
|
||||
let roles = await $.Role.find({
|
||||
let roles = await $.VnRole.find({
|
||||
fields: ['id', 'name', 'description']
|
||||
});
|
||||
let roleRoles = await $.RoleRole.find({
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
"relations": {
|
||||
"owner": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "role"
|
||||
},
|
||||
"inherits": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "inheritsFrom"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
"relations": {
|
||||
"owner": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "role"
|
||||
},
|
||||
"inherits": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "inheritsFrom"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<vn-autocomplete
|
||||
label="Role"
|
||||
ng-model="$ctrl.acl.principalId"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
id-field="name"
|
||||
value-field="name"
|
||||
vn-focus>
|
||||
|
@ -32,7 +32,7 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Property"
|
||||
label="Property"
|
||||
ng-model="$ctrl.acl.property"
|
||||
info="Use * to match all properties">
|
||||
</vn-textfield>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<vn-autocomplete
|
||||
label="Role"
|
||||
ng-model="filter.principalId"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
value-field="name">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
|
@ -15,7 +15,7 @@
|
|||
value-field="name">
|
||||
</vn-autocomplete>
|
||||
<vn-textfield
|
||||
label="Property"
|
||||
label="Property"
|
||||
ng-model="filter.property">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
|
@ -36,4 +36,4 @@
|
|||
</vn-submit>
|
||||
</vn-vertical>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<vn-autocomplete
|
||||
label="Role"
|
||||
ng-model="$ctrl.user.roleFk"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
rule="VnUser">
|
||||
</vn-autocomplete>
|
||||
<vn-textfield
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<vn-autocomplete
|
||||
label="Role"
|
||||
ng-model="$ctrl.user.roleFk"
|
||||
url="Roles">
|
||||
url="VnRoles">
|
||||
</vn-autocomplete>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
data="$ctrl.role"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form
|
||||
name="form"
|
||||
ng-submit="watcher.submit()"
|
||||
|
||||
class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-vertical>
|
||||
<vn-textfield
|
||||
label="Name"
|
||||
label="Name"
|
||||
ng-model="$ctrl.role.name"
|
||||
rule
|
||||
rule="VnRole.name"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
label="Description"
|
||||
ng-model="$ctrl.role.description"
|
||||
rule>
|
||||
label="Description"
|
||||
ng-model="$ctrl.role.description"
|
||||
rule="VnRole.description"
|
||||
>
|
||||
</vn-textfield>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
@ -35,4 +37,4 @@
|
|||
ng-click="watcher.loadOriginalData()">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
</form>
|
||||
|
|
|
@ -3,7 +3,7 @@ import ModuleCard from 'salix/components/module-card';
|
|||
|
||||
class Controller extends ModuleCard {
|
||||
reload() {
|
||||
this.$http.get(`Roles/${this.$params.id}`)
|
||||
this.$http.get(`VnRoles/${this.$params.id}`)
|
||||
.then(res => this.role = res.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnRoleCard', () => {
|
||||
fdescribe('component vnRoleCard', () => {
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe('component vnRoleCard', () => {
|
|||
it('should reload the controller data', () => {
|
||||
controller.$params.id = 1;
|
||||
|
||||
$httpBackend.expectGET('Roles/1').respond('foo');
|
||||
$httpBackend.expectGET('VnRoles/1').respond('foo');
|
||||
controller.reload();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
data="$ctrl.role"
|
||||
insert-mode="true"
|
||||
form="form">
|
||||
|
@ -12,15 +12,15 @@
|
|||
<vn-card class="vn-pa-lg">
|
||||
<vn-vertical>
|
||||
<vn-textfield
|
||||
label="Name"
|
||||
label="Name"
|
||||
ng-model="$ctrl.role.name"
|
||||
rule
|
||||
rule="VnRole.name"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
label="Description"
|
||||
label="Description"
|
||||
ng-model="$ctrl.role.description"
|
||||
rule>
|
||||
rule="VnRole.description">
|
||||
</vn-textfield>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -24,4 +24,4 @@
|
|||
on-accept="$ctrl.onDelete()"
|
||||
question="Are you sure you want to continue?"
|
||||
message="Role will be removed">
|
||||
</vn-confirm>
|
||||
</vn-confirm>
|
||||
|
|
|
@ -11,7 +11,7 @@ class Controller extends Descriptor {
|
|||
}
|
||||
|
||||
onDelete() {
|
||||
return this.$http.delete(`Roles/${this.id}`)
|
||||
return this.$http.delete(`VnRoles/${this.id}`)
|
||||
.then(() => this.$state.go('account.role'))
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Role removed')));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnRoleDescriptor', () => {
|
||||
fdescribe('component vnRoleDescriptor', () => {
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe('component vnRoleDescriptor', () => {
|
|||
controller.$state.go = jest.fn();
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
|
||||
$httpBackend.expectDELETE('Roles/1').respond();
|
||||
$httpBackend.expectDELETE('VnRoles/1').respond();
|
||||
controller.onDelete();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
filter="::$ctrl.filter"
|
||||
limit="20">
|
||||
</vn-crud-model>
|
||||
|
@ -15,4 +15,4 @@
|
|||
</vn-portal>
|
||||
<ui-view>
|
||||
<vn-role-index></vn-role-index>
|
||||
</ui-view>
|
||||
</ui-view>
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
ng-click="$ctrl.onAddClick()"
|
||||
fixed-bottom-right>
|
||||
</vn-float-button>
|
||||
<vn-dialog
|
||||
<vn-dialog
|
||||
vn-id="dialog"
|
||||
on-accept="$ctrl.onAddSave()">
|
||||
<tpl-body>
|
||||
<vn-autocomplete
|
||||
label="Role"
|
||||
ng-model="$ctrl.addData.inheritsFrom"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
vn-focus>
|
||||
</vn-autocomplete>
|
||||
</tpl-body>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<button response="accept" translate>Save</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
<vn-confirm
|
||||
<vn-confirm
|
||||
vn-id="remove-confirm"
|
||||
message="Role will be removed"
|
||||
question="Are you sure you want to continue?"
|
||||
|
|
|
@ -6,7 +6,7 @@ class Controller extends Component {
|
|||
this._role = value;
|
||||
this.$.summary = null;
|
||||
if (!value) return;
|
||||
this.$http.get(`Roles/${value.id}`)
|
||||
this.$http.get(`VnRoles/${value.id}`)
|
||||
.then(res => this.$.summary = res.data);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
vn-one
|
||||
label="Role"
|
||||
ng-model="filter.roleFk"
|
||||
url="Roles"
|
||||
url="VnRoles"
|
||||
value-field="id"
|
||||
show-field="name">
|
||||
</vn-autocomplete>
|
||||
|
@ -28,4 +28,4 @@
|
|||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClaimBeginning",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimBeginning"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClaimDevelopment",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimDevelopment"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClaimDms",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimDms"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClaimEnd",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimEnd"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClaimObservation",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimObservation"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClaimState",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimState"
|
||||
|
@ -32,7 +35,7 @@
|
|||
"relations": {
|
||||
"writeRole": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "roleFk"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Claim",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claim"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "Address",
|
||||
"description": "Client addresses",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "address"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "ClientContact",
|
||||
"description": "Client phone contacts",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientContact"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClientDms",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientDms"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClientInforma",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"log": {
|
||||
"model":"ClientLog",
|
||||
"relation": "client",
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "ClientObservation",
|
||||
"description": "Client notes",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientObservation"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ClientSample",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientSample"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Client",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "client"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Greuge",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "greuge"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Recovery",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "recovery"
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"relations": {
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"model": "VnRole",
|
||||
"foreignKey": "roleFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Buy",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "buy"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "EntryObservation",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "entryObservation"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Entry",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "entry"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "InvoiceInTax",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "invoiceInTax"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "InvoiceIn",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "invoiceIn"
|
||||
|
|
|
@ -85,7 +85,7 @@ module.exports = Self => {
|
|||
throw new UserError(`A ticket with an amount of zero can't be invoiced`);
|
||||
|
||||
// Validates ticket nagative base
|
||||
const hasNegativeBase = await getNegativeBase(ticketId, myOptions);
|
||||
const hasNegativeBase = await getNegativeBase(maxShipped, clientId, companyId, myOptions);
|
||||
if (hasNegativeBase && company.code == 'VNL')
|
||||
throw new UserError(`A ticket with a negative base can't be invoiced`);
|
||||
} else {
|
||||
|
@ -162,10 +162,13 @@ module.exports = Self => {
|
|||
return result.invoiceable;
|
||||
}
|
||||
|
||||
async function getNegativeBase(ticketId, options) {
|
||||
async function getNegativeBase(maxShipped, clientId, companyId, options) {
|
||||
const models = Self.app.models;
|
||||
const query = 'SELECT vn.hasSomeNegativeBase(?) AS base';
|
||||
const [result] = await models.InvoiceOut.rawSql(query, [ticketId], options);
|
||||
await models.InvoiceOut.rawSql('CALL invoiceOut_exportationFromClient(?,?,?)',
|
||||
[maxShipped, clientId, companyId], options
|
||||
);
|
||||
const query = 'SELECT vn.hasAnyNegativeBase() AS base';
|
||||
const [result] = await models.InvoiceOut.rawSql(query, [], options);
|
||||
|
||||
return result.base;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ItemBarcode",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "itemBarcode"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ItemBotanical",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "itemBotanical"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ItemShelving",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "itemShelving"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ItemTag",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "itemTag"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ItemTaxCountry",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "itemTaxCountry"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Item",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "item"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Route",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "route"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Shelving",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "shelving"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "SupplierAccount",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "supplierAccount"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "SupplierAddress",
|
||||
"description": "Supplier addresses",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "supplierAddress"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "SupplierContact",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "supplierContact"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Supplier",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "supplier"
|
||||
|
|
|
@ -102,7 +102,7 @@ describe('sale canEdit()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const role = await models.Role.findOne({
|
||||
const role = await models.VnRole.findOne({
|
||||
where: {
|
||||
name: roleEnabled.principalId
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ describe('sale canEdit()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const role = await models.Role.findOne({
|
||||
const role = await models.VnRole.findOne({
|
||||
where: {
|
||||
name: roleEnabled.principalId
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Expedition",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "expedition"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Sale",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "sale"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketDms",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketDms"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketObservation",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketObservation"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketPackaging",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketPackaging"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketRefund",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketRefund"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketRequest",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketRequest"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketService",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketService"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketTracking",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketTracking"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TicketWeekly",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticketWeekly"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Ticket",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "ticket"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TravelThermograph",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "travelThermograph"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Travel",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "travel"
|
||||
|
|
|
@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
|
|||
describe('Worker activeWithInheritedRole', () => {
|
||||
let allRolesCount;
|
||||
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() => {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "DeviceProductionUser",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"log": {
|
||||
"model": "DeviceProductionLog",
|
||||
"relation": "deviceProduction"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "DeviceProduction",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"log": {
|
||||
"model": "DeviceProductionLog"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "WorkerDms",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "workerDocument"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "Worker",
|
||||
"description": "Company employees",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "worker"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ZoneEvent",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "zoneEvent"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ZoneExclusion",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "zoneExclusion"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ZoneIncluded",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "zoneIncluded"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "ZoneWarehouse",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "zoneWarehouse"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "Zone",
|
||||
"base": "Loggable",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "zone"
|
||||
|
|
Loading…
Reference in New Issue