File tree 8 files changed +59
-39
lines changed
8 files changed +59
-39
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "host" : " server-app.feathersjs.com" ,
3
- "port" : " PORT"
2
+ "host" : " HOST" ,
3
+ "port" : " PORT" ,
4
+ "postgres" : {
5
+ "connection" : " DATABASE_URL" ,
6
+ "ssl" : {
7
+ "required" : true ,
8
+ "rejectUnauthorized" : false
9
+ }
10
+ },
11
+ "vapid" : {
12
+ "publicKey" : " VAPID_PUBLIC_KEY" ,
13
+ "privateKey" : " VAPID_PRIVATE_KEY" ,
14
+ "subject" : " VAPID_SUBJECT"
15
+ }
4
16
}
Original file line number Diff line number Diff line change 24
24
"npm" : " >= 3.0.0"
25
25
},
26
26
"scripts" : {
27
+ "install:public" : " cd public && npm install" ,
28
+ "build:public" : " cd public && npm run build" ,
29
+ "postinstall" : " npm run install:public" ,
30
+ "postbuild" : " npm run build:public" ,
31
+ "build" : " npm run lint" ,
27
32
"test" : " npm run lint && npm run mocha" ,
28
33
"lint" : " eslint src/. test/. --config .eslintrc.json --fix" ,
29
34
"dev" : " nodemon src/" ,
Original file line number Diff line number Diff line change 1
- REACT_APP_VAPID_KEY = BGRhvbXYp6YIfMXWu1oqU7pvPnFcxYXTmCBzxE19ObWLlXzMN32aeUHHKZQ2_Do4kkC2JiQTWytZpTunOTFOqzQ
1
+ REACT_APP_VAPID_KEY = BGRhvbXYp6YIfMXWu1oqU7pvPnFcxYXTmCBzxE19ObWLlXzMN32aeUHHKZQ2_Do4kkC2JiQTWytZpTunOTFOqzQ
2
+ REACT_APP_SERVER_ORIGIN = http://localhost:3030
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ import feathersjs from "@feathersjs/feathers";
4
4
import socketio from "@feathersjs/socketio-client" ;
5
5
import authentication from "@feathersjs/authentication-client" ;
6
6
7
- const socket = io ( "http://localhost:3030" ) ;
7
+ const url = new URL ( process [ "env" ] [ "REACT_APP_SERVER_ORIGIN" ] ) ;
8
+
9
+ const socket = io ( url . toString ( ) ) ;
8
10
const feathers = feathersjs ( ) ;
9
11
10
12
feathers . configure ( socketio ( socket ) ) ;
Original file line number Diff line number Diff line change @@ -3,26 +3,26 @@ const { Service } = require('feathers-sequelize');
3
3
exports . Devices = class Devices extends Service {
4
4
async create ( data , params ) {
5
5
const defaultValue = {
6
- label : `device-${ data [ "id" ] } ${ Date . now ( ) } ` ,
6
+ label : `device-${ data [ 'id' ] } ${ Date . now ( ) } ` ,
7
7
config : {
8
8
medicine : {
9
9
lvl1 : {
10
- name : "" ,
11
- time : ""
10
+ name : '' ,
11
+ time : ''
12
12
} ,
13
13
lvl2 : {
14
- name : "" ,
15
- time : ""
14
+ name : '' ,
15
+ time : ''
16
16
} ,
17
17
lvl3 : {
18
- name : "" ,
19
- time : ""
18
+ name : '' ,
19
+ time : ''
20
20
}
21
21
}
22
22
} ,
23
23
connectionStatus : false ,
24
24
...data
25
- }
25
+ } ;
26
26
return super . create ( defaultValue , params ) ;
27
27
}
28
28
} ;
Original file line number Diff line number Diff line change @@ -9,29 +9,29 @@ exports.Patient = class Patient extends Service {
9
9
async remove ( id , params ) {
10
10
const patient = await this . get ( id ) ;
11
11
const ret = await super . remove ( id , params ) ;
12
- if ( patient [ " device.id" ] ) {
13
- await this . app . service ( " devices" ) . remove ( patient [ " device.id" ] ) ;
12
+ if ( patient [ ' device.id' ] ) {
13
+ await this . app . service ( ' devices' ) . remove ( patient [ ' device.id' ] ) ;
14
14
}
15
15
return ret ;
16
16
}
17
17
18
18
async create ( data , params ) {
19
19
let ret = await super . create ( data , params ) ;
20
20
21
- const device = await this . app . service ( " devices" ) . create ( {
22
- patientId : ret [ "id" ]
21
+ const device = await this . app . service ( ' devices' ) . create ( {
22
+ patientId : ret [ 'id' ]
23
23
} ) ;
24
24
25
- console . log ( " device created" , device ) ;
25
+ console . log ( ' device created' , device ) ;
26
26
return ret ;
27
27
}
28
28
async get ( id , params ) {
29
29
let ret = await super . get ( id , {
30
30
...params ,
31
31
sequelize : {
32
32
include : [ {
33
- model : this . app . service ( " devices" ) . Model ,
34
- as : " device"
33
+ model : this . app . service ( ' devices' ) . Model ,
34
+ as : ' device'
35
35
} ]
36
36
}
37
37
} ) ;
Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ exports.Users = class Users extends Service {
8
8
async remove ( id , params ) {
9
9
const user = await this . get ( id ) ;
10
10
const ret = super . remove ( id , params ) ;
11
- if ( user [ " role" ] === " patient" ) {
12
- await this . app . service ( " patient" ) . remove ( user [ " patient.id" ] ) ;
11
+ if ( user [ ' role' ] === ' patient' ) {
12
+ await this . app . service ( ' patient' ) . remove ( user [ ' patient.id' ] ) ;
13
13
}
14
- if ( user [ " role" ] === " doctor" ) {
15
- await this . app . service ( " doctor" ) . remove ( user [ " doctor.id" ] ) ;
14
+ if ( user [ ' role' ] === ' doctor' ) {
15
+ await this . app . service ( ' doctor' ) . remove ( user [ ' doctor.id' ] ) ;
16
16
}
17
17
return ret ;
18
18
}
@@ -39,14 +39,14 @@ exports.Users = class Users extends Service {
39
39
...params ,
40
40
sequelize : {
41
41
include : [ {
42
- model : this . app . service ( " doctor" ) . Model ,
43
- as : " doctor"
42
+ model : this . app . service ( ' doctor' ) . Model ,
43
+ as : ' doctor'
44
44
} , {
45
- model : this . app . service ( " patient" ) . Model ,
46
- as : " patient" ,
45
+ model : this . app . service ( ' patient' ) . Model ,
46
+ as : ' patient' ,
47
47
include : [ {
48
- model : this . app . service ( " devices" ) . Model ,
49
- as : " device"
48
+ model : this . app . service ( ' devices' ) . Model ,
49
+ as : ' device'
50
50
} ]
51
51
} ]
52
52
}
Original file line number Diff line number Diff line change @@ -8,21 +8,21 @@ describe('\'patient\' service', () => {
8
8
assert . ok ( service , 'Registered the service' ) ;
9
9
} ) ;
10
10
11
- describe ( " register new patient" , ( ) => {
11
+ describe ( ' register new patient' , ( ) => {
12
12
const userInfo = {
13
- email : " example@patient.com" ,
14
- password : " secretpatient" ,
15
- role : " patient"
16
- }
13
+ email : ' example@patient.com' ,
14
+ password : ' secretpatient' ,
15
+ role : ' patient'
16
+ } ;
17
17
before ( async ( ) => {
18
18
try {
19
- await app . services ( " users" ) . create ( userInfo ) ;
19
+ await app . services ( ' users' ) . create ( userInfo ) ;
20
20
} catch ( error ) {
21
-
21
+ // Do nothing, it just means the user already exists and can be tested
22
22
}
23
23
} ) ;
24
- it ( " user with role `patient` registered" , async ( ) => {
24
+ it ( ' user with role `patient` registered' , async ( ) => {
25
25
26
- } )
27
- } )
26
+ } ) ;
27
+ } ) ;
28
28
} ) ;
You can’t perform that action at this time.
0 commit comments