fix claim regularize & message.send methods #1242
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-03-22 13:45:17 +01:00
parent c5e953f922
commit 6c9f1cfdfa
2 changed files with 5 additions and 3 deletions

View File

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

View File

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