Merge branch 'dev' into 6776-makeMulti
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
d127354905
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
MAKETIME(pb.HH,pb.mm,0) etd,
|
MAKETIME(pb.HH,pb.mm,0) etd,
|
||||||
pb.routeFk,
|
pb.routeFk,
|
||||||
FLOOR(s.quantity / ish.packing) stickers,
|
FLOOR(s.quantity / ish.packing) stickers,
|
||||||
ish.packing,
|
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
|
||||||
b.packagingFk
|
b.packagingFk
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES( 'Ticket', 'myLastModified', '*', 'ALLOW', 'ROLE', 'production');
|
|
@ -0,0 +1,25 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('myLastModified', {
|
||||||
|
description: 'Get list of last tickets which user has modified',
|
||||||
|
accessType: 'READ',
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/myLastModified`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.myLastModified = async ctx => {
|
||||||
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
const query =
|
||||||
|
`SELECT ticketFk, MAX(created) created
|
||||||
|
FROM ticketTracking tt
|
||||||
|
WHERE tt.userFk = ?
|
||||||
|
GROUP BY ticketFk
|
||||||
|
LIMIT 5;`;
|
||||||
|
return await Self.rawSql(query, [userId]);
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
describe('myLastModified()', () => {
|
||||||
|
it('return list of last tickets which user has modified', async() => {
|
||||||
|
let ctx = {req: {accessToken: {userId: 100}}};
|
||||||
|
let response = await models.Ticket.myLastModified(ctx);
|
||||||
|
|
||||||
|
expect(response.length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
});
|
|
@ -45,4 +45,5 @@ module.exports = function(Self) {
|
||||||
require('../methods/ticket/invoiceTickets')(Self);
|
require('../methods/ticket/invoiceTickets')(Self);
|
||||||
require('../methods/ticket/invoiceTicketsAndPdf')(Self);
|
require('../methods/ticket/invoiceTicketsAndPdf')(Self);
|
||||||
require('../methods/ticket/docuwareDownload')(Self);
|
require('../methods/ticket/docuwareDownload')(Self);
|
||||||
|
require('../methods/ticket/myLastModified')(Self);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue