refs #6531 feat:showLastTickets #2045

Merged
sergiodt merged 3 commits from 6531-showTickets into test 2024-02-19 10:00:33 +00:00
2 changed files with 35 additions and 35 deletions
Showing only changes of commit adeca2bb22 - Show all commits

View File

@ -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

View File

@ -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);
}); });