Skip to content

Commit 0b033a9

Browse files
committed
linting
1 parent 9e25e21 commit 0b033a9

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

niceday-api/index.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const { Authentication, SenseServer, Chat, ConnectionStatus, SenseServerEnvironment } = require('@sense-os/goalie-js');
1+
const {
2+
Authentication, SenseServer, Chat, ConnectionStatus, SenseServerEnvironment,
3+
} = require('@sense-os/goalie-js');
24
const schedule = require('node-schedule');
35
const path = require('path');
46
const http = require('http');
@@ -12,6 +14,7 @@ const serverPort = 8080;
1214

1315
const { THERAPIST_PASSWORD, THERAPIST_EMAIL_ADDRESS, ENVIRONMENT } = process.env;
1416
let selectedServer;
17+
let selectedServerEnv;
1518

1619
if (ENVIRONMENT === 'dev') {
1720
selectedServer = SenseServer.Alpha;
@@ -34,23 +37,6 @@ const options = {
3437
const expressAppConfig = oas3Tools.expressAppConfig(path.join(__dirname, 'api/openapi.yaml'), options);
3538
const app = expressAppConfig.getApp();
3639

37-
function createNicedayApiServer() {
38-
authSdk.login(THERAPIST_EMAIL_ADDRESS, THERAPIST_PASSWORD)
39-
.then((response) => {
40-
app.set('therapistId', response.user.id);
41-
app.set('token', response.token);
42-
setupChat(response.user.id, response.token)
43-
})
44-
.catch((error) => {
45-
throw Error(`Error during authentication: ${error}`);
46-
});
47-
48-
// Initialize the Swagger middleware
49-
const server = http.createServer(app);
50-
51-
return server;
52-
}
53-
5440
function setupChat(therapistId, token) {
5541
// Setup connection
5642
chatSdk.init(selectedServerEnv);
@@ -76,6 +62,22 @@ function setupChat(therapistId, token) {
7662
});
7763
}
7864

65+
function createNicedayApiServer() {
66+
authSdk.login(THERAPIST_EMAIL_ADDRESS, THERAPIST_PASSWORD)
67+
.then((response) => {
68+
app.set('therapistId', response.user.id);
69+
app.set('token', response.token);
70+
setupChat(response.user.id, response.token);
71+
})
72+
.catch((error) => {
73+
throw Error(`Error during authentication: ${error}`);
74+
});
75+
76+
// Initialize the Swagger middleware
77+
const server = http.createServer(app);
78+
79+
return server;
80+
}
7981

8082
function setupTokenRegeneration() {
8183
const rule = new schedule.RecurrenceRule();

niceday-api/service/MessagesService.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99

1010
exports.sendTextMessage = function (req, body) {
1111
return new Promise((resolve, reject) => {
12-
13-
const chatSdk = req.app.get('chatsdk')
12+
const chatSdk = req.app.get('chatsdk');
1413
chatSdk.sendTextMessage(body.recipient_id, body.text).then((response) => {
1514
console.log('Successfully sent the message', response);
1615
resolve();
1716
})
1817
.catch((error) => reject(error));
19-
2018
});
2119
};

0 commit comments

Comments
 (0)