Переглянути джерело

:gear: redoing prettier config | running prettier | adding some sample wave-ui elements

tags/0.0.1
J 3 роки тому
джерело
коміт
7a2e9df128
38 змінених файлів з 361 додано та 235 видалено
  1. 8
    6
      backend/.prettierrc
  2. 1
    1
      backend/lib/index.js
  3. 1
    1
      backend/lib/plugins/survey.js
  4. 19
    13
      backend/lib/routes/membership/join.js
  5. 8
    4
      backend/lib/routes/notification/index.js
  6. 11
    7
      backend/lib/routes/profile/get.js
  7. 12
    8
      backend/lib/routes/profile/match.js
  8. 11
    7
      backend/lib/routes/profile/respond.js
  9. 11
    7
      backend/lib/routes/profile/update.js
  10. 5
    3
      backend/lib/routes/survey/questions.js
  11. 6
    4
      backend/lib/routes/survey/responses.js
  12. 1
    1
      backend/lib/routes/user/create-profile.js
  13. 1
    1
      backend/lib/routes/user/list-profiles.js
  14. 3
    1
      backend/lib/routes/user/login.js
  15. 4
    4
      backend/lib/routes/user/signup.js
  16. 1
    0
      backend/lib/services/matchqueue.js
  17. 21
    12
      backend/lib/services/notification.js
  18. 27
    18
      backend/lib/services/profile/index.js
  19. 34
    10
      backend/lib/services/profile/profiler.js
  20. 7
    7
      backend/lib/services/profile/scorer.js
  21. 2
    2
      backend/lib/services/profile/tagger.js
  22. 3
    3
      backend/lib/services/profile/zipcoder.js
  23. 5
    2
      backend/lib/services/user.js
  24. 2
    2
      backend/server/index.js
  25. 0
    0
      frontend/.eslintrc
  26. 1
    1
      frontend/.prettierrc
  27. 40
    50
      frontend/src/App.vue
  28. 1
    0
      frontend/src/components/MainNav.vue
  29. 3
    4
      frontend/src/components/Messages.vue
  30. 1
    2
      frontend/src/components/ProfileCardList.vue
  31. 5
    5
      frontend/src/components/SideBar.vue
  32. 8
    7
      frontend/src/main.js
  33. 12
    5
      frontend/src/views/HomeView.vue
  34. 6
    6
      frontend/src/views/LoginView.vue
  35. 7
    4
      frontend/src/views/MatchesView.vue
  36. 3
    1
      frontend/src/views/ProfileView.vue
  37. 63
    26
      frontend/src/views/SurveyView.vue
  38. 7
    0
      frontend/vite.config.js

+ 8
- 6
backend/.prettierrc Переглянути файл

@@ -1,6 +1,8 @@
1
-trailingComma: "all"
2
-tabWidth: 4
3
-semi: false
4
-singleQuote: true
5
-bracketSpacing: true
6
-arrowParens: "avoid"
1
+{
2
+    "trailingComma": "all",
3
+    "tabWidth": 4,
4
+    "semi": false,
5
+    "singleQuote": true,
6
+    "bracketSpacing": true,
7
+    "arrowParens": "avoid"
8
+}

+ 1
- 1
backend/lib/index.js Переглянути файл

@@ -41,7 +41,7 @@ exports.plugin = {
41 41
         await server.register(ProfilePlugin, {
42 42
             routes: { prefix: '/profile' },
43 43
         })
44
-        
44
+
45 45
         await server.register(NotificationPlugin, {
46 46
             routes: { prefix: '/notification' },
47 47
         })

+ 1
- 1
backend/lib/plugins/survey.js Переглянути файл

@@ -24,5 +24,5 @@ module.exports = {
24 24
 
25 25
         await server.route(ResponseQuestionsRoute)
26 26
     },
27
-    models: { ReponseKeyModel }
27
+    models: { ReponseKeyModel },
28 28
 }

+ 19
- 13
backend/lib/routes/membership/join.js Переглянути файл

@@ -15,18 +15,20 @@ const pluginConfig = {
15 15
 
16 16
 const validators = {
17 17
     params: params.profileId,
18
-    payload: groupingSchema.single.append({
19
-        target_id: Joi.number().required(),
20
-        role: Joi.string(),
21
-    }).label('grouping_membership_single')
18
+    payload: groupingSchema.single
19
+        .append({
20
+            target_id: Joi.number().required(),
21
+            role: Joi.string(),
22
+        })
23
+        .label('grouping_membership_single'),
22 24
 }
23 25
 
24 26
 const responseSchemas = {
25 27
     response: Joi.object({
26 28
         memberships: Joi.array().items(),
27
-        hasMatch: Joi.boolean()
29
+        hasMatch: Joi.boolean(),
28 30
     }).label('grouping_membership_list'),
29
-    error: errorSchema.single
31
+    error: errorSchema.single,
30 32
 }
31 33
 
32 34
 module.exports = {
@@ -99,18 +101,22 @@ module.exports = {
99 101
         /** Validate based on validators object */
100 102
         validate: {
101 103
             ...validators,
102
-            failAction: 'log'
104
+            failAction: 'log',
103 105
         },
104 106
 
105 107
         /** Validate the server response */
106 108
         response: {
107 109
             status: {
108
-                200: apiSchema.single.append({
109
-                    data: responseSchemas.response,
110
-                }).label('join_grouping_res'),
111
-                409: apiSchema.single.append({
112
-                    data: responseSchemas.error,
113
-                }).label('error_single_res'),
110
+                200: apiSchema.single
111
+                    .append({
112
+                        data: responseSchemas.response,
113
+                    })
114
+                    .label('join_grouping_res'),
115
+                409: apiSchema.single
116
+                    .append({
117
+                        data: responseSchemas.error,
118
+                    })
119
+                    .label('error_single_res'),
114 120
             },
115 121
         },
116 122
     },

+ 8
- 4
backend/lib/routes/notification/index.js Переглянути файл

@@ -15,7 +15,7 @@ const pluginConfig = {
15 15
 }
16 16
 
17 17
 const validators = {
18
-    params: params.profileId
18
+    params: params.profileId,
19 19
 }
20 20
 
21 21
 module.exports = {
@@ -31,7 +31,12 @@ module.exports = {
31 31
             const input = new PassThrough({ objectMode: true })
32 32
             const eventType = 'stonk'
33 33
 
34
-            const msg = { profile_id, name: 'BDGRS', price: (500 + Math.floor(Math.random() * 100)).toString(), order: null }
34
+            const msg = {
35
+                profile_id,
36
+                name: 'BDGRS',
37
+                price: (500 + Math.floor(Math.random() * 100)).toString(),
38
+                order: null,
39
+            }
35 40
 
36 41
             // Write to the input stream
37 42
             setInterval(() => {
@@ -48,8 +53,7 @@ module.exports = {
48 53
         /** Validate based on validators object */
49 54
         validate: {
50 55
             ...validators,
51
-            failAction: 'log'
56
+            failAction: 'log',
52 57
         },
53
-
54 58
     },
55 59
 }

+ 11
- 7
backend/lib/routes/profile/get.js Переглянути файл

@@ -20,7 +20,7 @@ const responseSchemas = {
20 20
 }
21 21
 
22 22
 const validators = {
23
-    params: params.profileId
23
+    params: params.profileId,
24 24
 }
25 25
 
26 26
 module.exports = {
@@ -65,12 +65,16 @@ module.exports = {
65 65
         /** Validate the server response */
66 66
         response: {
67 67
             status: {
68
-                200: apiSchema.single.append({
69
-                    data: responseSchemas.profile,
70
-                }).label('profile_single_res'),
71
-                409: apiSchema.single.append({
72
-                    data: responseSchemas.error,
73
-                }).label('error_single_res'),
68
+                200: apiSchema.single
69
+                    .append({
70
+                        data: responseSchemas.profile,
71
+                    })
72
+                    .label('profile_single_res'),
73
+                409: apiSchema.single
74
+                    .append({
75
+                        data: responseSchemas.error,
76
+                    })
77
+                    .label('error_single_res'),
74 78
             },
75 79
         },
76 80
     },

+ 12
- 8
backend/lib/routes/profile/match.js Переглянути файл

@@ -3,7 +3,7 @@
3 3
 const Joi = require('joi')
4 4
 const apiSchema = require('../../schemas/api')
5 5
 const errorSchema = require('../../schemas/errors')
6
-const surveyResponseSchema = require('../../schemas/responses') 
6
+const surveyResponseSchema = require('../../schemas/responses')
7 7
 
8 8
 const pluginConfig = {
9 9
     handlerType: 'match',
@@ -17,7 +17,7 @@ const validators = {}
17 17
 
18 18
 const responseSchemas = {
19 19
     response: surveyResponseSchema.list,
20
-    error: errorSchema.single
20
+    error: errorSchema.single,
21 21
 }
22 22
 
23 23
 module.exports = {
@@ -66,12 +66,16 @@ module.exports = {
66 66
         /** Validate the server response */
67 67
         response: {
68 68
             status: {
69
-                200: apiSchema.single.append({
70
-                    data: responseSchemas.response,
71
-                }).label('response_list_res'),
72
-                409: apiSchema.single.append({
73
-                    data: responseSchemas.error,
74
-                }).label('error_single_res')
69
+                200: apiSchema.single
70
+                    .append({
71
+                        data: responseSchemas.response,
72
+                    })
73
+                    .label('response_list_res'),
74
+                409: apiSchema.single
75
+                    .append({
76
+                        data: responseSchemas.error,
77
+                    })
78
+                    .label('error_single_res'),
75 79
             },
76 80
         },
77 81
     },

+ 11
- 7
backend/lib/routes/profile/respond.js Переглянути файл

@@ -16,7 +16,7 @@ const pluginConfig = {
16 16
 
17 17
 const responseSchemas = {
18 18
     response: surveyResponseSchema.list,
19
-    error: errorSchema.single
19
+    error: errorSchema.single,
20 20
 }
21 21
 
22 22
 const validators = {
@@ -91,12 +91,16 @@ module.exports = {
91 91
         /** Validate the server response */
92 92
         response: {
93 93
             status: {
94
-                201: apiSchema.single.append({
95
-                    data: responseSchemas.response,
96
-                }).label('response_list_res'),
97
-                409: apiSchema.single.append({
98
-                    data: responseSchemas.error,
99
-                }).label('error_single_res')
94
+                201: apiSchema.single
95
+                    .append({
96
+                        data: responseSchemas.response,
97
+                    })
98
+                    .label('response_list_res'),
99
+                409: apiSchema.single
100
+                    .append({
101
+                        data: responseSchemas.error,
102
+                    })
103
+                    .label('error_single_res'),
100 104
             },
101 105
         },
102 106
     },

+ 11
- 7
backend/lib/routes/profile/update.js Переглянути файл

@@ -16,7 +16,7 @@ const pluginConfig = {
16 16
 
17 17
 const responseSchemas = {
18 18
     response: surveyResponseSchema.list,
19
-    error: errorSchema.single
19
+    error: errorSchema.single,
20 20
 }
21 21
 
22 22
 const validators = {
@@ -86,12 +86,16 @@ module.exports = {
86 86
         /** Validate the server response */
87 87
         response: {
88 88
             status: {
89
-                200: apiSchema.single.append({
90
-                    data: responseSchemas.response,
91
-                }).label('response_list_res'),
92
-                409: apiSchema.single.append({
93
-                    data: responseSchemas.error,
94
-                }).label('error_single_res')
89
+                200: apiSchema.single
90
+                    .append({
91
+                        data: responseSchemas.response,
92
+                    })
93
+                    .label('response_list_res'),
94
+                409: apiSchema.single
95
+                    .append({
96
+                        data: responseSchemas.error,
97
+                    })
98
+                    .label('error_single_res'),
95 99
             },
96 100
         },
97 101
     },

+ 5
- 3
backend/lib/routes/survey/questions.js Переглянути файл

@@ -59,9 +59,11 @@ module.exports = {
59 59
 
60 60
         /** Validate the server response */
61 61
         response: {
62
-            schema: apiSchema.single.append({
63
-                data: responseSchemas.response
64
-            }).label('question_list_res'),
62
+            schema: apiSchema.single
63
+                .append({
64
+                    data: responseSchemas.response,
65
+                })
66
+                .label('question_list_res'),
65 67
             failAction: 'log',
66 68
         },
67 69
     },

+ 6
- 4
backend/lib/routes/survey/responses.js Переглянути файл

@@ -25,7 +25,7 @@ const validators = {
25 25
     // payload: true,
26 26
 }
27 27
 const responseSchemas = {
28
-    response: surveyResponseSchema.keys
28
+    response: surveyResponseSchema.keys,
29 29
 }
30 30
 
31 31
 module.exports = {
@@ -60,9 +60,11 @@ module.exports = {
60 60
 
61 61
         /** Validate the server response */
62 62
         response: {
63
-            schema: apiSchema.single.append({
64
-                data: responseSchemas.response
65
-            }).label('response_list_res'),
63
+            schema: apiSchema.single
64
+                .append({
65
+                    data: responseSchemas.response,
66
+                })
67
+                .label('response_list_res'),
66 68
             failAction: 'log',
67 69
         },
68 70
     },

+ 1
- 1
backend/lib/routes/user/create-profile.js Переглянути файл

@@ -36,7 +36,7 @@ const responseSchemas = {
36 36
         user_id: Joi.number(),
37 37
         user_name: Joi.string(),
38 38
     }).label('created_profile'),
39
-    error: errorSchema.single
39
+    error: errorSchema.single,
40 40
 }
41 41
 
42 42
 module.exports = {

+ 1
- 1
backend/lib/routes/user/list-profiles.js Переглянути файл

@@ -28,7 +28,7 @@ const validators = {
28 28
 
29 29
 const responseSchemas = {
30 30
     profilesList: profileSchema.list,
31
-    error: errorSchema.single
31
+    error: errorSchema.single,
32 32
 }
33 33
 
34 34
 module.exports = {

+ 3
- 1
backend/lib/routes/user/login.js Переглянути файл

@@ -18,7 +18,9 @@ const validators = {
18 18
         payload: Joi.object({
19 19
             user: userSchema.single,
20 20
             error: errorSchema.single,
21
-        }).append().label('login_payload'),
21
+        })
22
+            .append()
23
+            .label('login_payload'),
22 24
     },
23 25
     user: userSchema.single,
24 26
 }

+ 4
- 4
backend/lib/routes/user/signup.js Переглянути файл

@@ -14,8 +14,8 @@ const pluginConfig = {
14 14
 
15 15
 const validators = {
16 16
     post: {
17
-        payload: userSchema.userSignup
18
-    }
17
+        payload: userSchema.userSignup,
18
+    },
19 19
 }
20 20
 
21 21
 const responseSchemas = {
@@ -27,7 +27,7 @@ const responseSchemas = {
27 27
         is_admin: Joi.number(),
28 28
         is_verified: Joi.number(),
29 29
     }).label('created_user'),
30
-    error: errorSchema.single
30
+    error: errorSchema.single,
31 31
 }
32 32
 
33 33
 module.exports = {
@@ -55,7 +55,7 @@ module.exports = {
55 55
                         is_poster: userType,
56 56
                         is_admin: 0,
57 57
                         is_verified: 0,
58
-                    }
58
+                    },
59 59
                 })
60 60
                 return h
61 61
                     .response({

+ 1
- 0
backend/lib/services/matchqueue.js Переглянути файл

@@ -39,6 +39,7 @@ module.exports = class MatchQueueService extends Schmervice.Service {
39 39
         })
40 40
         return queueByProfileId
41 41
     }
42
+
42 43
     /**
43 44
      * Saves Scored Profile Ids to MatchQue IN ORDER
44 45
      * @param {number} profileId

+ 21
- 12
backend/lib/services/notification.js Переглянути файл

@@ -17,8 +17,12 @@ const stringifyEvent = function (event) {
17 17
     const endl = '\r\n'
18 18
     for (const i in event) {
19 19
         let val = event[i]
20
-        if (val instanceof Buffer) { val = val.toString() }
21
-        if (typeof val === 'object') { val = JSON.stringify(val) }
20
+        if (val instanceof Buffer) {
21
+            val = val.toString()
22
+        }
23
+        if (typeof val === 'object') {
24
+            val = JSON.stringify(val)
25
+        }
22 26
         str += i + ': ' + val + endl
23 27
     }
24 28
     str += endl
@@ -29,7 +33,7 @@ const stringifyEvent = function (event) {
29 33
  * Transform extension
30 34
  * ?: I don't really get what this is doing
31 35
  * @param {object} options
32
- * @param {object} objectMode 
36
+ * @param {object} objectMode
33 37
  */
34 38
 class Transformer extends Transform {
35 39
     constructor(options, objectMode) {
@@ -37,16 +41,20 @@ class Transformer extends Transform {
37 41
         options = options || {}
38 42
         this.counter = 1
39 43
         this.event = options.event || null
40
-        this.generateId = options.generateId ? options.generateId : () => {
41
-            return this.counter++
42
-        }
44
+        this.generateId = options.generateId
45
+            ? options.generateId
46
+            : () => {
47
+                  return this.counter++
48
+              }
43 49
     }
44
-    _transform (chunk, encoding, callback) {
50
+    _transform(chunk, encoding, callback) {
45 51
         const event = {
46 52
             id: this.generateId(chunk),
47
-            data: chunk
53
+            data: chunk,
54
+        }
55
+        if (this.event) {
56
+            event.event = this.event
48 57
         }
49
-        if (this.event) { event.event = this.event }
50 58
         this.push(stringifyEvent(event))
51 59
         callback()
52 60
     }
@@ -54,7 +62,7 @@ class Transformer extends Transform {
54 62
         this.push(stringifyEvent(ENDER))
55 63
         callback()
56 64
     }
57
-} 
65
+}
58 66
 
59 67
 /**
60 68
  * Take an event stream and write content to another stream
@@ -95,7 +103,8 @@ const onEvent = (event, h, streamOptions) => {
95 103
         //     event.pipe(stream)
96 104
         // }
97 105
         console.log('streamOptions :', streamOptions)
98
-        return h.response(active)
106
+        return h
107
+            .response(active)
99 108
             .header('content-type', 'text/event-stream')
100 109
             .header('content-encoding', 'identity')
101 110
     }
@@ -116,4 +125,4 @@ const onEvent = (event, h, streamOptions) => {
116 125
     // internals.writeEvent(event, active)
117 126
 }
118 127
 
119
-module.exports = { onEvent }
128
+module.exports = { onEvent }

+ 27
- 18
backend/lib/services/profile/index.js Переглянути файл

@@ -82,8 +82,12 @@ module.exports = class ProfileService extends Schmervice.Service {
82 82
             // CHECKTHIS: Added this because we added user.user_name to CompleteProfile
83 83
             // so without this, we get undefined user_name
84 84
             .withGraphFetched('user')
85
-        
86
-        return profiler.makeCompleteProfilesFromProfile(profilesEntries, type, this.tagLookup)
85
+
86
+        return profiler.makeCompleteProfilesFromProfile(
87
+            profilesEntries,
88
+            type,
89
+            this.tagLookup,
90
+        )
87 91
     }
88 92
 
89 93
     async getProfilesFor(profileIdArray, type, includeResponses = true) {
@@ -106,7 +110,7 @@ module.exports = class ProfileService extends Schmervice.Service {
106 110
             profilesEntries,
107 111
             type,
108 112
             includeResponses,
109
-            this.tagLookup
113
+            this.tagLookup,
110 114
         )
111 115
     }
112 116
 
@@ -128,13 +132,14 @@ module.exports = class ProfileService extends Schmervice.Service {
128 132
              * Using using the input and converting to index
129 133
              * of the generated possible prescore array in config
130 134
              * DUPLICATE:See saveResponseForProfile() line 343
131
-             */ 
135
+             */
132 136
             let convertedResponse = responseToSave
133
-            if(scoring._isScorableResponse(responseToSave.response_key_id)) {
137
+            if (scoring._isScorableResponse(responseToSave.response_key_id)) {
134 138
                 // Convert -3 to 0, 0 to 3, 3 to 6
135 139
                 const offset = (config.scoreVals.length - 1) / 2
136 140
                 const indexFromInput = parseInt(responseToSave.val) + offset
137
-                convertedResponse.val = config.scoreVals[indexFromInput].toString()
141
+                convertedResponse.val =
142
+                    config.scoreVals[indexFromInput].toString()
138 143
             }
139 144
 
140 145
             const responseInfo = {
@@ -194,7 +199,7 @@ module.exports = class ProfileService extends Schmervice.Service {
194 199
         )
195 200
         if (matchingResponses.length > 0) {
196 201
             const alreadyAnswered = matchingResponses.map(
197
-                matchingRes => matchingRes.response_key_id
202
+                matchingRes => matchingRes.response_key_id,
198 203
             )
199 204
             await Response.query()
200 205
                 .where({ profile_id: profileId })
@@ -206,9 +211,9 @@ module.exports = class ProfileService extends Schmervice.Service {
206 211
          * Convert indexes to actual score values
207 212
          * Using using the input and converting to index
208 213
          * of the generated possible prescore array in config
209
-         */ 
214
+         */
210 215
         let convertedResponse = responseToSave
211
-        if(scoring._isScorableResponse(responseToSave.response_key_id)) {
216
+        if (scoring._isScorableResponse(responseToSave.response_key_id)) {
212 217
             // Convert -3 to 0, 0 to 3, 3 to 6
213 218
             const offset = (config.scoreVals.length - 1) / 2
214 219
             const indexFromInput = parseInt(responseToSave.val) + offset
@@ -251,7 +256,7 @@ module.exports = class ProfileService extends Schmervice.Service {
251 256
             .findOne('profile_id', profileId)
252 257
             .withGraphFetched('responses')
253 258
             .withGraphFetched('user')
254
-        
259
+
255 260
         // Move unneeded responses
256 261
         const userZip = zipcoder.getZipCodeFromProfile(userProfile)
257 262
 
@@ -263,13 +268,15 @@ module.exports = class ProfileService extends Schmervice.Service {
263 268
 
264 269
         // TODO: Let Objection optimize this
265 270
         const isPosterOpposite = userProfile.user.is_poster == 1 ? 0 : 1
266
-        profileIdsOfOppositeType = profileIdsOfOppositeType.filter(profile => {
267
-            return profile.user.is_poster == isPosterOpposite
268
-        }).filter(profile => {
269
-            // Only include profiles that included zipcode response
270
-            return zipcoder.getZipCodeFromProfile(profile) ? true : false
271
-        })
272
-        
271
+        profileIdsOfOppositeType = profileIdsOfOppositeType
272
+            .filter(profile => {
273
+                return profile.user.is_poster == isPosterOpposite
274
+            })
275
+            .filter(profile => {
276
+                // Only include profiles that included zipcode response
277
+                return zipcoder.getZipCodeFromProfile(profile) ? true : false
278
+            })
279
+
273 280
         const profilePlusDistance = await Promise.all(
274 281
             profileIdsOfOppositeType.map(async profile => {
275 282
                 const targetZip = zipcoder.getZipCodeFromProfile(profile)
@@ -315,7 +322,9 @@ module.exports = class ProfileService extends Schmervice.Service {
315 322
             'zip_code_id',
316 323
             parseInt(zipCode),
317 324
         )
318
-        if (!zipInfo) { console.error('zip:', zipCode) }
325
+        if (!zipInfo) {
326
+            console.error('zip:', zipCode)
327
+        }
319 328
         return {
320 329
             latitude: parseFloat(zipInfo.latitude),
321 330
             longitude: parseFloat(zipInfo.longitude),

+ 34
- 10
backend/lib/services/profile/profiler.js Переглянути файл

@@ -33,26 +33,50 @@ class CompleteProfile {
33 33
             // [] of all "profile" responses
34 34
             this.responses = profile.responses
35 35
             // image, language, duration, presence, blurb, urgency, role, pronouns, distance
36
-            const prefs = ['zipcode', 'duration', 'presence', 'urgency', 'role', 'pronouns', 'distance']
36
+            const prefs = [
37
+                'zipcode',
38
+                'duration',
39
+                'presence',
40
+                'urgency',
41
+                'role',
42
+                'pronouns',
43
+                'distance',
44
+            ]
37 45
             const prefsKeys = config.prefKeys
38 46
             prefs.forEach((pref, i) => {
39 47
                 this.profile_prefs[pref] = this.responses.filter(
40
-                    r => r.response_key_id === prefsKeys[i]
48
+                    r => r.response_key_id === prefsKeys[i],
41 49
                 )[0]
42 50
             })
43
-            this.profile_description = this.responses.filter(r => r.response_key_id === config.blurbKey).map(r => r.val)[0]
44
-            this.profile_media = this.responses.filter(r => r.response_key_id === config.mediaKey).map(r => r.val)
45
-            this.profile_languages = this.responses.filter(r => r.response_key_id === config.langKey).map(r => r.val)
51
+            this.profile_description = this.responses
52
+                .filter(r => r.response_key_id === config.blurbKey)
53
+                .map(r => r.val)[0]
54
+            this.profile_media = this.responses
55
+                .filter(r => r.response_key_id === config.mediaKey)
56
+                .map(r => r.val)
57
+            this.profile_languages = this.responses
58
+                .filter(r => r.response_key_id === config.langKey)
59
+                .map(r => r.val)
46 60
         }
47 61
     }
48 62
 }
49 63
 
50
-const makeCompleteProfiles = (profileIdArray, profilesEntries, type, includeResponses, tagLookup) => {
64
+const makeCompleteProfiles = (
65
+    profileIdArray,
66
+    profilesEntries,
67
+    type,
68
+    includeResponses,
69
+    tagLookup,
70
+) => {
51 71
     const completeProfiles = []
52 72
     profileIdArray.forEach(pid => {
53 73
         profilesEntries.forEach(entry => {
54 74
             if (entry.profile_id == pid) {
55
-                const complete = new CompleteProfile(entry, type, includeResponses)
75
+                const complete = new CompleteProfile(
76
+                    entry,
77
+                    type,
78
+                    includeResponses,
79
+                )
56 80
                 tagger.setProfileTags(entry, complete, tagLookup)
57 81
                 completeProfiles.push(complete)
58 82
             }
@@ -60,7 +84,7 @@ const makeCompleteProfiles = (profileIdArray, profilesEntries, type, includeResp
60 84
     })
61 85
     return completeProfiles
62 86
 }
63
-const makeCompleteProfilesFromProfile = (profilesEntries, type, tagLookup)=> {
87
+const makeCompleteProfilesFromProfile = (profilesEntries, type, tagLookup) => {
64 88
     profilesEntries.forEach(profile => {
65 89
         tagger.setProfileTags(profile, profile, tagLookup)
66 90
     })
@@ -74,5 +98,5 @@ const makeCompleteProfilesFromProfile = (profilesEntries, type, tagLookup)=> {
74 98
 module.exports = {
75 99
     CompleteProfile,
76 100
     makeCompleteProfiles,
77
-    makeCompleteProfilesFromProfile
78
-}
101
+    makeCompleteProfilesFromProfile,
102
+}

+ 7
- 7
backend/lib/services/profile/scorer.js Переглянути файл

@@ -20,7 +20,7 @@ const makeScoreLookup = (aspects, labels) => {
20 20
 
21 21
 const _isScorableResponse = res_key_id => {
22 22
     let isScorable = false
23
-    if(config.resKeys.includes(res_key_id)) {
23
+    if (config.resKeys.includes(res_key_id)) {
24 24
         isScorable = true
25 25
     }
26 26
     return isScorable
@@ -32,11 +32,11 @@ const scoreResponses = (seeker, potentialMatch, prescoreLookup) => {
32 32
             error: `complete responses for profile: ${seeker.profile_id} unqeual to profile: ${potentialMatch.profile_id} | ${seeker.responses.length}:${potentialMatch.responses.length}`,
33 33
         }
34 34
 
35
-    const aRes = seeker.responses.filter(
36
-        res =>  _isScorableResponse(res.response_key_id)
35
+    const aRes = seeker.responses.filter(res =>
36
+        _isScorableResponse(res.response_key_id),
37 37
     )
38
-    const bRes = potentialMatch.responses.filter(
39
-        res =>  _isScorableResponse(res.response_key_id)
38
+    const bRes = potentialMatch.responses.filter(res =>
39
+        _isScorableResponse(res.response_key_id),
40 40
     )
41 41
 
42 42
     const composite = []
@@ -72,5 +72,5 @@ module.exports = {
72 72
     _isScorableResponse,
73 73
     scoreResponses,
74 74
     makeScoreLookup,
75
-    scoreAll
76
-}
75
+    scoreAll,
76
+}

+ 2
- 2
backend/lib/services/profile/tagger.js Переглянути файл

@@ -3,5 +3,5 @@ const setProfileTags = (inProfile, outProfile, tagLookup) => {
3 3
 }
4 4
 
5 5
 module.exports = {
6
-    setProfileTags
7
-}
6
+    setProfileTags,
7
+}

+ 3
- 3
backend/lib/services/profile/zipcoder.js Переглянути файл

@@ -6,7 +6,7 @@ const config = require('../../../db/data-generator/config.json')
6 6
 const getZipCodeFromProfile = profile => {
7 7
     // There should only be one zip code entry per profile
8 8
     let zipRes = profile.responses.find(
9
-        res => res.response_key_id == config.zipcodeKey
9
+        res => res.response_key_id == config.zipcodeKey,
10 10
     )
11 11
     return zipRes.val
12 12
 }
@@ -21,5 +21,5 @@ const filterByDistance = (profileList, max) => {
21 21
 
22 22
 module.exports = {
23 23
     getZipCodeFromProfile,
24
-    filterByDistance
25
-}
24
+    filterByDistance,
25
+}

+ 5
- 2
backend/lib/services/user.js Переглянути файл

@@ -58,9 +58,12 @@ module.exports = class UserService extends Schmervice.Service {
58 58
      */
59 59
     async signup({ password, userInfo }, txn) {
60 60
         const { User } = this.server.models()
61
-        const matchingEmails = await User.query().where('user_email', userInfo.user_email)
61
+        const matchingEmails = await User.query().where(
62
+            'user_email',
63
+            userInfo.user_email,
64
+        )
62 65
 
63
-        if(matchingEmails.length > 0) { 
66
+        if (matchingEmails.length > 0) {
64 67
             throw `User ${userInfo.user_email} already exists: Cannot create a user without a unique email`
65 68
         }
66 69
         const user = await User.query(txn).insert(userInfo)

+ 2
- 2
backend/server/index.js Переглянути файл

@@ -25,7 +25,7 @@ exports.deployment = async ({ start } = {}) => {
25 25
 if (require.main === module) {
26 26
     exports.deployment({ start: true })
27 27
 
28
-    process.on('unhandledRejection', (err) => {
28
+    process.on('unhandledRejection', err => {
29 29
         throw err
30 30
     })
31
-}
31
+}

frontend/.eslintrc.json → frontend/.eslintrc Переглянути файл


frontend/.prettierrc.json → frontend/.prettierrc Переглянути файл

@@ -10,4 +10,4 @@
10 10
     "pugFramework": "vue",
11 11
     "pugSingleFileComponentIndentation": false,
12 12
     "pugClassNotation": "literal"
13
-}
13
+}

+ 40
- 50
frontend/src/App.vue Переглянути файл

@@ -1,15 +1,17 @@
1 1
 <template lang="pug">
2
-SideBar(
3
-    v-if="showSidebar"
4
-    :pid="getPid"
5
-    @updatePid="setPid"
6
-    @hide="showSidebar = false"
7
-)
8
-RouterView(
9
-    :pid="getPid"
10
-    @updatePid="setPid"
11
-    @show-sidebar="showSidebar = !showSidebar"
12
-)
2
+w-app
3
+    w-button My Button
4
+    SideBar(
5
+        v-if="showSidebar"
6
+        :pid="getPid"
7
+        @updatePid="setPid"
8
+        @hide="showSidebar = false"
9
+    )
10
+    RouterView(
11
+        :pid="getPid"
12
+        @updatePid="setPid"
13
+        @show-sidebar="showSidebar = !showSidebar"
14
+    )
13 15
 </template>
14 16
 
15 17
 <script>
@@ -26,23 +28,25 @@ const DEV_PID = 45
26 28
 export default {
27 29
     components: { SideBar },
28 30
     data: () => ({
29
-        showSidebar: false
31
+        showSidebar: false,
30 32
     }),
31 33
     computed: {
32
-        getPid: () => currentProfile.id.value
34
+        getPid: () => currentProfile.id.value,
33 35
     },
34 36
     async created() {
35 37
         /** Get questions so we can compare against profile responses */
36 38
         await surveyFactory.getQuestions()
37 39
 
38
-        /** 
40
+        /**
39 41
          * Development mode turns router guards off so
40
-         * we hard set the profile id instead of 
42
+         * we hard set the profile id instead of
41 43
          * using the login form
42
-        */
43
-        if(DEV_MODE) { this.setPid(DEV_PID) }
44
+         */
45
+        if (DEV_MODE) {
46
+            this.setPid(DEV_PID)
47
+        }
44 48
 
45
-        if(currentProfile.isLoggedIn) {
49
+        if (currentProfile.isLoggedIn) {
46 50
             console.warn(`setting up Chatter and Toaster for ${this.getPid}...`)
47 51
             this.setupChatter()
48 52
             this.setupToaster()
@@ -74,42 +78,28 @@ export default {
74 78
 </script>
75 79
 
76 80
 <style lang="postcss">
81
+/* prettier-ignore */
77 82
 @import './sss/theme.sss'
78 83
 
79 84
 #app
80
-    display: flex
81
-    flex-direction: row
82
-    text-align: center
83
-    color: $primary
84
-    font-family: $sans
85
-    background-color: $dark
86
-    overflow-x: hidden
87 85
     height: 100%
88
-    > main
89
-        position: relative
86
+    flex-direction: row
87
+    .w-app
88
+        display: flex
89
+        text-align: center
90
+        color: $primary
91
+        font-family: $sans
92
+        background-color: $dark
93
+        overflow-x: hidden
90 94
         height: 100%
91
-        > header
92
-            h2
93
-                font-size: $ms-1
94
-        > article
95
+        > main
96
+            position: relative
95 97
             height: 100%
96
-            width: 100%
97
-            flex-direction: column
98
-    
99
-    button
100
-        padding: $ms-0
101
-        background-color: $primary
102
-        border: 1px transparent solid
103
-        border-radius: $ms-1
104
-        transition: $transition
105
-        &:hover
106
-            background-color: $secondary
107
-            border: 1px transparent solid
108
-            border-radius: $ms-1
109
-            cursor: pointer
110
-            color: $primary
111
-        &:disabled
112
-            cursor: default
113
-            color: $primary
114
-            background-color: $light
98
+            > header
99
+                h2
100
+                    font-size: $ms-1
101
+            > article
102
+                height: 100%
103
+                width: 100%
104
+                flex-direction: column
115 105
 </style>

+ 1
- 0
frontend/src/components/MainNav.vue Переглянути файл

@@ -13,6 +13,7 @@ export default {
13 13
 </script>
14 14
 
15 15
 <style lang="postcss">
16
+/* prettier-ignore */
16 17
 #main-header
17 18
   position: absolute
18 19
   bottom: 1vh

+ 3
- 4
frontend/src/components/Messages.vue Переглянути файл

@@ -19,18 +19,18 @@ import { mixins } from '../utils'
19 19
 
20 20
 export default {
21 21
     name: 'ProfileMessages',
22
-    mixins: [ mixins.pidMixin ],
22
+    mixins: [mixins.pidMixin],
23 23
     props: {
24 24
         matches: {
25 25
             type: [Object, Array],
26
-            default: () => []
26
+            default: () => [],
27 27
         },
28 28
     },
29 29
 }
30 30
 </script>
31 31
 
32 32
 <style lang="postcss">
33
-
33
+/* prettier-ignore */
34 34
 .sidebar
35 35
     &--messages
36 36
         padding: 20px 10px
@@ -68,5 +68,4 @@ export default {
68 68
     &__content
69 69
         padding-top: 10px
70 70
         line-height: 1em
71
-        
72 71
 </style>

+ 1
- 2
frontend/src/components/ProfileCardList.vue Переглянути файл

@@ -120,6 +120,7 @@ const loadedProfiles = [...props.profiles]
120 120
 </script>
121 121
 
122 122
 <style lang="postcss">
123
+/* prettier-ignore */
123 124
 .profile-card-list
124 125
     display: flex
125 126
     justify-content: center
@@ -145,6 +146,4 @@ const loadedProfiles = [...props.profiles]
145 146
             background-color: goldenrod
146 147
             nav > button
147 148
                 font-size: 2vw
148
-
149
-
150 149
 </style>

+ 5
- 5
frontend/src/components/SideBar.vue Переглянути файл

@@ -14,8 +14,8 @@ import Messages from './Messages.vue'
14 14
 import { mixins } from '../utils'
15 15
 
16 16
 export default {
17
-    components: { Messages }, 
18
-    mixins: [ mixins.pidMixin ],
17
+    components: { Messages },
18
+    mixins: [mixins.pidMixin],
19 19
     data: () => ({
20 20
         switchToPID: null,
21 21
         matches: [
@@ -36,11 +36,12 @@ export default {
36 36
     mounted() {
37 37
         // Set the form to display the default pid set in Home.vue
38 38
         this.switchToPID = this.pid
39
-    }
39
+    },
40 40
 }
41 41
 </script>
42 42
 
43 43
 <style lang="postcss">
44
+/* prettier-ignore */
44 45
 aside.sidebar
45 46
     background-color: yellow
46 47
     height: 100vh
@@ -53,5 +54,4 @@ aside.sidebar
53 54
     flex-direction: row
54 55
     input
55 56
         border: 0
56
-
57
-</style>
57
+</style>

+ 8
- 7
frontend/src/main.js Переглянути файл

@@ -2,6 +2,8 @@ import { createApp } from 'vue'
2 2
 import router from './router'
3 3
 import { checkLoginStatus } from './router/guards'
4 4
 
5
+import WaveUI from 'wave-ui'
6
+
5 7
 import App from './App.vue'
6 8
 import MainNav from './components/MainNav.vue'
7 9
 
@@ -12,21 +14,20 @@ const DEV = import.meta.env.VITE_DEV == 'true'
12 14
  */
13 15
 router.beforeEach((to, from, next) => {
14 16
     /**
15
-     * Skip any route guarding with `npm run dev`
16
-     */
17
-    if(DEV) { next() }
18
-
19
-    /**
20
-     * Use the loginService to deal with login details
17
+     * Skip any route guarding with `npm run dev` or
18
+     * use the loginService to deal with login details
21 19
      * Activate with `npm run nodev`
22 20
      */
23
-    else {
21
+    if (DEV) {
22
+        next()
23
+    } else {
24 24
         checkLoginStatus(to, next)
25 25
     }
26 26
 })
27 27
 
28 28
 const run = entry => {
29 29
     const siimee = createApp(App).use(router)
30
+    new WaveUI(siimee, {})
30 31
     siimee.component('MainNav', MainNav)
31 32
     siimee.mount(entry)
32 33
 }

+ 12
- 5
frontend/src/views/HomeView.vue Переглянути файл

@@ -2,7 +2,11 @@
2 2
 main.view--home.f-col.start.w-full
3 3
     header
4 4
         h2 home - profile: {{ pid }}
5
-
5
+        w-badge
6
+            template(#badge) 3
7
+            w-button(color="primary")
8
+                w-icon(class="mr1") mdi mdi-email
9
+                    Emails
6 10
     article(v-if="cards.length && !loading")
7 11
         ProfileCardList(:profiles="cards" :pid="pid" @reload="getCards")
8 12
 
@@ -20,10 +24,10 @@ import { mixins } from '../utils'
20 24
 
21 25
 /** Callback used to format incoming into card */
22 26
 const convertToCard = profile => {
23
-    if(profile.type !== 'profile') {
27
+    if (profile.type !== 'profile') {
24 28
         console.error(`Cannot convert ${profile} to Card. Invalid entity.`)
25 29
     }
26
-    if(!profile.isValid()) {
30
+    if (!profile.isValid()) {
27 31
         console.warn(`Profile ${profile.profile_id} is not a valid profile.`)
28 32
     }
29 33
     return new Card({
@@ -36,7 +40,7 @@ const convertToCard = profile => {
36 40
 export default {
37 41
     name: 'HomeView',
38 42
     components: { ProfileCardList },
39
-    mixins: [ mixins.pidMixin, mixins.cardMixin ],
43
+    mixins: [mixins.pidMixin, mixins.cardMixin],
40 44
     methods: {
41 45
         /** Gets called from cardMixin */
42 46
         async getCards() {
@@ -44,7 +48,9 @@ export default {
44 48
             try {
45 49
                 const queueList = await fetchQueueByProfileId(this.pid)
46 50
                 this.cards = this._reformat(queueList, convertToCard)
47
-            } catch (err) { console.error(err) }
51
+            } catch (err) {
52
+                console.error(err)
53
+            }
48 54
             this.loading = false
49 55
         },
50 56
     },
@@ -52,6 +58,7 @@ export default {
52 58
 </script>
53 59
 
54 60
 <style lang="postcss">
61
+/* prettier-ignore */
55 62
 main
56 63
     position: relative
57 64
     height: 100%

+ 6
- 6
frontend/src/views/LoginView.vue Переглянути файл

@@ -18,24 +18,24 @@ import { currentProfile } from '../services'
18 18
 export default {
19 19
     data: () => ({
20 20
         form: {
21
-            profileId: null
21
+            profileId: null,
22 22
         },
23 23
     }),
24 24
     methods: {
25 25
         async onSubmit() {
26
-            if(!this.form.profileId) console.error('No profile in form')
27
-            
26
+            if (!this.form.profileId) console.error('No profile in form')
27
+
28 28
             /**
29 29
              * Default to the HomeView and alter as needed (side-effects!)
30 30
              */
31 31
             const toRoute = { name: 'HomeView' }
32
-            
32
+
33 33
             /**
34 34
              * Profile needs a complete survey and
35 35
              * alters the url if it's incomplete
36 36
              */
37 37
             const alreadyLoggedIn = await currentProfile.isLoggedIn
38
-            if(!alreadyLoggedIn) {
38
+            if (!alreadyLoggedIn) {
39 39
                 await currentProfile.login(this.form.profileId)
40 40
             }
41 41
 
@@ -46,5 +46,5 @@ export default {
46 46
 </script>
47 47
 
48 48
 <style lang="postcss">
49
-
49
+/* prettier-ignore */
50 50
 </style>

+ 7
- 4
frontend/src/views/MatchesView.vue Переглянути файл

@@ -20,10 +20,10 @@ import { mixins } from '../utils'
20 20
 
21 21
 /** Callback used to format incoming into card */
22 22
 const convertToCard = grouping => {
23
-    if(grouping.type !== 'grouping') {
23
+    if (grouping.type !== 'grouping') {
24 24
         console.error(`Cannot convert ${grouping} to Card. Invalid entity.`)
25 25
     }
26
-    if(!grouping.profile.isValid()) {
26
+    if (!grouping.profile.isValid()) {
27 27
         console.warn(`Profile in ${grouping} is not a valid profile.`)
28 28
     }
29 29
     return new Card({
@@ -36,7 +36,7 @@ const convertToCard = grouping => {
36 36
 export default {
37 37
     name: 'MatchView',
38 38
     components: { ProfileCardList },
39
-    mixins: [ mixins.pidMixin, mixins.cardMixin ],
39
+    mixins: [mixins.pidMixin, mixins.cardMixin],
40 40
     methods: {
41 41
         /** Gets called from cardMixin */
42 42
         async getCards() {
@@ -44,7 +44,9 @@ export default {
44 44
             try {
45 45
                 const matchList = await fetchMembershipsByProfileId(this.pid)
46 46
                 this.cards = this._reformat(matchList, convertToCard)
47
-            } catch (err) { console.error(err) }
47
+            } catch (err) {
48
+                console.error(err)
49
+            }
48 50
             this.loading = false
49 51
         },
50 52
     },
@@ -52,6 +54,7 @@ export default {
52 54
 </script>
53 55
 
54 56
 <style lang="postcss">
57
+/* prettier-ignore */
55 58
 .row
56 59
     display: flex
57 60
     flex-direction: row

+ 3
- 1
frontend/src/views/ProfileView.vue Переглянути файл

@@ -61,4 +61,6 @@ export default {
61 61
 }
62 62
 </script>
63 63
 
64
-<style lang="postcss"></style>
64
+<style lang="postcss">
65
+/* prettier-ignore */
66
+</style>

+ 63
- 26
frontend/src/views/SurveyView.vue Переглянути файл

@@ -61,7 +61,13 @@ main.view--survey.f-col.start.w-full
61 61
 import { surveyFactory, randomSurveyResponses } from '@/utils'
62 62
 import { allSteps, aspectResponses, possible } from '@/utils/lang'
63 63
 
64
-import { currentProfile, createProfileForUserId, fetchProfileByProfileId, scoreSurveyByProfileId, signupUser } from '@/services'
64
+import {
65
+    currentProfile,
66
+    createProfileForUserId,
67
+    fetchProfileByProfileId,
68
+    scoreSurveyByProfileId,
69
+    signupUser,
70
+} from '@/services'
65 71
 
66 72
 import { maxDistanceKey } from '../../../backend/db/data-generator/config.json'
67 73
 
@@ -86,7 +92,7 @@ export default {
86 92
                 honesty: 0,
87 93
                 respect: 0,
88 94
             },
89
-            aspectResponses: Object.values(aspectResponses.usa)
95
+            aspectResponses: Object.values(aspectResponses.usa),
90 96
         }
91 97
     },
92 98
     computed: {
@@ -116,7 +122,12 @@ export default {
116 122
             toGen.forEach(async () => {
117 123
                 const randRes = randomSurveyResponses(this.bypassCount)
118 124
                 randRes.forEach((tr, i) => {
119
-                    this.storeResponseLike(i, tr.idOrPrompt, tr.idOrPrompt, tr.val)
125
+                    this.storeResponseLike(
126
+                        i,
127
+                        tr.idOrPrompt,
128
+                        tr.idOrPrompt,
129
+                        tr.val,
130
+                    )
120 131
                 })
121 132
                 this.bypassCount++
122 133
                 await this.onSave()
@@ -128,14 +139,14 @@ export default {
128 139
             // Also update the form model state for now
129 140
             // We probably can refactor this out
130 141
             this.profile[prompt] = val
131
-            
142
+
132 143
             /**
133 144
              * If NO response id is present, that means the answer
134 145
              * is required and associated with a User and NOT a Profile
135 146
              **/
136 147
             this.responseLikes[`step-${step}`] = {
137 148
                 idOrPrompt: id ? id : prompt,
138
-                val: val.toString()
149
+                val: val.toString(),
139 150
             }
140 151
         },
141 152
         _formatIntoResponses(survey) {
@@ -147,7 +158,7 @@ export default {
147 158
         },
148 159
         /**
149 160
          * Survey responses have User information
150
-         * mixed in with scoring information so we 
161
+         * mixed in with scoring information so we
151 162
          * need to separate them
152 163
          * @param {array} responseLikes answered by the survey
153 164
          */
@@ -155,7 +166,10 @@ export default {
155 166
             let survey = []
156 167
             const user = {}
157 168
             responseLikes.forEach(resLike => {
158
-                if(resLike.idOrPrompt && Number.isFinite(parseInt(resLike.idOrPrompt))) {
169
+                if (
170
+                    resLike.idOrPrompt &&
171
+                    Number.isFinite(parseInt(resLike.idOrPrompt))
172
+                ) {
159 173
                     survey.push(resLike)
160 174
                 } else {
161 175
                     user[resLike.idOrPrompt] = resLike.val
@@ -166,24 +180,34 @@ export default {
166 180
         async _createUserProfileRel(user, survey) {
167 181
             /** A User is required before creating a profile */
168 182
             const createdUser = await signupUser(user)
169
-            if(!createdUser) return
183
+            if (!createdUser) return
170 184
 
171
-            const userProfileRel = await createProfileForUserId(createdUser.user_id, survey)
172
-            if(!userProfileRel) return 
185
+            const userProfileRel = await createProfileForUserId(
186
+                createdUser.user_id,
187
+                survey,
188
+            )
189
+            if (!userProfileRel) return
173 190
 
174 191
             return userProfileRel
175 192
         },
176 193
         async _getProfileWithScore(createdProfileId, maxDistance) {
177 194
             /** A Profile is associated with n:1 user and referenced by profile id */
178
-            const fetchedProfile = await fetchProfileByProfileId(createdProfileId)
179
-            if(!fetchedProfile) {
180
-                console.error(`Could not fetch Profile ${createdProfileId}. Please check that a User and Profile were created.`)
195
+            const fetchedProfile = await fetchProfileByProfileId(
196
+                createdProfileId,
197
+            )
198
+            if (!fetchedProfile) {
199
+                console.error(
200
+                    `Could not fetch Profile ${createdProfileId}. Please check that a User and Profile were created.`,
201
+                )
181 202
                 return
182 203
             }
183 204
 
184 205
             /** Use profile answers to compare against other profile answers */
185
-            const scored = await scoreSurveyByProfileId(createdProfileId, maxDistance)
186
-            if(!scored) {
206
+            const scored = await scoreSurveyByProfileId(
207
+                createdProfileId,
208
+                maxDistance,
209
+            )
210
+            if (!scored) {
187 211
                 console.error(`Could not score Profile ${createdProfileId}.`)
188 212
                 return
189 213
             }
@@ -191,34 +215,46 @@ export default {
191 215
         },
192 216
         async _setLoginForProfile(profile) {
193 217
             const currentId = currentProfile.login(profile.profile_id)
194
-            if(currentId && profile.responses.length) {
218
+            if (currentId && profile.responses.length) {
195 219
                 // Stores responses without fetching again
196 220
                 currentProfile.setResponses(profile.responses)
197 221
             }
198
-            if(!currentProfile.isComplete) {
199
-                console.error(`Profile ${currentProfile.id} is incomplete. Please make sure all survey questions have been answered.`)
222
+            if (!currentProfile.isComplete) {
223
+                console.error(
224
+                    `Profile ${currentProfile.id} is incomplete. Please make sure all survey questions have been answered.`,
225
+                )
200 226
                 return
201 227
             }
202 228
         },
203 229
         async onSave() {
204
-            const [ user, survey] = this._separateUserInfoFromResponses(Object.values(this.responseLikes))
205
-            const maxDistanceRes = survey.find(res => res.response_key_id == maxDistanceKey)
230
+            const [user, survey] = this._separateUserInfoFromResponses(
231
+                Object.values(this.responseLikes),
232
+            )
233
+            const maxDistanceRes = survey.find(
234
+                res => res.response_key_id == maxDistanceKey,
235
+            )
206 236
             /**
207 237
              * Creating a profile only returns the created
208 238
              * user id and profile id
209 239
              **/
210
-            const userProfileRel = await this._createUserProfileRel(user, survey)
240
+            const userProfileRel = await this._createUserProfileRel(
241
+                user,
242
+                survey,
243
+            )
211 244
             const createdProfileId = userProfileRel.profile_id
212 245
 
213 246
             /** A Profile is associated with n:1 user and referenced by profile id */
214
-            const fetchedProfile = await this._getProfileWithScore(createdProfileId, maxDistanceRes.val)
215
-            
216
-            /** 
247
+            const fetchedProfile = await this._getProfileWithScore(
248
+                createdProfileId,
249
+                maxDistanceRes.val,
250
+            )
251
+
252
+            /**
217 253
              * Login only after there is a user and
218 254
              * that user has a profile and all responses
219
-            */
255
+             */
220 256
             this._setLoginForProfile(fetchedProfile)
221
-            
257
+
222 258
             this.$router.push({ name: 'HomeView' })
223 259
         },
224 260
         back(prompt) {
@@ -230,6 +266,7 @@ export default {
230 266
 </script>
231 267
 
232 268
 <style lang="postcss">
269
+/* prettier-ignore */
233 270
 .slide-up
234 271
     &-leave, &-enter
235 272
         &-active

+ 7
- 0
frontend/vite.config.js Переглянути файл

@@ -9,4 +9,11 @@ export default defineConfig({
9 9
             '@': require('path').resolve(__dirname, 'src'),
10 10
         },
11 11
     },
12
+    css: {
13
+        preprocessorOptions: {
14
+            scss: {
15
+                additionalData: '$use-layout-classes: false;@import "/src/../node_modules/wave-ui/src/wave-ui/scss/_variables.scss";',
16
+            },
17
+        },
18
+    },
12 19
 })

Завантаження…
Відмінити
Зберегти