parent
cd7f0e3c24
commit
aa3b58433c
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
const [result] = response.result;
|
const [result] = response.result;
|
||||||
const error = result.error_id;
|
const error = result.error_id;
|
||||||
|
|
||||||
if (senderFk) senderFk = ctx.req.accessToken.userId;
|
if (senderFk) senderFk = senderFk.req.accessToken.userId;
|
||||||
const newSms = {
|
const newSms = {
|
||||||
senderFk,
|
senderFk,
|
||||||
destination: destination,
|
destination: destination,
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default class Controller {
|
||||||
cb: data => {
|
cb: data => {
|
||||||
if (this.method && this.code) {
|
if (this.method && this.code) {
|
||||||
data.token && this.goToChangePassword(data);
|
data.token && this.goToChangePassword(data);
|
||||||
!data.token && this.goToLogin();
|
if (!data.token) throw new UserError(`Credentials not valid`);
|
||||||
} else
|
} else
|
||||||
this.handleCode(data.code);
|
this.handleCode(data.code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.sendSms = async(ctx, id, destination, message) => {
|
Self.sendSms = async(ctx, id, destination, message) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const sms = await models.Sms.send(ctx, destination, message);
|
const sms = await models.Sms.send(ctx, destination, message, {insert: true});
|
||||||
|
|
||||||
await models.ClientSms.create({
|
await models.ClientSms.create({
|
||||||
clientFk: id,
|
clientFk: id,
|
||||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const allSms = [];
|
const allSms = [];
|
||||||
for (let client of targetClients) {
|
for (let client of targetClients) {
|
||||||
let sms = await Self.app.models.Sms.send(ctx, client, message);
|
let sms = await Self.app.models.Sms.send(ctx, client, message, {insert: true});
|
||||||
allSms.push(sms);
|
allSms.push(sms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.sendSms = async(ctx, id, destination, message) => {
|
Self.sendSms = async(ctx, id, destination, message) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const sms = await models.Sms.send(ctx, destination, message);
|
const sms = await models.Sms.send(ctx, destination, message, {insert: true});
|
||||||
const {clientFk} = await models.Ticket.findById(id);
|
const {clientFk} = await models.Ticket.findById(id);
|
||||||
await models.ClientSms.create({
|
await models.ClientSms.create({
|
||||||
clientFk,
|
clientFk,
|
||||||
|
|
Loading…
Reference in New Issue