This commit is contained in:
parent
c5e953f922
commit
6c9f1cfdfa
|
@ -26,7 +26,8 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.send = async(ctx, data, transaction) => {
|
||||
const userId = ctx.options && ctx.options.accessToken.userId || ctx.req && ctx.req.accessToken.userId;
|
||||
const accessToken = ctx.options && ctx.options.accessToken || ctx.req && ctx.req.accessToken;
|
||||
const userId = accessToken.userId;
|
||||
const models = Self.app.models;
|
||||
const sender = await models.Account.findById(userId, transaction);
|
||||
const recipient = await models.Account.findById(data.recipientFk, transaction);
|
||||
|
|
|
@ -52,7 +52,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
if (!ticketFk) {
|
||||
ticketFk = await createTicket({
|
||||
ticketFk = await createTicket(ctx, {
|
||||
clientFk: address.clientFk,
|
||||
addressFk: addressFk,
|
||||
warehouseFk: sale.ticket().warehouseFk,
|
||||
|
@ -134,7 +134,8 @@ module.exports = Self => {
|
|||
|
||||
async function createTicket(ctx, params, transaction) {
|
||||
let ticket = await Self.app.models.Ticket.new(ctx,
|
||||
{shipped: new Date(),
|
||||
{
|
||||
shipped: new Date(),
|
||||
landed: new Date(),
|
||||
clientFk: params.clientFk,
|
||||
warehouseFk: params.warehouseFk,
|
||||
|
|
Loading…
Reference in New Issue