Ver código fonte

:gear: altering response_key schema | :pencil: outlined backend object use

tags/0.0.1
j 4 anos atrás
pai
commit
d49569e349

+ 1
- 0
backend/README.md Ver arquivo

@@ -43,6 +43,7 @@ Since we can't unseed the database, it's best to destroy the `dev` database and
43 43
 ## :electric_plug: Run
44 44
 
45 45
 1. Run `npm run start` to start up the server
46
+2. Check `http://localhost:3001/documentation` to see the interactive `API` documentation
46 47
 
47 48
 ## :robot: Deployment
48 49
 

+ 2
- 1
backend/db/migrations/20210527174416_create_response_keys_table.js Ver arquivo

@@ -1,7 +1,8 @@
1 1
 exports.up = function (knex) {
2 2
     return knex.schema.createTable('response_keys', function (table) {
3 3
         table.increments('response_key_id').primary()
4
-        table.string('response_key_name').notNullable()
4
+        table.string('response_key_category').notNullable()
5
+        table.string('response_key_prompt')
5 6
         table.string('response_key_description')
6 7
     })
7 8
 }

+ 175
- 29
backend/db/mock.js Ver arquivo

@@ -1,10 +1,40 @@
1 1
 module.exports = {
2 2
     users: [
3
-        { user_id: 1, user_name: 'usample', user_email: 'user_sample@doggo.com', is_admin: true, is_poster: false },
4
-        { user_id: 2, user_name: 'fifi', user_email: 'fifi@ismycat.com', is_admin: false, is_poster: false },
5
-        { user_id: 3, user_name: 'mochi', user_email: 'mochi@issomeothercat.com', is_admin: false, is_poster: false },
6
-        { user_id: 4, user_name: 'archie', user_email: 'ar_cat@hires.com', is_admin: false, is_poster: true },
7
-        { user_id: 5, user_name: 'lulu', user_email: 'totallylegit@pets.com', is_admin: false, is_poster: false },
3
+        {
4
+            user_id: 1,
5
+            user_name: 'usample',
6
+            user_email: 'user_sample@doggo.com',
7
+            is_admin: true,
8
+            is_poster: false,
9
+        },
10
+        {
11
+            user_id: 2,
12
+            user_name: 'fifi',
13
+            user_email: 'fifi@ismycat.com',
14
+            is_admin: false,
15
+            is_poster: false,
16
+        },
17
+        {
18
+            user_id: 3,
19
+            user_name: 'mochi',
20
+            user_email: 'mochi@issomeothercat.com',
21
+            is_admin: false,
22
+            is_poster: false,
23
+        },
24
+        {
25
+            user_id: 4,
26
+            user_name: 'archie',
27
+            user_email: 'ar_cat@hires.com',
28
+            is_admin: false,
29
+            is_poster: true,
30
+        },
31
+        {
32
+            user_id: 5,
33
+            user_name: 'lulu',
34
+            user_email: 'totallylegit@pets.com',
35
+            is_admin: false,
36
+            is_poster: false,
37
+        },
8 38
     ],
9 39
     profiles: [
10 40
         { profile_id: 1, user_id: 2 },
@@ -15,47 +45,163 @@ module.exports = {
15 45
         { profile_id: 6, user_id: 4 },
16 46
     ],
17 47
     response_keys: [
18
-        { response_key_id: 1, response_key_name: 'grit', response_key_description: null },
19
-        { response_key_id: 2, response_key_name: 'openness', response_key_description: null },
20
-        { response_key_id: 3, response_key_name: 'description', response_key_description: null },
48
+        {
49
+            response_key_id: 1,
50
+            response_key_category: 'grit',
51
+            response_key_prompt: 'question for grit',
52
+            response_key_description: null,
53
+        },
54
+        {
55
+            response_key_id: 2,
56
+            response_key_category: 'openness',
57
+            response_key_prompt: 'question for openness',
58
+            response_key_description: null,
59
+        },
60
+        {
61
+            response_key_id: 3,
62
+            response_key_category: 'empathy',
63
+            response_key_prompt: 'question for empathy',
64
+            response_key_description: null,
65
+        },
21 66
     ],
22 67
     responses: [
23 68
         { response_id: 1, profile_id: 2, response_key_id: 2, val: '80' },
24 69
         { response_id: 2, profile_id: 2, response_key_id: 1, val: '70' },
25 70
         { response_id: 3, profile_id: 2, response_key_id: 1, val: '50' },
26
-        { response_id: 4, profile_id: 2, response_key_id: 3, val: 'I am actually a very experienced cat.' },
27
-        { response_id: 5, profile_id: 3, response_key_id: 3, val: 'I am not a person but I need a job' },
28
-        { response_id: 6, profile_id: 4, response_key_id: 3, val: 'Just a job that needs grit' },
71
+        {
72
+            response_id: 4,
73
+            profile_id: 2,
74
+            response_key_id: 3,
75
+            val: 'I am actually a very experienced cat.',
76
+        },
77
+        {
78
+            response_id: 5,
79
+            profile_id: 3,
80
+            response_key_id: 3,
81
+            val: 'I am not a person but I need a job',
82
+        },
83
+        {
84
+            response_id: 6,
85
+            profile_id: 4,
86
+            response_key_id: 3,
87
+            val: 'Just a job that needs grit',
88
+        },
29 89
         { response_id: 7, profile_id: 4, response_key_id: 2, val: '30' },
30 90
         { response_id: 8, profile_id: 4, response_key_id: 1, val: '100' },
31
-        { response_id: 9, profile_id: 5, response_key_id: 3, val: 'This job posting is awful' },
91
+        {
92
+            response_id: 9,
93
+            profile_id: 5,
94
+            response_key_id: 3,
95
+            val: 'This job posting is awful',
96
+        },
32 97
     ],
33 98
     memberships: [
34
-        { membership_id: 1, user_id: 1, grouping_id: 1, membership_type: '_admin', can_edit: true, is_active: true },
35
-        { membership_id: 2, user_id: 1, grouping_id: 2, membership_type: 'recruiter', can_edit: true, is_active: true },
36
-        { membership_id: 3, user_id: 1, grouping_id: 3, membership_type: 'participant', can_edit: false, is_active: true },
37
-        { membership_id: 4, user_id: 2, grouping_id: 3, membership_type: 'participant', can_edit: false, is_active: false },
38
-        { membership_id: 5, user_id: 4, grouping_id: 4, membership_type: 'participant', can_edit: false, is_active: true },
39
-        { membership_id: 6, user_id: 2, grouping_id: 4, membership_type: 'participant', can_edit: false, is_active: false },
40
-        { membership_id: 7, user_id: 3, grouping_id: 5, membership_type: 'participant', can_edit: false, is_active: true },
41
-        { membership_id: 8, user_id: 1, grouping_id: 5, membership_type: 'participant', can_edit: false, is_active: true },
99
+        {
100
+            membership_id: 1,
101
+            user_id: 1,
102
+            grouping_id: 1,
103
+            membership_type: '_admin',
104
+            can_edit: true,
105
+            is_active: true,
106
+        },
107
+        {
108
+            membership_id: 2,
109
+            user_id: 1,
110
+            grouping_id: 2,
111
+            membership_type: 'recruiter',
112
+            can_edit: true,
113
+            is_active: true,
114
+        },
115
+        {
116
+            membership_id: 3,
117
+            user_id: 1,
118
+            grouping_id: 3,
119
+            membership_type: 'participant',
120
+            can_edit: false,
121
+            is_active: true,
122
+        },
123
+        {
124
+            membership_id: 4,
125
+            user_id: 2,
126
+            grouping_id: 3,
127
+            membership_type: 'participant',
128
+            can_edit: false,
129
+            is_active: false,
130
+        },
131
+        {
132
+            membership_id: 5,
133
+            user_id: 4,
134
+            grouping_id: 4,
135
+            membership_type: 'participant',
136
+            can_edit: false,
137
+            is_active: true,
138
+        },
139
+        {
140
+            membership_id: 6,
141
+            user_id: 2,
142
+            grouping_id: 4,
143
+            membership_type: 'participant',
144
+            can_edit: false,
145
+            is_active: false,
146
+        },
147
+        {
148
+            membership_id: 7,
149
+            user_id: 3,
150
+            grouping_id: 5,
151
+            membership_type: 'participant',
152
+            can_edit: false,
153
+            is_active: true,
154
+        },
155
+        {
156
+            membership_id: 8,
157
+            user_id: 1,
158
+            grouping_id: 5,
159
+            membership_type: 'participant',
160
+            can_edit: false,
161
+            is_active: true,
162
+        },
42 163
     ],
43 164
     groupings: [
44
-        { grouping_id: 1, grouping_name: '00000000_siimee_', grouping_type: 'company' },
45
-        { grouping_id: 2, grouping_name: '01010101_testco_', grouping_type: 'company' },
46
-        { grouping_id: 3, grouping_name: '11111111_usample_fifi', grouping_type: 'match'},
47
-        { grouping_id: 4, grouping_name: '12121212_archie_fifi', grouping_type: 'match' },
48
-        { grouping_id: 5, grouping_name: '32323232_mochi_usample', grouping_type: 'match' },
165
+        {
166
+            grouping_id: 1,
167
+            grouping_name: '00000000_siimee_',
168
+            grouping_type: 'company',
169
+        },
170
+        {
171
+            grouping_id: 2,
172
+            grouping_name: '01010101_testco_',
173
+            grouping_type: 'company',
174
+        },
175
+        {
176
+            grouping_id: 3,
177
+            grouping_name: '11111111_usample_fifi',
178
+            grouping_type: 'match',
179
+        },
180
+        {
181
+            grouping_id: 4,
182
+            grouping_name: '12121212_archie_fifi',
183
+            grouping_type: 'match',
184
+        },
185
+        {
186
+            grouping_id: 5,
187
+            grouping_name: '32323232_mochi_usample',
188
+            grouping_type: 'match',
189
+        },
49 190
     ],
50 191
     messages: [
51 192
         { message_id: 1, user_id: 1, grouping_id: 3, message: 'hello' },
52 193
         { message_id: 2, user_id: 2, grouping_id: 3, message: 'hi' },
53 194
         { message_id: 3, user_id: 1, grouping_id: 3, message: 'how are you?' },
54
-        { message_id: 4, user_id: 2, grouping_id: 3, message: 'doing well, and you?' },
195
+        {
196
+            message_id: 4,
197
+            user_id: 2,
198
+            grouping_id: 3,
199
+            message: 'doing well, and you?',
200
+        },
55 201
         { message_id: 5, user_id: 1, grouping_id: 3, message: 'doing great' },
56 202
         { message_id: 6, user_id: 4, grouping_id: 4, message: 'hey' },
57 203
         { message_id: 7, user_id: 5, grouping_id: 4, message: 'just hey?' },
58 204
         { message_id: 8, user_id: 1, grouping_id: 5, message: 'hello!' },
59
-        { message_id: 9, user_id: 3, grouping_id: 5, message: 'meow' }
60
-    ]
61
-}
205
+        { message_id: 9, user_id: 3, grouping_id: 5, message: 'meow' },
206
+    ],
207
+}

+ 37
- 0
docs/contents.md Ver arquivo

@@ -0,0 +1,37 @@
1
+# SIIMEE
2
+
3
+## Definitions
4
+
5
+### User
6
+A `user` represents a user's account information. It contains their unique identifiers and is required for logging in.
7
+
8
+### Profile
9
+A `profile` is how we link questionaire `responses` to a `user`. 
10
+
11
+### Membership
12
+A `membership` represents how a `user` is connected to `groupings`. 
13
+
14
+There should be a `membership` entry referencing every `grouping` a `user` belongs to.
15
+
16
+Each `membership` can be marked as active with the `membership.is_active` key. This allows for a history of `memberships` to be persisted, and allows the joining and leaving of `groupings`. Leaving a `grouping` is a matter of marking the `membership.is_active` as `false`.
17
+
18
+If the `membership.can_edit` key is true, the `member` `user` is allowed to edit the grouping details.
19
+
20
+### Grouping
21
+A `grouping` is a representation of `membership` between two `profiles`.
22
+
23
+Each `grouping` consists of *atleast* two `profiles`.
24
+
25
+Some common groupings include: companies and matches
26
+
27
+### Messages
28
+A `message` is the record of a chat message for each `grouping's` chat.
29
+
30
+### Responses & Response Keys
31
+A `response` represents a questionaire *answer* that is linked to a `profile` and ultimately a `user` for scoring and matching. Each `response` references a `response_key`.
32
+
33
+A `response_key` represents how each `response` is categorized as well as the actual question asked on the questionaire. 
34
+
35
+We group `responses` into broader ctegories to aid scoring.
36
+
37
+The `response.response_key_category` is the category and the `response.response_key_prompt` stores the question itself.

+ 0
- 85
frontend/package-lock.json Ver arquivo

@@ -8,7 +8,6 @@
8 8
       "name": "vite-project",
9 9
       "version": "0.0.0",
10 10
       "dependencies": {
11
-        "ajv": "^8.2.0",
12 11
         "events": "^3.3.0",
13 12
         "joi": "^17.4.0",
14 13
         "process": "^0.11.10",
@@ -210,17 +209,6 @@
210 209
         "node": ">=0.4.0"
211 210
       }
212 211
     },
213
-    "node_modules/ajv": {
214
-      "version": "8.2.0",
215
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.2.0.tgz",
216
-      "integrity": "sha512-WSNGFuyWd//XO8n/m/EaOlNLtO0yL8EXT/74LqT4khdhpZjP7lkj/kT5uwRmGitKEVp/Oj7ZUHeGfPtgHhQ5CA==",
217
-      "dependencies": {
218
-        "fast-deep-equal": "^3.1.1",
219
-        "json-schema-traverse": "^1.0.0",
220
-        "require-from-string": "^2.0.2",
221
-        "uri-js": "^4.2.2"
222
-      }
223
-    },
224 212
     "node_modules/ansi-regex": {
225 213
       "version": "2.1.1",
226 214
       "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
@@ -619,11 +607,6 @@
619 607
         "node": ">=0.8.x"
620 608
       }
621 609
     },
622
-    "node_modules/fast-deep-equal": {
623
-      "version": "3.1.3",
624
-      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
625
-      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
626
-    },
627 610
     "node_modules/flatten": {
628 611
       "version": "1.0.3",
629 612
       "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.3.tgz",
@@ -809,11 +792,6 @@
809 792
       "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=",
810 793
       "dev": true
811 794
     },
812
-    "node_modules/json-schema-traverse": {
813
-      "version": "1.0.0",
814
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
815
-      "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
816
-    },
817 795
     "node_modules/json5": {
818 796
       "version": "1.0.1",
819 797
       "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
@@ -2412,14 +2390,6 @@
2412 2390
       "integrity": "sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ==",
2413 2391
       "dev": true
2414 2392
     },
2415
-    "node_modules/punycode": {
2416
-      "version": "2.1.1",
2417
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
2418
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
2419
-      "engines": {
2420
-        "node": ">=6"
2421
-      }
2422
-    },
2423 2393
     "node_modules/read-cache": {
2424 2394
       "version": "1.0.0",
2425 2395
       "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@@ -2429,14 +2399,6 @@
2429 2399
         "pify": "^2.3.0"
2430 2400
       }
2431 2401
     },
2432
-    "node_modules/require-from-string": {
2433
-      "version": "2.0.2",
2434
-      "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
2435
-      "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
2436
-      "engines": {
2437
-        "node": ">=0.10.0"
2438
-      }
2439
-    },
2440 2402
     "node_modules/resolve": {
2441 2403
       "version": "1.20.0",
2442 2404
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
@@ -2544,14 +2506,6 @@
2544 2506
       "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=",
2545 2507
       "dev": true
2546 2508
     },
2547
-    "node_modules/uri-js": {
2548
-      "version": "4.4.1",
2549
-      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
2550
-      "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
2551
-      "dependencies": {
2552
-        "punycode": "^2.1.0"
2553
-      }
2554
-    },
2555 2509
     "node_modules/util-deprecate": {
2556 2510
       "version": "1.0.2",
2557 2511
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -2782,17 +2736,6 @@
2782 2736
       "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
2783 2737
       "dev": true
2784 2738
     },
2785
-    "ajv": {
2786
-      "version": "8.2.0",
2787
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.2.0.tgz",
2788
-      "integrity": "sha512-WSNGFuyWd//XO8n/m/EaOlNLtO0yL8EXT/74LqT4khdhpZjP7lkj/kT5uwRmGitKEVp/Oj7ZUHeGfPtgHhQ5CA==",
2789
-      "requires": {
2790
-        "fast-deep-equal": "^3.1.1",
2791
-        "json-schema-traverse": "^1.0.0",
2792
-        "require-from-string": "^2.0.2",
2793
-        "uri-js": "^4.2.2"
2794
-      }
2795
-    },
2796 2739
     "ansi-regex": {
2797 2740
       "version": "2.1.1",
2798 2741
       "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
@@ -3108,11 +3051,6 @@
3108 3051
       "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
3109 3052
       "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="
3110 3053
     },
3111
-    "fast-deep-equal": {
3112
-      "version": "3.1.3",
3113
-      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
3114
-      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
3115
-    },
3116 3054
     "flatten": {
3117 3055
       "version": "1.0.3",
3118 3056
       "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.3.tgz",
@@ -3271,11 +3209,6 @@
3271 3209
       "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=",
3272 3210
       "dev": true
3273 3211
     },
3274
-    "json-schema-traverse": {
3275
-      "version": "1.0.0",
3276
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
3277
-      "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
3278
-    },
3279 3212
     "json5": {
3280 3213
       "version": "1.0.1",
3281 3214
       "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
@@ -4654,11 +4587,6 @@
4654 4587
       "integrity": "sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ==",
4655 4588
       "dev": true
4656 4589
     },
4657
-    "punycode": {
4658
-      "version": "2.1.1",
4659
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
4660
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
4661
-    },
4662 4590
     "read-cache": {
4663 4591
       "version": "1.0.0",
4664 4592
       "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@@ -4668,11 +4596,6 @@
4668 4596
         "pify": "^2.3.0"
4669 4597
       }
4670 4598
     },
4671
-    "require-from-string": {
4672
-      "version": "2.0.2",
4673
-      "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
4674
-      "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="
4675
-    },
4676 4599
     "resolve": {
4677 4600
       "version": "1.20.0",
4678 4601
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
@@ -4759,14 +4682,6 @@
4759 4682
       "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=",
4760 4683
       "dev": true
4761 4684
     },
4762
-    "uri-js": {
4763
-      "version": "4.4.1",
4764
-      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
4765
-      "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
4766
-      "requires": {
4767
-        "punycode": "^2.1.0"
4768
-      }
4769
-    },
4770 4685
     "util-deprecate": {
4771 4686
       "version": "1.0.2",
4772 4687
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

Carregando…
Cancelar
Salvar