From 605ab2ec625cf837e7dc10c9cee72fa33398f7ae Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 17 May 2022 12:37:54 +0200 Subject: [PATCH] refactor: delete sms.detinationFk --- modules/client/back/methods/client/sendSms.js | 2 +- modules/client/back/methods/sms/send.js | 7 +------ modules/client/back/methods/sms/send.spec.js | 2 +- modules/ticket/back/methods/ticket/sendSms.js | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/modules/client/back/methods/client/sendSms.js b/modules/client/back/methods/client/sendSms.js index cc11d17be..9d6a12416 100644 --- a/modules/client/back/methods/client/sendSms.js +++ b/modules/client/back/methods/client/sendSms.js @@ -39,7 +39,7 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; - const sms = await models.Sms.send(ctx, id, destination, message); + const sms = await models.Sms.send(ctx, destination, message); const logRecord = { originFk: id, userFk: userId, diff --git a/modules/client/back/methods/sms/send.js b/modules/client/back/methods/sms/send.js index 08daf83a1..94b2b6c27 100644 --- a/modules/client/back/methods/sms/send.js +++ b/modules/client/back/methods/sms/send.js @@ -6,10 +6,6 @@ module.exports = Self => { description: 'Sends SMS to a destination phone', accessType: 'WRITE', accepts: [ - { - arg: 'destinationFk', - type: 'integer' - }, { arg: 'destination', type: 'string', @@ -31,7 +27,7 @@ module.exports = Self => { } }); - Self.send = async(ctx, destinationFk, destination, message) => { + Self.send = async(ctx, destination, message) => { const userId = ctx.req.accessToken.userId; const smsConfig = await Self.app.models.SmsConfig.findOne(); @@ -68,7 +64,6 @@ module.exports = Self => { const newSms = { senderFk: userId, - destinationFk: destinationFk || null, destination: destination, message: message, status: error diff --git a/modules/client/back/methods/sms/send.spec.js b/modules/client/back/methods/sms/send.spec.js index 7ca78b214..8eee85bd6 100644 --- a/modules/client/back/methods/sms/send.spec.js +++ b/modules/client/back/methods/sms/send.spec.js @@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server'); describe('sms send()', () => { it('should not return status error', async() => { const ctx = {req: {accessToken: {userId: 1}}}; - const result = await app.models.Sms.send(ctx, 1105, '123456789', 'My SMS Body'); + const result = await app.models.Sms.send(ctx, '123456789', 'My SMS Body'); expect(result.status).toBeUndefined(); }); diff --git a/modules/ticket/back/methods/ticket/sendSms.js b/modules/ticket/back/methods/ticket/sendSms.js index efe8ff206..a0adcae07 100644 --- a/modules/ticket/back/methods/ticket/sendSms.js +++ b/modules/ticket/back/methods/ticket/sendSms.js @@ -45,7 +45,7 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; try { - const sms = await Self.app.models.Sms.send(ctx, id, destination, message); + const sms = await Self.app.models.Sms.send(ctx, destination, message); const logRecord = { originFk: id, userFk: userId,