#6276 createNewWarehouse methods migrated from silex to salix #1850

Merged
jorgep merged 158 commits from 6276-createNewWarehouse into dev 2024-03-06 11:32:11 +00:00
6 changed files with 114 additions and 1 deletions
Showing only changes of commit 877c679273 - Show all commits

View File

@ -0,0 +1,45 @@
module.exports = Self => {
Self.remoteMethodCtx('getVersion', {
description: 'gets app version data',
accessType: 'READ',
accepts: [{
arg: 'app',
type: 'string',
required: true
}],
returns: {
type: ['object'],
root: true
},
http: {
path: `/getVersion`,
verb: 'GET'
}
});
Self.getVersion = async(ctx, app) => {
const {models} = Self.app;
const userId = ctx.req.accessToken.userId;
const workerFk = await models.WorkerAppTester.findOne({
where: {
workerFk: userId
}
});
let fields = ['id', 'appName'];
if (workerFk)
jorgep marked this conversation as resolved
Review

Javascript tiene una forma muy sencilla de 'fusionar' arrays
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

Javascript tiene una forma muy sencilla de 'fusionar' arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat
fields = [...fields, ...['isVersionBetaCritical', 'versionBeta', 'urlBeta']];
else
fields = [...fields, ...['isVersionCritical', 'version', 'urlProduction']];
const filter = {
where: {
appName: app
},
fields,
};
return await Self.findOne(filter);
};
};

View File

@ -0,0 +1,3 @@
module.exports = Self => {
require('../methods/mobile-app-version-control/getVersion')(Self);
};

View File

@ -0,0 +1,39 @@
{
"name": "MobileAppVersionControl",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.mobileAppVersionControl"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"appName": {
"type": "string"
},
"version": {
"type": "string"
},
"isVersionCritical": {
"type": "boolean"
},
"urlProduction": {
"type": "string"
},
"urlBeta": {
"type": "string"
},
"versionBeta": {
"type": "string"
},
"isVersionBetaCritical": {
"type": "boolean"
}
}
}

View File

@ -2,4 +2,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
VALUES
('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'),
('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee');
('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'),
('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee');

View File

@ -53,6 +53,9 @@
"Time": {
"dataSource": "vn"
},
"WorkerAppTester": {
"dataSource": "vn"
},
"WorkCenter": {
"dataSource": "vn"
},

View File

@ -0,0 +1,22 @@
{
"name": "WorkerAppTester",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.workerAppTester"
}
},
"properties": {
"workerFk": {
"id": true,
"type": "number"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
}
}
}