Merge branch 'dev' into 4082-zone.basic-data
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
b3c0aa7933
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const userId = ctx.req.accessToken.userId;
|
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 = {
|
const logRecord = {
|
||||||
originFk: id,
|
originFk: id,
|
||||||
userFk: userId,
|
userFk: userId,
|
||||||
|
|
|
@ -6,10 +6,6 @@ module.exports = Self => {
|
||||||
description: 'Sends SMS to a destination phone',
|
description: 'Sends SMS to a destination phone',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
|
||||||
arg: 'destinationFk',
|
|
||||||
type: 'integer'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
arg: 'destination',
|
arg: 'destination',
|
||||||
type: 'string',
|
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 userId = ctx.req.accessToken.userId;
|
||||||
const smsConfig = await Self.app.models.SmsConfig.findOne();
|
const smsConfig = await Self.app.models.SmsConfig.findOne();
|
||||||
|
|
||||||
|
@ -68,7 +64,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
const newSms = {
|
const newSms = {
|
||||||
senderFk: userId,
|
senderFk: userId,
|
||||||
destinationFk: destinationFk || null,
|
|
||||||
destination: destination,
|
destination: destination,
|
||||||
message: message,
|
message: message,
|
||||||
status: error
|
status: error
|
||||||
|
|
|
@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
|
||||||
describe('sms send()', () => {
|
describe('sms send()', () => {
|
||||||
it('should not return status error', async() => {
|
it('should not return status error', async() => {
|
||||||
const ctx = {req: {accessToken: {userId: 1}}};
|
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();
|
expect(result.status).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
|
||||||
try {
|
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 = {
|
const logRecord = {
|
||||||
originFk: id,
|
originFk: id,
|
||||||
userFk: userId,
|
userFk: userId,
|
||||||
|
|
Loading…
Reference in New Issue