salix/modules/client/back/methods/address/getAddress.js

25 lines
671 B
JavaScript
Raw Normal View History

2023-09-06 07:18:28 +00:00
module.exports = Self => {
Self.remoteMethod('getAddress', {
2023-09-14 05:47:10 +00:00
description: 'Get all activated address with loses client activated',
2023-09-06 07:18:28 +00:00
accessType: 'READ',
accepts: [],
returns: {
type: ['object'],
root: true
},
http: {
path: `/getAddress`,
verb: 'GET'
}
});
Self.getAddress = async() => {
2023-09-14 05:47:10 +00:00
let getAddressQuery = `
SELECT a.id, a.nickname
FROM vn.address a
2023-09-14 16:03:30 +00:00
JOIN vn.client c ON a.clientFk = c.id AND c.isActive <> FALSE
WHERE c.typeFk = 'loses' AND a.isActive <> FALSE;`;
2023-09-14 05:47:10 +00:00
return result = await Self.rawSql(getAddressQuery);
2023-09-06 07:18:28 +00:00
};
};