fix tests
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
9d85389691
commit
9225e8f176
|
@ -25,6 +25,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.sendCheckingPresence = async(ctx, recipientId, message, options) => {
|
||||
console.log(ctx, recipientId, message, options);
|
||||
if (!recipientId) return false;
|
||||
|
||||
const myOptions = {};
|
||||
|
@ -38,7 +39,10 @@ module.exports = Self => {
|
|||
const recipient = await models.Account.findById(recipientId, null, myOptions);
|
||||
|
||||
// Prevent sending messages to yourself
|
||||
console.log('llega');
|
||||
console.log(recipientId, userId);
|
||||
if (recipientId == userId) return false;
|
||||
console.log('llega2');
|
||||
|
||||
if (!recipient)
|
||||
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`;
|
|
@ -1778,10 +1778,10 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
|
|||
(1, 31, 4, 21, 2),
|
||||
(2, 32, 3, 21, 3);
|
||||
|
||||
INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`)
|
||||
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
|
||||
VALUES
|
||||
(1, 'Contact description', 50),
|
||||
(2, 'Contact description', 30);
|
||||
(1, 50),
|
||||
(2, 30);
|
||||
|
||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||
VALUES
|
||||
|
@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa
|
|||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||
|
||||
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
||||
VALUES
|
||||
VALUES
|
||||
(1, '02676A049183', DEFAULT, 1106),
|
||||
(2, '02676A049183', DEFAULT, 1106),
|
||||
(3, '02676A049183', DEFAULT, 1107),
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
|||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The client id',
|
||||
description: 'The claim id',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
|
@ -29,24 +29,6 @@ module.exports = Self => {
|
|||
type: 'number',
|
||||
description: 'The recipient id to send to the recipient preferred language',
|
||||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'ticketId',
|
||||
type: 'number',
|
||||
description: 'The ticket id',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
arg: 'salesPersonId',
|
||||
type: 'number',
|
||||
description: 'The salesPerson id',
|
||||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'clientName',
|
||||
type: 'string',
|
||||
description: 'The client name',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -75,14 +57,29 @@ module.exports = Self => {
|
|||
for (const param in args)
|
||||
params[param] = args[param];
|
||||
|
||||
const claim = await models.Claim.findById(args.id, {
|
||||
fields: ['id', 'clientFk'],
|
||||
include: {
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['name', 'salesPersonFk']
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(claim);
|
||||
|
||||
const message = $t('Claim pickup order sent', {
|
||||
claimId: args.id,
|
||||
clientName: args.clientName,
|
||||
clientName: claim.client.name,
|
||||
claimUrl: `${origin}/#!/claim/${args.id}/summary`,
|
||||
});
|
||||
|
||||
if (args.salesPersonId)
|
||||
await models.Chat.sendCheckingPresence(ctx, args.salesPersonId, message);
|
||||
console.log(claim.client());
|
||||
const salesPersonId = claim.client().salesPersonFk;
|
||||
if (claim.client().salesPersonFk)
|
||||
console.log(await models.Chat.sendCheckingPresence(ctx, 25, message));
|
||||
|
||||
console.log(claim.client().salesPersonFk);
|
||||
|
||||
await models.ClaimLog.create({
|
||||
originFk: args.id,
|
||||
|
|
|
@ -19,10 +19,7 @@ class Controller extends Descriptor {
|
|||
sendPickupOrder() {
|
||||
return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, {
|
||||
recipient: this.claim.client.email,
|
||||
recipientId: this.claim.clientFk,
|
||||
clientName: this.claim.client.name,
|
||||
ticketId: this.claim.ticket.id,
|
||||
salesPersonId: this.claim.client.salesPersonFk
|
||||
recipientId: this.claim.clientFk
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,7 @@ describe('Item Component vnClaimDescriptor', () => {
|
|||
const claim = {
|
||||
id: 2,
|
||||
clientFk: 1101,
|
||||
client: {
|
||||
email: 'client@email',
|
||||
name: 'clientName',
|
||||
salesPersonFk: 18
|
||||
},
|
||||
ticket: {id: 2}
|
||||
client: {email: 'client@email'}
|
||||
};
|
||||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
@ -45,10 +40,7 @@ describe('Item Component vnClaimDescriptor', () => {
|
|||
|
||||
const params = {
|
||||
recipient: claim.client.email,
|
||||
recipientId: claim.clientFk,
|
||||
clientName: claim.client.name,
|
||||
ticketId: claim.ticket.id,
|
||||
salesPersonId: claim.client.salesPersonFk
|
||||
recipientId: claim.clientFk
|
||||
};
|
||||
controller.sendPickupOrder();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"node-ssh": "^11.0.0",
|
||||
"object-diff": "0.0.4",
|
||||
"object.pick": "^1.3.0",
|
||||
"puppeteer": "^18.0.5",
|
||||
"puppeteer": "^19.2.0",
|
||||
"read-chunk": "^3.2.0",
|
||||
"require-yaml": "0.0.1",
|
||||
"sharp": "^0.31.0",
|
||||
|
|
|
@ -8,22 +8,23 @@ module.exports = {
|
|||
'email-header': emailHeader.build(),
|
||||
'email-footer': emailFooter.build()
|
||||
},
|
||||
created() {
|
||||
this.instructions = this.$t('description.instructions', [this.id, this.ticketId]);
|
||||
async serverPrefetch() {
|
||||
this.ticket = await this.fetchTicket(this.id);
|
||||
|
||||
if (!this.ticket)
|
||||
throw new Error('Something went wrong');
|
||||
console.log();
|
||||
this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
instructions: String
|
||||
};
|
||||
methods: {
|
||||
fetchTicket(id) {
|
||||
return this.findOneFromDef('ticket', [id]);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: [Number, String],
|
||||
required: true
|
||||
},
|
||||
ticketId: {
|
||||
type: [Number, String],
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
SELECT
|
||||
c.ticketFk as id
|
||||
FROM claim c
|
||||
WHERE c.id = ?
|
Loading…
Reference in New Issue