ticketlog in componentUpdate
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6fabada18c
commit
f6ca9eee01
|
@ -97,10 +97,18 @@ module.exports = Self => {
|
|||
delete updatedTicket.option;
|
||||
// Force unroute
|
||||
const hasToBeUnrouted = true;
|
||||
console.log('updatedTicket', updatedTicket);
|
||||
console.log('originalTicket', originalTicket);
|
||||
const propertiesChange = diff(originalTicket, updatedTicket);
|
||||
console.log('propertiesChange', propertiesChange);
|
||||
|
||||
let logRecord = {
|
||||
originFk: id,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Ticket',
|
||||
changedModelId: id,
|
||||
oldInstance: originalTicket,
|
||||
newInstance: propertiesChange
|
||||
};
|
||||
|
||||
let query = 'CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||
let res = await Self.rawSql(query, [
|
||||
id,
|
||||
|
@ -116,6 +124,8 @@ module.exports = Self => {
|
|||
hasToBeUnrouted,
|
||||
option
|
||||
]);
|
||||
|
||||
await models.TicketLog.create(logRecord);
|
||||
return res;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('ticket componentUpdate()', () => {
|
||||
describe('ticket componentUpdate()', () => {
|
||||
const ticketId = 11;
|
||||
const today = new Date();
|
||||
const tomorrow = new Date();
|
||||
|
@ -40,8 +40,8 @@ fdescribe('ticket componentUpdate()', () => {
|
|||
const option = 1;
|
||||
|
||||
let ctx = {
|
||||
args: {ticketId: '',
|
||||
}
|
||||
args: {clientFk: 102,
|
||||
agencyModeFk: 8},
|
||||
req: {accessToken: {userId: 101}}};
|
||||
|
||||
await app.models.Ticket.componentUpdate(ctx, ticketId, clientId, agencyModeId, addressId,
|
||||
|
@ -69,7 +69,11 @@ fdescribe('ticket componentUpdate()', () => {
|
|||
const landed = tomorrow;
|
||||
const option = 1;
|
||||
|
||||
let ctx = {req: {accessToken: {userId: 101}}};
|
||||
let ctx = {
|
||||
args: {clientFk: 102,
|
||||
agencyModeFk: 7},
|
||||
req: {accessToken: {userId: 101}}};
|
||||
|
||||
await app.models.Ticket.componentUpdate(ctx, ticketId, clientId, agencyModeId, addressId,
|
||||
zoneId, warehouseId, companyId, shipped, landed, isDeleted, option);
|
||||
|
||||
|
|
Loading…
Reference in New Issue