@laboratoria/sdk-js 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node.js.yml +31 -0
- package/README.md +40 -3
- package/index.js +12 -20
- package/index.spec.js +12 -12
- package/lib/core.js +113 -12
- package/lib/curriculum.js +59 -0
- package/lib/curriculum.spec.js +194 -0
- package/lib/jobs.js +21 -3
- package/lib/model.js +86 -35
- package/lib/model.spec.js +28 -1
- package/package.json +20 -10
- package/schemas/core.json +217 -12
- package/__mocks__/firebase/app.js +0 -1
- package/__mocks__/firebase/auth.js +0 -10
- package/__snapshots__/index.spec.js.snap +0 -12
- package/lib/__mocks__/client.js +0 -1
- package/lib/campuses.js +0 -23
- package/lib/team.js +0 -50
- package/schemas/team.json +0 -126
package/lib/model.js
CHANGED
@@ -1,13 +1,21 @@
|
|
1
1
|
import { createClient } from './client.js';
|
2
2
|
|
3
|
+
|
3
4
|
const createValidator = (schema) => {
|
4
5
|
const properties = schema.properties || {};
|
5
6
|
const inputProps = schema.inputProps || Object.keys(properties);
|
6
7
|
|
7
8
|
const validateAttr = (key, value) => {
|
8
9
|
const attrSchema = properties[key] || {};
|
9
|
-
const type =
|
10
|
-
|
10
|
+
const type = (
|
11
|
+
Array.isArray(attrSchema.type)
|
12
|
+
? attrSchema.type[0]
|
13
|
+
: attrSchema.type
|
14
|
+
);
|
15
|
+
const isRequired = (
|
16
|
+
!Array.isArray(attrSchema.type)
|
17
|
+
|| !attrSchema.type.includes('null')
|
18
|
+
);
|
11
19
|
|
12
20
|
if (attrSchema.enum) {
|
13
21
|
if (!isRequired && !value) {
|
@@ -55,7 +63,7 @@ const createValidator = (schema) => {
|
|
55
63
|
};
|
56
64
|
|
57
65
|
|
58
|
-
const qToQs = q => q ? `?q=${JSON.stringify(q)}` : '';
|
66
|
+
const qToQs = (q = {}) => Object.keys(q).length ? `?q=${JSON.stringify(q)}` : '';
|
59
67
|
|
60
68
|
|
61
69
|
const createBuildURL = collectionName => (id, q) => {
|
@@ -63,34 +71,78 @@ const createBuildURL = collectionName => (id, q) => {
|
|
63
71
|
};
|
64
72
|
|
65
73
|
|
66
|
-
const
|
74
|
+
const serializeData = (data, schema) => {
|
75
|
+
const hasInputProps = Array.isArray(schema.inputProps);
|
76
|
+
const payload = Object.keys(data).reduce(
|
77
|
+
(memo, key) => {
|
78
|
+
if (hasInputProps && !schema.inputProps.includes(key)) {
|
79
|
+
return memo;
|
80
|
+
}
|
81
|
+
const prop = (schema.properties || {})[key];
|
82
|
+
const isOptionalRelation = (
|
83
|
+
prop
|
84
|
+
&& Array.isArray(prop.anyOf)
|
85
|
+
&& prop.anyOf[0].$ref
|
86
|
+
&& prop.anyOf[1]
|
87
|
+
&& prop.anyOf[1].type === 'null'
|
88
|
+
);
|
89
|
+
if (isOptionalRelation && data[key] === null) {
|
90
|
+
return memo;
|
91
|
+
}
|
92
|
+
return {
|
93
|
+
...memo,
|
94
|
+
[key]: data[key],
|
95
|
+
};
|
96
|
+
},
|
97
|
+
{},
|
98
|
+
);
|
99
|
+
|
100
|
+
// {
|
101
|
+
// signupCohort: {
|
102
|
+
// connect: { id: signupCohort.id },
|
103
|
+
// },
|
104
|
+
// }
|
105
|
+
|
106
|
+
return payload;
|
107
|
+
};
|
108
|
+
|
109
|
+
|
110
|
+
export const createModel = (baseUrl, state, collectionName, schema = {}) => {
|
111
|
+
const primaryKey = schema.primaryKey || 'id';
|
67
112
|
const validator = createValidator(schema);
|
68
113
|
const buildURL = createBuildURL(collectionName);
|
69
114
|
const req = (...args) => createClient(baseUrl, state.authUser)(...args);
|
70
115
|
const create = q => req(buildURL(), {
|
71
116
|
method: 'POST',
|
72
|
-
body: q,
|
117
|
+
body: Object.assign(q, { data: serializeData(q.data, schema) }),
|
73
118
|
});
|
74
119
|
|
75
|
-
const put = q => req(buildURL(q.where
|
120
|
+
const put = q => req(buildURL(q.where[primaryKey]), {
|
76
121
|
method: 'PUT',
|
77
|
-
body: q,
|
122
|
+
body: Object.assign(q, { data: serializeData(q.data, schema) }),
|
78
123
|
});
|
79
124
|
|
80
|
-
const parse = data =>
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
125
|
+
const parse = data => {
|
126
|
+
const parsed = Object.keys(data).reduce(
|
127
|
+
(memo, key) => {
|
128
|
+
const { type, format } = schema.properties[key] || {};
|
129
|
+
return {
|
130
|
+
...memo,
|
131
|
+
[key]: (
|
132
|
+
format === 'date-time' && data[key]
|
133
|
+
? new Date(data[key])
|
134
|
+
: data[key]
|
135
|
+
),
|
136
|
+
};
|
137
|
+
},
|
138
|
+
{},
|
139
|
+
);
|
140
|
+
return (
|
141
|
+
typeof schema.parse === 'function'
|
142
|
+
? schema.parse(parsed)
|
143
|
+
: parsed
|
144
|
+
);
|
145
|
+
};
|
94
146
|
|
95
147
|
return {
|
96
148
|
get schema() {
|
@@ -105,7 +157,7 @@ const createModel = (baseUrl, state, collectionName, schema = {}) => {
|
|
105
157
|
create,
|
106
158
|
update: put,
|
107
159
|
upsert: opts => (
|
108
|
-
!opts.where
|
160
|
+
!opts.where[primaryKey]
|
109
161
|
? create({ data: opts.create })
|
110
162
|
: put({ where: opts.where, data: opts.update })
|
111
163
|
),
|
@@ -113,21 +165,20 @@ const createModel = (baseUrl, state, collectionName, schema = {}) => {
|
|
113
165
|
};
|
114
166
|
};
|
115
167
|
|
116
|
-
|
117
|
-
export default createModel;
|
118
|
-
|
119
168
|
export const createModels = (url, state, schema) => {
|
120
|
-
// ...
|
121
169
|
return Object.keys(schema.properties).reduce(
|
122
|
-
(prev, key) =>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
170
|
+
(prev, key) => {
|
171
|
+
const name = schema.properties[key].$ref.split('/').pop();
|
172
|
+
return {
|
173
|
+
...prev,
|
174
|
+
[key]: createModel(
|
175
|
+
url,
|
176
|
+
state,
|
177
|
+
schema.definitions[name].plural || `${key}s`,
|
178
|
+
schema.definitions[name],
|
179
|
+
),
|
180
|
+
};
|
181
|
+
},
|
131
182
|
{},
|
132
183
|
);
|
133
184
|
};
|
package/lib/model.spec.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import createModel from './model.js';
|
1
|
+
import { createModel } from './model.js';
|
2
2
|
import { createClient } from './client.js';
|
3
3
|
|
4
4
|
jest.mock('./client.js');
|
@@ -78,6 +78,33 @@ describe('model.update(options)', () => {
|
|
78
78
|
method: 'PUT',
|
79
79
|
});
|
80
80
|
});
|
81
|
+
|
82
|
+
it('should exclude null values for optional relation props', async () => {
|
83
|
+
const client = createClient().mockResolvedValue({});
|
84
|
+
const schema = {
|
85
|
+
properties: {
|
86
|
+
signupCohort: {
|
87
|
+
anyOf: [
|
88
|
+
{ '$ref': '#/definitions/Cohort' },
|
89
|
+
{ type: 'null' },
|
90
|
+
],
|
91
|
+
},
|
92
|
+
},
|
93
|
+
};
|
94
|
+
const model = createModel('http://1.2.3.4', {}, 'foo', schema);
|
95
|
+
expect(await model.update({
|
96
|
+
where: { id: 1 },
|
97
|
+
data: { signupCohort: null },
|
98
|
+
})).toEqual({});
|
99
|
+
expect(client).toHaveBeenCalledTimes(1);
|
100
|
+
expect(client).toHaveBeenCalledWith('/foo/1', {
|
101
|
+
body: {
|
102
|
+
where: { id: 1 },
|
103
|
+
data: {},
|
104
|
+
},
|
105
|
+
method: 'PUT',
|
106
|
+
});
|
107
|
+
});
|
81
108
|
});
|
82
109
|
|
83
110
|
describe('model.upsert(options)', () => {
|
package/package.json
CHANGED
@@ -1,23 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"name": "@laboratoria/sdk-js",
|
3
|
-
"version": "
|
3
|
+
"version": "1.0.0",
|
4
4
|
"description": "Laboratoria JavaScript (browser) SDK",
|
5
5
|
"scripts": {
|
6
|
-
"test": "jest --verbose --coverage"
|
6
|
+
"test": "jest --verbose --coverage",
|
7
|
+
"changelog": "git log $(git describe --tags --abbrev=0)..HEAD --oneline --format=\"* %h %s (%an)\""
|
7
8
|
},
|
8
9
|
"license": "MIT",
|
9
10
|
"dependencies": {
|
10
|
-
"
|
11
|
+
"blueimp-md5": "^2.19.0",
|
12
|
+
"firebase": "^9.6.4"
|
11
13
|
},
|
12
14
|
"devDependencies": {
|
13
|
-
"@babel/core": "^7.16.
|
14
|
-
"@babel/plugin-transform-modules-commonjs": "^7.16.
|
15
|
-
"babel-jest": "^27.
|
16
|
-
"jest": "^27.
|
17
|
-
"webpack": "^5.
|
18
|
-
"webpack-cli": "^4.9.
|
15
|
+
"@babel/core": "^7.16.12",
|
16
|
+
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
|
17
|
+
"babel-jest": "^27.4.6",
|
18
|
+
"jest": "^27.4.7",
|
19
|
+
"webpack": "^5.67.0",
|
20
|
+
"webpack-cli": "^4.9.2"
|
19
21
|
},
|
20
22
|
"jest": {
|
21
|
-
"testEnvironment": "jsdom"
|
23
|
+
"testEnvironment": "jsdom",
|
24
|
+
"coverageThreshold": {
|
25
|
+
"global": {
|
26
|
+
"statements": 96,
|
27
|
+
"branches": 91,
|
28
|
+
"functions": 98,
|
29
|
+
"lines": 96
|
30
|
+
}
|
31
|
+
}
|
22
32
|
}
|
23
33
|
}
|
package/schemas/core.json
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
3
|
"definitions": {
|
4
|
+
"Country": {
|
5
|
+
"type": "object",
|
6
|
+
"properties": {
|
7
|
+
"code": {
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
"name": {
|
11
|
+
"type": "string"
|
12
|
+
},
|
13
|
+
"contracts": {
|
14
|
+
"type": "array",
|
15
|
+
"items": {
|
16
|
+
"$ref": "#/definitions/Contract"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
},
|
4
21
|
"User": {
|
5
22
|
"type": "object",
|
6
23
|
"properties": {
|
@@ -33,10 +50,15 @@
|
|
33
50
|
"null"
|
34
51
|
]
|
35
52
|
},
|
36
|
-
"
|
53
|
+
"lang": {
|
37
54
|
"type": [
|
38
55
|
"string",
|
39
56
|
"null"
|
57
|
+
],
|
58
|
+
"enum": [
|
59
|
+
"en",
|
60
|
+
"es",
|
61
|
+
"pt"
|
40
62
|
]
|
41
63
|
},
|
42
64
|
"github": {
|
@@ -70,7 +92,8 @@
|
|
70
92
|
]
|
71
93
|
},
|
72
94
|
"disabled": {
|
73
|
-
"type": "boolean"
|
95
|
+
"type": "boolean",
|
96
|
+
"default": false
|
74
97
|
},
|
75
98
|
"students": {
|
76
99
|
"type": "array",
|
@@ -93,6 +116,18 @@
|
|
93
116
|
"type": "null"
|
94
117
|
}
|
95
118
|
]
|
119
|
+
},
|
120
|
+
"contracts": {
|
121
|
+
"type": "array",
|
122
|
+
"items": {
|
123
|
+
"$ref": "#/definitions/Contract"
|
124
|
+
}
|
125
|
+
},
|
126
|
+
"gigs": {
|
127
|
+
"type": "array",
|
128
|
+
"items": {
|
129
|
+
"$ref": "#/definitions/Gig"
|
130
|
+
}
|
96
131
|
}
|
97
132
|
}
|
98
133
|
},
|
@@ -223,6 +258,29 @@
|
|
223
258
|
"type": "string",
|
224
259
|
"format": "date-time"
|
225
260
|
},
|
261
|
+
"vacancies": {
|
262
|
+
"type": [
|
263
|
+
"integer",
|
264
|
+
"null"
|
265
|
+
]
|
266
|
+
},
|
267
|
+
"publicAdmission": {
|
268
|
+
"type": "boolean",
|
269
|
+
"default": false
|
270
|
+
},
|
271
|
+
"placementStart": {
|
272
|
+
"type": [
|
273
|
+
"string",
|
274
|
+
"null"
|
275
|
+
],
|
276
|
+
"format": "date-time"
|
277
|
+
},
|
278
|
+
"placementDuration": {
|
279
|
+
"type": [
|
280
|
+
"integer",
|
281
|
+
"null"
|
282
|
+
]
|
283
|
+
},
|
226
284
|
"program": {
|
227
285
|
"$ref": "#/definitions/Program"
|
228
286
|
},
|
@@ -241,20 +299,26 @@
|
|
241
299
|
"$ref": "#/definitions/Dropout"
|
242
300
|
}
|
243
301
|
},
|
302
|
+
"gigs": {
|
303
|
+
"type": "array",
|
304
|
+
"items": {
|
305
|
+
"$ref": "#/definitions/Gig"
|
306
|
+
}
|
307
|
+
},
|
244
308
|
"links": {
|
245
309
|
"type": "array",
|
246
310
|
"items": {
|
247
311
|
"$ref": "#/definitions/CohortLink"
|
248
312
|
}
|
249
313
|
},
|
250
|
-
"
|
251
|
-
"type": "string"
|
252
|
-
},
|
253
|
-
"signupUser": {
|
314
|
+
"signupUsers": {
|
254
315
|
"type": "array",
|
255
316
|
"items": {
|
256
317
|
"$ref": "#/definitions/User"
|
257
318
|
}
|
319
|
+
},
|
320
|
+
"legacySlug": {
|
321
|
+
"type": "string"
|
258
322
|
}
|
259
323
|
}
|
260
324
|
},
|
@@ -278,7 +342,7 @@
|
|
278
342
|
"null"
|
279
343
|
]
|
280
344
|
},
|
281
|
-
"
|
345
|
+
"legacyStudentCode": {
|
282
346
|
"type": [
|
283
347
|
"string",
|
284
348
|
"null"
|
@@ -341,15 +405,27 @@
|
|
341
405
|
"format": "date-time"
|
342
406
|
},
|
343
407
|
"reason": {
|
344
|
-
"type": "string"
|
408
|
+
"type": "string",
|
409
|
+
"enum": [
|
410
|
+
"dropout",
|
411
|
+
"noShow",
|
412
|
+
"invitedToLeave",
|
413
|
+
"changeCohort"
|
414
|
+
]
|
345
415
|
},
|
346
416
|
"reasonDetail": {
|
347
|
-
"type":
|
417
|
+
"type": [
|
418
|
+
"string",
|
419
|
+
"null"
|
420
|
+
]
|
348
421
|
},
|
349
|
-
"
|
350
|
-
"type":
|
422
|
+
"lastProject": {
|
423
|
+
"type": [
|
424
|
+
"string",
|
425
|
+
"null"
|
426
|
+
]
|
351
427
|
},
|
352
|
-
"
|
428
|
+
"completedProjects": {
|
353
429
|
"type": "integer"
|
354
430
|
},
|
355
431
|
"notes": {
|
@@ -374,10 +450,133 @@
|
|
374
450
|
"$ref": "#/definitions/User"
|
375
451
|
}
|
376
452
|
}
|
453
|
+
},
|
454
|
+
"Contract": {
|
455
|
+
"type": "object",
|
456
|
+
"properties": {
|
457
|
+
"id": {
|
458
|
+
"type": "integer"
|
459
|
+
},
|
460
|
+
"createdAt": {
|
461
|
+
"type": "string",
|
462
|
+
"format": "date-time"
|
463
|
+
},
|
464
|
+
"updatedAt": {
|
465
|
+
"type": "string",
|
466
|
+
"format": "date-time"
|
467
|
+
},
|
468
|
+
"createdBy": {
|
469
|
+
"type": "string"
|
470
|
+
},
|
471
|
+
"start": {
|
472
|
+
"type": "string",
|
473
|
+
"format": "date-time"
|
474
|
+
},
|
475
|
+
"end": {
|
476
|
+
"type": [
|
477
|
+
"string",
|
478
|
+
"null"
|
479
|
+
],
|
480
|
+
"format": "date-time"
|
481
|
+
},
|
482
|
+
"hoursPerWeek": {
|
483
|
+
"type": "integer"
|
484
|
+
},
|
485
|
+
"isEmployment": {
|
486
|
+
"type": "boolean"
|
487
|
+
},
|
488
|
+
"currency": {
|
489
|
+
"type": "string",
|
490
|
+
"enum": [
|
491
|
+
"BRL",
|
492
|
+
"CLP",
|
493
|
+
"COP",
|
494
|
+
"MXN",
|
495
|
+
"PEN",
|
496
|
+
"USD"
|
497
|
+
]
|
498
|
+
},
|
499
|
+
"feeBasis": {
|
500
|
+
"type": "string",
|
501
|
+
"enum": [
|
502
|
+
"HOURLY",
|
503
|
+
"MONTHLY"
|
504
|
+
]
|
505
|
+
},
|
506
|
+
"feeAmount": {
|
507
|
+
"type": "integer"
|
508
|
+
},
|
509
|
+
"user": {
|
510
|
+
"$ref": "#/definitions/User"
|
511
|
+
},
|
512
|
+
"country": {
|
513
|
+
"$ref": "#/definitions/Country"
|
514
|
+
},
|
515
|
+
"gigs": {
|
516
|
+
"type": "array",
|
517
|
+
"items": {
|
518
|
+
"$ref": "#/definitions/Gig"
|
519
|
+
}
|
520
|
+
}
|
521
|
+
}
|
522
|
+
},
|
523
|
+
"Gig": {
|
524
|
+
"type": "object",
|
525
|
+
"properties": {
|
526
|
+
"id": {
|
527
|
+
"type": "integer"
|
528
|
+
},
|
529
|
+
"createdAt": {
|
530
|
+
"type": "string",
|
531
|
+
"format": "date-time"
|
532
|
+
},
|
533
|
+
"updatedAt": {
|
534
|
+
"type": "string",
|
535
|
+
"format": "date-time"
|
536
|
+
},
|
537
|
+
"createdBy": {
|
538
|
+
"type": "string"
|
539
|
+
},
|
540
|
+
"start": {
|
541
|
+
"type": "string",
|
542
|
+
"format": "date-time"
|
543
|
+
},
|
544
|
+
"end": {
|
545
|
+
"type": [
|
546
|
+
"string",
|
547
|
+
"null"
|
548
|
+
],
|
549
|
+
"format": "date-time"
|
550
|
+
},
|
551
|
+
"hoursPerWeek": {
|
552
|
+
"type": "integer"
|
553
|
+
},
|
554
|
+
"role": {
|
555
|
+
"type": "string",
|
556
|
+
"enum": [
|
557
|
+
"bm",
|
558
|
+
"pdc",
|
559
|
+
"js",
|
560
|
+
"ux"
|
561
|
+
]
|
562
|
+
},
|
563
|
+
"user": {
|
564
|
+
"$ref": "#/definitions/User"
|
565
|
+
},
|
566
|
+
"contract": {
|
567
|
+
"$ref": "#/definitions/Contract"
|
568
|
+
},
|
569
|
+
"cohort": {
|
570
|
+
"$ref": "#/definitions/Cohort"
|
571
|
+
}
|
572
|
+
}
|
377
573
|
}
|
378
574
|
},
|
379
575
|
"type": "object",
|
380
576
|
"properties": {
|
577
|
+
"country": {
|
578
|
+
"$ref": "#/definitions/Country"
|
579
|
+
},
|
381
580
|
"user": {
|
382
581
|
"$ref": "#/definitions/User"
|
383
582
|
},
|
@@ -401,6 +600,12 @@
|
|
401
600
|
},
|
402
601
|
"dropout": {
|
403
602
|
"$ref": "#/definitions/Dropout"
|
603
|
+
},
|
604
|
+
"contract": {
|
605
|
+
"$ref": "#/definitions/Contract"
|
606
|
+
},
|
607
|
+
"gig": {
|
608
|
+
"$ref": "#/definitions/Gig"
|
404
609
|
}
|
405
610
|
}
|
406
611
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export const initializeApp = jest.fn().mockReturnValue({});
|
@@ -1,10 +0,0 @@
|
|
1
|
-
export const getAuth = jest.fn().mockReturnValue({});
|
2
|
-
|
3
|
-
export const onAuthStateChanged = jest.fn().mockImplementation((firebaseApp, cb) => {
|
4
|
-
setTimeout(() => cb(null), 0);
|
5
|
-
return () => { };
|
6
|
-
});
|
7
|
-
|
8
|
-
export const signInWithEmailAndPassword = jest.fn().mockResolvedValue({});
|
9
|
-
|
10
|
-
export const signOut = jest.fn().mockResolvedValue(undefined);
|
@@ -1,12 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`createApp should invoke firebase's initializaApp 1`] = `
|
4
|
-
Array [
|
5
|
-
Object {
|
6
|
-
"apiKey": "AIzaSyAXbaEbpq8NOfn0r8mIrcoHvoGRkJThwdc",
|
7
|
-
"authDomain": "laboratoria-la.firebaseapp.com",
|
8
|
-
"databaseURL": "https://laboratoria-la.firebaseio.com",
|
9
|
-
"projectId": "laboratoria-la",
|
10
|
-
},
|
11
|
-
]
|
12
|
-
`;
|
package/lib/__mocks__/client.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export const createClient = jest.fn().mockReturnValue(jest.fn().mockResolvedValue({}));
|
package/lib/campuses.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
const campuses = [
|
2
|
-
'AQP',
|
3
|
-
'BOG',
|
4
|
-
'GDL',
|
5
|
-
'LIM',
|
6
|
-
'MEX',
|
7
|
-
'REG',
|
8
|
-
'SAP',
|
9
|
-
'SCL',
|
10
|
-
];
|
11
|
-
|
12
|
-
campuses.emojis = {
|
13
|
-
AQP: 'AQP',
|
14
|
-
BOG: '🇨🇴',
|
15
|
-
GDL: 'GDL',
|
16
|
-
LIM: '🇵🇪',
|
17
|
-
MEX: '🇲🇽',
|
18
|
-
REG: '🌎',
|
19
|
-
SAP: '🇧🇷',
|
20
|
-
SCL: '🇨🇱',
|
21
|
-
};
|
22
|
-
|
23
|
-
export default campuses;
|
package/lib/team.js
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
import { createModels, extendSchemaDefinitions } from './model';
|
2
|
-
import campuses from './campuses';
|
3
|
-
import currencies from './currencies';
|
4
|
-
import roles from './roles';
|
5
|
-
import schema from '../schemas/team.json';
|
6
|
-
|
7
|
-
const extended = {
|
8
|
-
Contract: {
|
9
|
-
inputProps: [
|
10
|
-
'uid',
|
11
|
-
'campus',
|
12
|
-
'currency',
|
13
|
-
'isEmployment',
|
14
|
-
'feeBasis',
|
15
|
-
'feeAmount',
|
16
|
-
'hoursPerWeek',
|
17
|
-
'start',
|
18
|
-
'end',
|
19
|
-
],
|
20
|
-
properties: {
|
21
|
-
campus: {
|
22
|
-
enum: campuses,
|
23
|
-
},
|
24
|
-
currency: {
|
25
|
-
enum: currencies,
|
26
|
-
},
|
27
|
-
},
|
28
|
-
},
|
29
|
-
Gig: {
|
30
|
-
inputProps: [
|
31
|
-
// 'contract',
|
32
|
-
'cohortId',
|
33
|
-
'uid',
|
34
|
-
'role',
|
35
|
-
'hoursPerWeek',
|
36
|
-
'start',
|
37
|
-
'end',
|
38
|
-
],
|
39
|
-
properties: {
|
40
|
-
role: {
|
41
|
-
enum: roles,
|
42
|
-
},
|
43
|
-
},
|
44
|
-
},
|
45
|
-
};
|
46
|
-
|
47
|
-
export const createAPI = (url, state) => createModels(url, state, {
|
48
|
-
...schema,
|
49
|
-
definitions: extendSchemaDefinitions(schema, extended),
|
50
|
-
});
|