From 4025c624b3f1518b429630d5437f1ce4dbef5777 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 8 Oct 2019 12:48:12 +0200 Subject: [PATCH] #15 WIP fixed requested changes --- loopback/locale/es.json | 2 +- modules/worker/back/methods/department/getLeaves.js | 8 ++++---- modules/worker/back/methods/department/removeChild.js | 2 +- modules/worker/front/department/index.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9daf90d63..07c95af32 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -108,5 +108,5 @@ "This postal code is not valid": "This postal code is not valid", "is invalid": "is invalid", "The postcode doesn't exists. Ensure you put the correct format": "El código postal no existe. Asegúrate de ponerlo con el formato correcto", - "The department name can't be repeated": "The department name can't be repeated" + "The department name can't be repeated": "El nombre del departamento no puede repetirse" } \ No newline at end of file diff --git a/modules/worker/back/methods/department/getLeaves.js b/modules/worker/back/methods/department/getLeaves.js index bb6fd8d7e..614f3388e 100644 --- a/modules/worker/back/methods/department/getLeaves.js +++ b/modules/worker/back/methods/department/getLeaves.js @@ -2,7 +2,7 @@ module.exports = Self => { Self.remoteMethod('getLeaves', { description: 'Returns the nodes for a department', accepts: [{ - arg: 'parentFk', + arg: 'parentId', type: 'Number', description: 'Get the children of the specified father', }, { @@ -20,10 +20,10 @@ module.exports = Self => { } }); - Self.getLeaves = async(parentFk = null, search) => { + Self.getLeaves = async(parentId = null, search) => { let [res] = await Self.rawSql( `CALL department_getLeaves(?, ?)`, - [parentFk, search] + [parentId, search] ); let map = new Map(); @@ -41,7 +41,7 @@ module.exports = Self => { } } - let leaves = map.get(parentFk); + let leaves = map.get(parentId); setLeaves(leaves); return leaves || []; diff --git a/modules/worker/back/methods/department/removeChild.js b/modules/worker/back/methods/department/removeChild.js index 2d3f40b36..00115ec34 100644 --- a/modules/worker/back/methods/department/removeChild.js +++ b/modules/worker/back/methods/department/removeChild.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('removeChild', { - description: 'Returns the first shipped and landed possible for params', + description: 'Removes a child department', accessType: 'WRITE', accepts: [{ arg: 'id', diff --git a/modules/worker/front/department/index.js b/modules/worker/front/department/index.js index 0023dcca9..1a72681bc 100644 --- a/modules/worker/front/department/index.js +++ b/modules/worker/front/department/index.js @@ -13,7 +13,7 @@ class Controller { } onFetch(item) { - const params = item ? {parentFk: item.id} : null; + const params = item ? {parentId: item.id} : null; return this.$.model.applyFilter({}, params).then(() => { return this.$.model.data; });