deprecated listWorkers endpoint as it was not in use
This commit is contained in:
parent
efc25fcb53
commit
c88033a69d
|
@ -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);
|
||||
};
|
||||
};
|
|
@ -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);
|
||||
});
|
||||
});
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue