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) => {
|
Self.sendCheckingPresence = async(ctx, recipientId, message, options) => {
|
||||||
|
console.log(ctx, recipientId, message, options);
|
||||||
if (!recipientId) return false;
|
if (!recipientId) return false;
|
||||||
|
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
@ -38,7 +39,10 @@ module.exports = Self => {
|
||||||
const recipient = await models.Account.findById(recipientId, null, myOptions);
|
const recipient = await models.Account.findById(recipientId, null, myOptions);
|
||||||
|
|
||||||
// Prevent sending messages to yourself
|
// Prevent sending messages to yourself
|
||||||
|
console.log('llega');
|
||||||
|
console.log(recipientId, userId);
|
||||||
if (recipientId == userId) return false;
|
if (recipientId == userId) return false;
|
||||||
|
console.log('llega2');
|
||||||
|
|
||||||
if (!recipient)
|
if (!recipient)
|
||||||
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
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),
|
(1, 31, 4, 21, 2),
|
||||||
(2, 32, 3, 21, 3);
|
(2, 32, 3, 21, 3);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`)
|
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Contact description', 50),
|
(1, 50),
|
||||||
(2, 'Contact description', 30);
|
(2, 30);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa
|
||||||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||||
|
|
||||||
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, '02676A049183', DEFAULT, 1106),
|
(1, '02676A049183', DEFAULT, 1106),
|
||||||
(2, '02676A049183', DEFAULT, 1106),
|
(2, '02676A049183', DEFAULT, 1106),
|
||||||
(3, '02676A049183', DEFAULT, 1107),
|
(3, '02676A049183', DEFAULT, 1107),
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The client id',
|
description: 'The claim id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -29,24 +29,6 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The recipient id to send to the recipient preferred language',
|
description: 'The recipient id to send to the recipient preferred language',
|
||||||
required: false
|
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: {
|
returns: {
|
||||||
|
@ -75,14 +57,29 @@ module.exports = Self => {
|
||||||
for (const param in args)
|
for (const param in args)
|
||||||
params[param] = args[param];
|
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', {
|
const message = $t('Claim pickup order sent', {
|
||||||
claimId: args.id,
|
claimId: args.id,
|
||||||
clientName: args.clientName,
|
clientName: claim.client.name,
|
||||||
claimUrl: `${origin}/#!/claim/${args.id}/summary`,
|
claimUrl: `${origin}/#!/claim/${args.id}/summary`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (args.salesPersonId)
|
console.log(claim.client());
|
||||||
await models.Chat.sendCheckingPresence(ctx, args.salesPersonId, message);
|
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({
|
await models.ClaimLog.create({
|
||||||
originFk: args.id,
|
originFk: args.id,
|
||||||
|
|
|
@ -19,10 +19,7 @@ class Controller extends Descriptor {
|
||||||
sendPickupOrder() {
|
sendPickupOrder() {
|
||||||
return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, {
|
return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, {
|
||||||
recipient: this.claim.client.email,
|
recipient: this.claim.client.email,
|
||||||
recipientId: this.claim.clientFk,
|
recipientId: this.claim.clientFk
|
||||||
clientName: this.claim.client.name,
|
|
||||||
ticketId: this.claim.ticket.id,
|
|
||||||
salesPersonId: this.claim.client.salesPersonFk
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,7 @@ describe('Item Component vnClaimDescriptor', () => {
|
||||||
const claim = {
|
const claim = {
|
||||||
id: 2,
|
id: 2,
|
||||||
clientFk: 1101,
|
clientFk: 1101,
|
||||||
client: {
|
client: {email: 'client@email'}
|
||||||
email: 'client@email',
|
|
||||||
name: 'clientName',
|
|
||||||
salesPersonFk: 18
|
|
||||||
},
|
|
||||||
ticket: {id: 2}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(ngModule('claim'));
|
beforeEach(ngModule('claim'));
|
||||||
|
@ -45,10 +40,7 @@ describe('Item Component vnClaimDescriptor', () => {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
recipient: claim.client.email,
|
recipient: claim.client.email,
|
||||||
recipientId: claim.clientFk,
|
recipientId: claim.clientFk
|
||||||
clientName: claim.client.name,
|
|
||||||
ticketId: claim.ticket.id,
|
|
||||||
salesPersonId: claim.client.salesPersonFk
|
|
||||||
};
|
};
|
||||||
controller.sendPickupOrder();
|
controller.sendPickupOrder();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
"node-ssh": "^11.0.0",
|
"node-ssh": "^11.0.0",
|
||||||
"object-diff": "0.0.4",
|
"object-diff": "0.0.4",
|
||||||
"object.pick": "^1.3.0",
|
"object.pick": "^1.3.0",
|
||||||
"puppeteer": "^18.0.5",
|
"puppeteer": "^19.2.0",
|
||||||
"read-chunk": "^3.2.0",
|
"read-chunk": "^3.2.0",
|
||||||
"require-yaml": "0.0.1",
|
"require-yaml": "0.0.1",
|
||||||
"sharp": "^0.31.0",
|
"sharp": "^0.31.0",
|
||||||
|
|
|
@ -8,22 +8,23 @@ module.exports = {
|
||||||
'email-header': emailHeader.build(),
|
'email-header': emailHeader.build(),
|
||||||
'email-footer': emailFooter.build()
|
'email-footer': emailFooter.build()
|
||||||
},
|
},
|
||||||
created() {
|
async serverPrefetch() {
|
||||||
this.instructions = this.$t('description.instructions', [this.id, this.ticketId]);
|
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() {
|
methods: {
|
||||||
return {
|
fetchTicket(id) {
|
||||||
instructions: String
|
return this.findOneFromDef('ticket', [id]);
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
required: true
|
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