This commit is contained in:
parent
5b541aa804
commit
adeca2bb22
|
@ -7,12 +7,12 @@ module.exports = Self => {
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/getLastTicketsByWorker`,
|
path: `/myLastModified`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getLastTicketsByWorker = async ctx => {
|
Self.myLastModified = async ctx => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const query =
|
const query =
|
||||||
`SELECT ticketFk, MAX(created) created
|
`SELECT ticketFk, MAX(created) created
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('getLastTicketsByWorker()', () => {
|
describe('myLastModified()', () => {
|
||||||
it('return list of last tickets which user has modified', async() => {
|
it('return list of last tickets which user has modified', async() => {
|
||||||
let ctx = {req: {accessToken: {userId: 100}}};
|
let ctx = {req: {accessToken: {userId: 100}}};
|
||||||
let response = await models.Ticket.getLastTicketsByWorker(ctx);
|
let response = await models.Ticket.myLastModified(ctx);
|
||||||
|
|
||||||
expect(response.length).toBeGreaterThan(0);
|
expect(response.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue