From c88033a69dd250b8ba13530d7ea8ac45f5ee658e Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 23 Jun 2021 13:22:35 +0200 Subject: [PATCH] deprecated listWorkers endpoint as it was not in use --- .../client/back/methods/client/listWorkers.js | 30 ------------------- .../methods/client/specs/listWorkers.spec.js | 14 --------- modules/client/back/models/client.js | 1 - 3 files changed, 45 deletions(-) delete mode 100644 modules/client/back/methods/client/listWorkers.js delete mode 100644 modules/client/back/methods/client/specs/listWorkers.spec.js diff --git a/modules/client/back/methods/client/listWorkers.js b/modules/client/back/methods/client/listWorkers.js deleted file mode 100644 index 8fa4c085e..000000000 --- a/modules/client/back/methods/client/listWorkers.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = function(Self) { - Self.remoteMethod('listWorkers', { - description: 'List workers', - accessType: 'READ', - returns: { - arg: 'data', - type: 'Worker', - root: true - }, - http: { - path: `/listWorkers`, - verb: 'GET' - } - }); - - Self.listWorkers = function() { - let query = - `SELECT w.id, - CONCAT(w.firstName, IFNULL(CONCAT(" ", w.lastName), "")) \`name\` - FROM worker w - JOIN account.user u ON w.userFk = u.id - JOIN account.roleRole rr ON rr.role = u.role - JOIN account.role r ON r.id = rr.inheritsFrom - WHERE u.active - AND r.\`name\` = 'employee' - ORDER BY w.lastName ASC`; - - return Self.rawSql(query); - }; -}; diff --git a/modules/client/back/methods/client/specs/listWorkers.spec.js b/modules/client/back/methods/client/specs/listWorkers.spec.js deleted file mode 100644 index 271347969..000000000 --- a/modules/client/back/methods/client/specs/listWorkers.spec.js +++ /dev/null @@ -1,14 +0,0 @@ -const app = require('vn-loopback/server/server'); - -describe('Client listWorkers', () => { - it('should call the listWorkers()', done => { - app.models.Client.listWorkers() - .then(result => { - let amountOfEmployees = Object.keys(result).length; - - expect(amountOfEmployees).toEqual(54); - done(); - }) - .catch(done.fail); - }); -}); diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 842565c3f..d5c4125d4 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -10,7 +10,6 @@ module.exports = Self => { // Methods require('../methods/client/getCard')(Self); require('../methods/client/createWithUser')(Self); - require('../methods/client/listWorkers')(Self); require('../methods/client/hasCustomerRole')(Self); require('../methods/client/canCreateTicket')(Self); require('../methods/client/isValidClient')(Self);