placementt-core 1.20.196 → 11.0.533
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/.eslintrc.js +40 -40
- package/.gitattributes +2 -2
- package/lib/config.d.ts +0 -1
- package/lib/constants.d.ts +5 -2
- package/lib/constants.js +130 -136
- package/lib/constants.js.map +1 -1
- package/lib/features/analytics/useAnalytics.d.ts +0 -1
- package/lib/features/analytics/useAnalytics.js +3 -4
- package/lib/features/analytics/useAnalytics.js.map +1 -1
- package/lib/features/config.d.ts +133 -133
- package/lib/features/config.js +35 -35
- package/lib/features/contacts/contacts.d.ts +75 -75
- package/lib/features/contacts/contacts.js +105 -105
- package/lib/features/contacts/contactsSlice.d.ts +5 -5
- package/lib/features/contacts/useContacts.js +1 -2
- package/lib/features/contacts/useContacts.js.map +1 -1
- package/lib/features/downtime/useDowntime.d.ts +11 -11
- package/lib/features/downtime/useDowntime.js +22 -22
- package/lib/features/dropdown/useDropdown.d.ts +2 -3
- package/lib/features/dropdown/useDropdown.js +1 -2
- package/lib/features/dropdown/useDropdown.js.map +1 -1
- package/lib/features/global/downtime/useDowntime.d.ts +0 -1
- package/lib/features/global/downtime/useDowntime.js +3 -2
- package/lib/features/global/downtime/useDowntime.js.map +1 -1
- package/lib/features/global/users/useUserFunctions.d.ts +0 -1
- package/lib/features/global/users/useUserFunctions.js +6 -7
- package/lib/features/global/users/useUserFunctions.js.map +1 -1
- package/lib/features/placements/studentPlacements/activePlacement.d.ts +1 -1
- package/lib/features/placements/studentPlacements/activePlacement.js +1 -1
- package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
- package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.d.ts +4 -5
- package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.js +1 -4
- package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.js.map +1 -1
- package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +63 -63
- package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +81 -81
- package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.d.ts +4 -4
- package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.js +1 -1
- package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.js.map +1 -1
- package/lib/features/placements/studentPlacements/useStudentPlacements.d.ts +0 -1
- package/lib/features/placements/studentPlacements/useStudentPlacements.js +1 -2
- package/lib/features/placements/studentPlacements/useStudentPlacements.js.map +1 -1
- package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +19 -19
- package/lib/features/providerPlacements/providerPlacementsSlice.js +24 -24
- package/lib/features/referrals/useReferrals.d.ts +0 -1
- package/lib/features/referrals/useReferrals.js +1 -2
- package/lib/features/referrals/useReferrals.js.map +1 -1
- package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +62 -62
- package/lib/features/studentPlacements/studentPlacementsSlice.js +87 -87
- package/lib/features/studentPlacements/useStudentPlacements.d.ts +6 -6
- package/lib/features/studentPlacements/useStudentPlacements.js +18 -18
- package/lib/features/updates/useUpdates.js +1 -2
- package/lib/features/updates/useUpdates.js.map +1 -1
- package/lib/features/userSlice.d.ts +26 -26
- package/lib/features/userSlice.js +23 -23
- package/lib/features/users/useUserFunctions.d.ts +25 -25
- package/lib/features/users/useUserFunctions.js +124 -124
- package/lib/features/users/userSlice.d.ts +46 -46
- package/lib/features/users/userSlice.js +48 -48
- package/lib/firebase/firebase.d.ts +1 -1
- package/lib/firebase/firebase.js +9 -4
- package/lib/firebase/firebase.js.map +1 -1
- package/lib/firebase/firebaseConfig.js +3 -0
- package/lib/firebase/firebaseConfig.js.map +1 -1
- package/lib/firebase/firebaseQuery.js +3 -0
- package/lib/firebase/firebaseQuery.js.map +1 -1
- package/lib/firebase/persistence.js +2 -2
- package/lib/firebase/persistence.js.map +1 -1
- package/lib/firebase/readDatabase.d.ts +9 -6
- package/lib/firebase/readDatabase.js +16 -6
- package/lib/firebase/readDatabase.js.map +1 -1
- package/lib/firebase/util.d.ts +3 -4
- package/lib/firebase/util.js +49 -4
- package/lib/firebase/util.js.map +1 -1
- package/lib/firebase/writeDatabase.d.ts +3 -3
- package/lib/firebase/writeDatabase.js +7 -1
- package/lib/firebase/writeDatabase.js.map +1 -1
- package/lib/hooks.d.ts +384 -23
- package/lib/hooks.js +1342 -223
- package/lib/hooks.js.map +1 -1
- package/lib/images/GatsbyBenchmarks.d.ts +0 -1
- package/lib/images/GatsbyBenchmarks.js +1 -1
- package/lib/images/GatsbyBenchmarks.js.map +1 -1
- package/lib/reduxHooks.d.ts +11 -20
- package/lib/reduxHooks.js +28 -18
- package/lib/reduxHooks.js.map +1 -1
- package/lib/tasksAndTips.d.ts +25 -5
- package/lib/tasksAndTips.js +346 -48
- package/lib/tasksAndTips.js.map +1 -1
- package/lib/typeDefinitions.d.ts +478 -53
- package/lib/util.d.ts +1 -0
- package/lib/util.js +78 -6
- package/lib/util.js.map +1 -1
- package/package.json +52 -49
- package/src/DatabaseDefinitions.ts +18 -18
- package/src/apiCalls.ts +128 -128
- package/src/config.ts +50 -50
- package/src/constants.ts +708 -707
- package/src/databaseTypes.ts +42 -42
- package/src/features/analytics/useAnalytics.tsx +55 -55
- package/src/features/contacts/contactsSlice.ts +147 -147
- package/src/features/contacts/useContacts.tsx +73 -73
- package/src/features/dropdown/useDropdown.tsx +52 -52
- package/src/features/global/downtime/useDowntime.tsx +19 -18
- package/src/features/global/users/useUserFunctions.tsx +132 -132
- package/src/features/jobs/jobsSlice.ts +65 -65
- package/src/features/placements/studentPlacements/activePlacement.ts +63 -63
- package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +94 -97
- package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +108 -108
- package/src/features/placements/studentPlacements/useStudentPlacements.tsx +33 -33
- package/src/features/placements/types.ts +10 -10
- package/src/features/referrals/useReferrals.tsx +56 -56
- package/src/features/updates/useUpdates.tsx +36 -36
- package/src/firebase/firebase.tsx +142 -138
- package/src/firebase/firebaseConfig.tsx +45 -42
- package/src/firebase/firebaseQuery.tsx +143 -140
- package/src/firebase/persistence.ts +84 -84
- package/src/firebase/readDatabase.tsx +208 -197
- package/src/firebase/util.tsx +352 -308
- package/src/firebase/writeDatabase.tsx +75 -68
- package/src/hooks.tsx +3395 -1943
- package/src/images/GatsbyBenchmarks.tsx +711 -711
- package/src/images/LogFuturePlacement.jsx +64 -64
- package/src/images/LogPreviousPlacement.jsx +228 -228
- package/src/images/gatsby_benchmarks.svg +466 -466
- package/src/images/log_future_placement.svg +114 -114
- package/src/images/log_previous_placement.svg +199 -199
- package/src/index.ts +34 -34
- package/src/readDatabase.tsx +3 -3
- package/src/reduxHooks.ts +183 -170
- package/src/tasksAndTips.ts +744 -410
- package/src/tutorialTips.ts +58 -58
- package/src/typeDefinitions.ts +899 -503
- package/src/util.ts +132 -47
- package/tsconfig.dev.json +5 -5
- package/tsconfig.json +21 -21
package/lib/util.d.ts
CHANGED
package/lib/util.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPlacementFlagCodes = void 0;
|
|
4
|
+
exports.objectsEqualNew = objectsEqualNew;
|
|
4
5
|
const getPlacementFlagCodes = ({ placement, studentData, workflow, institute, user }) => {
|
|
5
|
-
var _a, _b, _c, _d;
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6
7
|
let flags = placement.flags || [];
|
|
7
8
|
if (!studentData.details.parentEmail && !flags.find((x) => x.includes("noParentEmail"))) {
|
|
8
9
|
if (((_a = workflow.find((obj) => obj.id === placement.status)) === null || _a === void 0 ? void 0 : _a.userType) === "Parent") {
|
|
@@ -17,8 +18,12 @@ const getPlacementFlagCodes = ({ placement, studentData, workflow, institute, us
|
|
|
17
18
|
const placementNotEnded = !placement.leadTimes.some((x) => x.split("_")[0] === "8");
|
|
18
19
|
const providerUnverified = placement.providerId && !((_b = institute === null || institute === void 0 ? void 0 : institute.verifiedProviders) === null || _b === void 0 ? void 0 : _b.includes(placement.providerId));
|
|
19
20
|
const awaitingProviderInsurance = placement.providerId && ((_c = institute === null || institute === void 0 ? void 0 : institute.awaitingProviderInsurance) === null || _c === void 0 ? void 0 : _c.includes(placement.providerId));
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const riskAssessmentNotVerified = !((_d = institute === null || institute === void 0 ? void 0 : institute.verifiedRiskAssessments) === null || _d === void 0 ? void 0 : _d.includes(placement.placementId || placement.id));
|
|
22
|
+
const awaitingRiskAssessment = !placement.riskAssessment || ((_e = institute === null || institute === void 0 ? void 0 : institute.awaitingPlacementRiskAssessments) === null || _e === void 0 ? void 0 : _e.includes(placement.placementId || placement.id));
|
|
23
|
+
const dbsCheckNotVerified = !((_f = institute === null || institute === void 0 ? void 0 : institute.verifiedDbsChecks) === null || _f === void 0 ? void 0 : _f.includes(placement.placementId || placement.id));
|
|
24
|
+
const awaitingDbsCheck = !placement.dbsCheck || ((_g = institute === null || institute === void 0 ? void 0 : institute.awaitingPlacementDbsChecks) === null || _g === void 0 ? void 0 : _g.includes(placement.placementId || placement.id));
|
|
25
|
+
if (user.userType === "Staff" && placement.insurance && placementIsPostProviderReview && placementNotEnded && providerUnverified && !awaitingProviderInsurance) {
|
|
26
|
+
console.log("Add insurance flag!");
|
|
22
27
|
flags.includes("noInsurance") || flags.push("noInsurance");
|
|
23
28
|
}
|
|
24
29
|
else {
|
|
@@ -30,13 +35,80 @@ const getPlacementFlagCodes = ({ placement, studentData, workflow, institute, us
|
|
|
30
35
|
else {
|
|
31
36
|
flags = flags.filter((x) => x !== "awaitingInsurance");
|
|
32
37
|
}
|
|
33
|
-
if (user.
|
|
34
|
-
flags.includes("
|
|
38
|
+
if (user.userType === "Staff" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
|
|
39
|
+
flags.includes("noDbsCheck") || flags.push("noDbsCheck");
|
|
35
40
|
}
|
|
36
41
|
else {
|
|
37
|
-
flags = flags.filter((x) => x !== "
|
|
42
|
+
flags = flags.filter((x) => x !== "noDbsCheck");
|
|
43
|
+
}
|
|
44
|
+
if (user.userType === "Staff" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
|
|
45
|
+
flags.includes("awaitingDbsCheck") || flags.push("awaitingDbsCheck");
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
flags = flags.filter((x) => x !== "awaitingDbsCheck");
|
|
49
|
+
}
|
|
50
|
+
if (user.userType === "Staff" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
|
|
51
|
+
console.log("Add RA flag!");
|
|
52
|
+
flags.includes("noRiskAssessment") || flags.push("noRiskAssessment");
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
flags = flags.filter((x) => x !== "noRiskAssessment");
|
|
56
|
+
}
|
|
57
|
+
if (user.userType === "Staff" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
|
|
58
|
+
flags.includes("awaitingRiskAssessment") || flags.push("awaitingRiskAssessment");
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
flags = flags.filter((x) => x !== "awaitingRiskAssessment");
|
|
62
|
+
}
|
|
63
|
+
if (user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding && (((_h = placement.onboarding.completed) === null || _h === void 0 ? void 0 : _h.submitted) && !placement.onboarding.completed.accepted) && (placement.inProgress || placement.active)) {
|
|
64
|
+
flags.includes("reviewOnboarding") || flags.push("reviewOnboarding");
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
flags = flags.filter((x) => x !== "reviewOnboarding");
|
|
68
|
+
}
|
|
69
|
+
if (user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !((_j = placement.onboarding.completed) === null || _j === void 0 ? void 0 : _j.submitted))) && (placement.inProgress || placement.active)) {
|
|
70
|
+
flags.includes("completeOnboarding") || flags.push("completeOnboarding");
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
flags = flags.filter((x) => x !== "completeOnboarding");
|
|
38
74
|
}
|
|
39
75
|
return flags;
|
|
40
76
|
};
|
|
41
77
|
exports.getPlacementFlagCodes = getPlacementFlagCodes;
|
|
78
|
+
function objectsEqualNew(a, b) {
|
|
79
|
+
if (a === b) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (typeof a !== typeof b) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
86
|
+
if (a.length !== b.length) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
for (let i = 0; i < a.length; i++) {
|
|
90
|
+
if (!objectsEqualNew(a[i], b[i])) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
if (typeof a === "object" && typeof b === "object" && a !== null && b !== null) {
|
|
97
|
+
const keysA = Object.keys(a);
|
|
98
|
+
const keysB = Object.keys(b);
|
|
99
|
+
if (keysA.length !== keysB.length) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
for (const key of keysA) {
|
|
103
|
+
if (!keysB.includes(key)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (!objectsEqualNew(a[key], b[key])) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
42
114
|
//# sourceMappingURL=util.js.map
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
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GAAG,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBACnC,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": false,
|
|
3
|
-
"name": "placementt-core",
|
|
4
|
-
"author": "Placementt",
|
|
5
|
-
"version": "
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"lint": "eslint --ext .js,.ts .",
|
|
10
|
-
"prebuild": "rimraf build",
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"prestart": "rimraf build",
|
|
13
|
-
"start": "tsc -w",
|
|
14
|
-
"pack": "yarn pack",
|
|
15
|
-
"deploy": "tsc && yarn publish"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@react-native-async-storage/async-storage": "
|
|
19
|
-
"@reduxjs/toolkit": "^1.9.7",
|
|
20
|
-
"@types/jest": "29.5.0",
|
|
21
|
-
"@types/ngeohash": "0.6.4",
|
|
22
|
-
"@types/react": "18.0.29",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
},
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
}
|
|
49
|
-
|
|
1
|
+
{
|
|
2
|
+
"private": false,
|
|
3
|
+
"name": "placementt-core",
|
|
4
|
+
"author": "Placementt",
|
|
5
|
+
"version": "11.0.533",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"lint": "eslint --ext .js,.ts .",
|
|
10
|
+
"prebuild": "rimraf build",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"prestart": "rimraf build",
|
|
13
|
+
"start": "tsc -w",
|
|
14
|
+
"pack": "yarn pack",
|
|
15
|
+
"deploy": "tsc && yarn publish"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@react-native-async-storage/async-storage": "1.19.3",
|
|
19
|
+
"@reduxjs/toolkit": "^1.9.7",
|
|
20
|
+
"@types/jest": "29.5.0",
|
|
21
|
+
"@types/ngeohash": "0.6.4",
|
|
22
|
+
"@types/react": "18.0.29",
|
|
23
|
+
"algoliasearch": "^4.23.3",
|
|
24
|
+
"firebase": "9.16.0",
|
|
25
|
+
"html2canvas": "^1.4.1",
|
|
26
|
+
"jest": "29.5.0",
|
|
27
|
+
"jspdf": "^2.5.1",
|
|
28
|
+
"ngeohash": "^0.6.3",
|
|
29
|
+
"path": "^0.12.7",
|
|
30
|
+
"placementt-core": "1.0.525",
|
|
31
|
+
"placementt-prisma": "1.0.2",
|
|
32
|
+
"react": "18.2.0",
|
|
33
|
+
"react-dom": "18.2.0",
|
|
34
|
+
"react-redux": "^8.1.3",
|
|
35
|
+
"redux-persist": "^6.0.0",
|
|
36
|
+
"slate": "^0.84.0",
|
|
37
|
+
"slate-history": "^0.66.0",
|
|
38
|
+
"slate-react": "^0.83.2",
|
|
39
|
+
"ts-jest": "29.1.0",
|
|
40
|
+
"typescript": "^5.3.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"npm-run-all": "^4.1.5",
|
|
44
|
+
"rimraf": "^3.0.2"
|
|
45
|
+
},
|
|
46
|
+
"resolutions": {
|
|
47
|
+
"@types/react": "18.0.29"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": "18"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {Addresses, Cohorts,
|
|
2
|
-
Contacts, InstituteStudents, Institutes, Logs, PlacementListings, Placements, Providers,
|
|
3
|
-
StudentUsers,
|
|
4
|
-
InstituteStaff as InstituteStaffObj,
|
|
5
|
-
ProviderStaff as ProviderStaffObj,} from "placementt-prisma"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type PrismaAddress = Addresses
|
|
9
|
-
export type PrismaCohort = Cohorts
|
|
10
|
-
export type PrismaContact = Contacts
|
|
11
|
-
export type PrismaInstitute = Institutes
|
|
12
|
-
export type PrismaLog = Logs
|
|
13
|
-
export type PrismaPlacementListing = PlacementListings
|
|
14
|
-
export type PrismaPlacement = Placements
|
|
15
|
-
export type PrismaProvider = Providers
|
|
16
|
-
export type PrismaStudentUser = StudentUsers
|
|
17
|
-
export type PrismaInstituteStaff = InstituteStaffObj
|
|
18
|
-
export type PrismaInstituteStudent = InstituteStudents
|
|
1
|
+
import {Addresses, Cohorts,
|
|
2
|
+
Contacts, InstituteStudents, Institutes, Logs, PlacementListings, Placements, Providers,
|
|
3
|
+
StudentUsers,
|
|
4
|
+
InstituteStaff as InstituteStaffObj,
|
|
5
|
+
ProviderStaff as ProviderStaffObj,} from "placementt-prisma"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export type PrismaAddress = Addresses
|
|
9
|
+
export type PrismaCohort = Cohorts
|
|
10
|
+
export type PrismaContact = Contacts
|
|
11
|
+
export type PrismaInstitute = Institutes
|
|
12
|
+
export type PrismaLog = Logs
|
|
13
|
+
export type PrismaPlacementListing = PlacementListings
|
|
14
|
+
export type PrismaPlacement = Placements
|
|
15
|
+
export type PrismaProvider = Providers
|
|
16
|
+
export type PrismaStudentUser = StudentUsers
|
|
17
|
+
export type PrismaInstituteStaff = InstituteStaffObj
|
|
18
|
+
export type PrismaInstituteStudent = InstituteStudents
|
|
19
19
|
export type PrismaProviderStaff = ProviderStaffObj
|
package/src/apiCalls.ts
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import {Auth} from "firebase/auth";
|
|
2
|
-
import {Contact} from "./typeDefinitions";
|
|
3
|
-
|
|
4
|
-
export const initializeToken = async (auth: Auth) => {
|
|
5
|
-
try {
|
|
6
|
-
const user = auth.currentUser;
|
|
7
|
-
if (user) {
|
|
8
|
-
const token = await user.getIdToken();
|
|
9
|
-
console.log("this is the token###",token);
|
|
10
|
-
return token;
|
|
11
|
-
} else {
|
|
12
|
-
console.error("User is not signed in.");
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.error("Error initializing token:", error);
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export class API {
|
|
22
|
-
private rootURL: string;
|
|
23
|
-
private auth: Auth;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
constructor(auth: Auth, type?:string) {
|
|
27
|
-
if (type === "local") {
|
|
28
|
-
this.rootURL = "localhost:3006";
|
|
29
|
-
} else {
|
|
30
|
-
this.rootURL = "placemmentt.co.uk";
|
|
31
|
-
}
|
|
32
|
-
this.auth = auth;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
async getContact(id: string): Promise<Contact | undefined> {
|
|
37
|
-
const token = await initializeToken(this.auth);
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
const response = await fetch(`${this.rootURL}/api/contacts/getContacts/${id}`, {
|
|
41
|
-
method: "GET",
|
|
42
|
-
headers: {
|
|
43
|
-
"Authorization": `Bearer ${token}`,
|
|
44
|
-
"Content-Type": "application/json",
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
return (await response.json()) as Contact;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.log(error);
|
|
50
|
-
}
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async addContact(details:Contact) {
|
|
55
|
-
const token = await initializeToken(this.auth);
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const response = await fetch(`${this.rootURL}/api/contacts/addContact`, {
|
|
59
|
-
method: "POST",
|
|
60
|
-
headers: {
|
|
61
|
-
"Authorization": `Bearer ${token}`,
|
|
62
|
-
"Content-Type": "application/json",
|
|
63
|
-
},
|
|
64
|
-
body: JSON.stringify(details ),
|
|
65
|
-
});
|
|
66
|
-
return (await response.json());
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.log(error);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async update_contact(id:string, details:Contact, Constraint:string) {
|
|
73
|
-
const token = await initializeToken(this.auth);
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const response = await fetch(`${this.rootURL}/api/contacts/update/${id}`, {
|
|
77
|
-
method: "PUT",
|
|
78
|
-
headers: {
|
|
79
|
-
"Authorization": `Bearer ${token}`,
|
|
80
|
-
"Content-Type": "application/json",
|
|
81
|
-
},
|
|
82
|
-
body: JSON.stringify({
|
|
83
|
-
details: details,
|
|
84
|
-
constraint: Constraint,
|
|
85
|
-
} ),
|
|
86
|
-
});
|
|
87
|
-
return (await response.json());
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.log(error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async delete_contact(contactid:string) {
|
|
94
|
-
const token = await initializeToken(this.auth);
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
const response = await fetch(`${this.rootURL}/api/contacts/delete}`, {
|
|
98
|
-
headers: {
|
|
99
|
-
"Authorization": `Bearer ${token}`,
|
|
100
|
-
"Content-Type": "application/json",
|
|
101
|
-
},
|
|
102
|
-
body: JSON.stringify({
|
|
103
|
-
contactid: contactid,
|
|
104
|
-
} ),
|
|
105
|
-
});
|
|
106
|
-
return (await response.json());
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.log(error);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
async get_placements(id:string) {
|
|
112
|
-
const token = await initializeToken(this.auth);
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
const response = await fetch(`${this.rootURL}/api/contacts/getPlacements/${id}`, {
|
|
116
|
-
method: "GET",
|
|
117
|
-
headers: {
|
|
118
|
-
"Authorization": `Bearer ${token}`,
|
|
119
|
-
"Content-Type": "application/json",
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
return (await response.json()) as Contact;
|
|
123
|
-
} catch (error) {
|
|
124
|
-
console.log(error);
|
|
125
|
-
}
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
1
|
+
import {Auth} from "firebase/auth";
|
|
2
|
+
import {Contact} from "./typeDefinitions";
|
|
3
|
+
|
|
4
|
+
export const initializeToken = async (auth: Auth) => {
|
|
5
|
+
try {
|
|
6
|
+
const user = auth.currentUser;
|
|
7
|
+
if (user) {
|
|
8
|
+
const token = await user.getIdToken();
|
|
9
|
+
console.log("this is the token###",token);
|
|
10
|
+
return token;
|
|
11
|
+
} else {
|
|
12
|
+
console.error("User is not signed in.");
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error("Error initializing token:", error);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export class API {
|
|
22
|
+
private rootURL: string;
|
|
23
|
+
private auth: Auth;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
constructor(auth: Auth, type?:string) {
|
|
27
|
+
if (type === "local") {
|
|
28
|
+
this.rootURL = "localhost:3006";
|
|
29
|
+
} else {
|
|
30
|
+
this.rootURL = "placemmentt.co.uk";
|
|
31
|
+
}
|
|
32
|
+
this.auth = auth;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async getContact(id: string): Promise<Contact | undefined> {
|
|
37
|
+
const token = await initializeToken(this.auth);
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const response = await fetch(`${this.rootURL}/api/contacts/getContacts/${id}`, {
|
|
41
|
+
method: "GET",
|
|
42
|
+
headers: {
|
|
43
|
+
"Authorization": `Bearer ${token}`,
|
|
44
|
+
"Content-Type": "application/json",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return (await response.json()) as Contact;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.log(error);
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async addContact(details:Contact) {
|
|
55
|
+
const token = await initializeToken(this.auth);
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(`${this.rootURL}/api/contacts/addContact`, {
|
|
59
|
+
method: "POST",
|
|
60
|
+
headers: {
|
|
61
|
+
"Authorization": `Bearer ${token}`,
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
},
|
|
64
|
+
body: JSON.stringify(details ),
|
|
65
|
+
});
|
|
66
|
+
return (await response.json());
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.log(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async update_contact(id:string, details:Contact, Constraint:string) {
|
|
73
|
+
const token = await initializeToken(this.auth);
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(`${this.rootURL}/api/contacts/update/${id}`, {
|
|
77
|
+
method: "PUT",
|
|
78
|
+
headers: {
|
|
79
|
+
"Authorization": `Bearer ${token}`,
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
},
|
|
82
|
+
body: JSON.stringify({
|
|
83
|
+
details: details,
|
|
84
|
+
constraint: Constraint,
|
|
85
|
+
} ),
|
|
86
|
+
});
|
|
87
|
+
return (await response.json());
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.log(error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async delete_contact(contactid:string) {
|
|
94
|
+
const token = await initializeToken(this.auth);
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const response = await fetch(`${this.rootURL}/api/contacts/delete}`, {
|
|
98
|
+
headers: {
|
|
99
|
+
"Authorization": `Bearer ${token}`,
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
},
|
|
102
|
+
body: JSON.stringify({
|
|
103
|
+
contactid: contactid,
|
|
104
|
+
} ),
|
|
105
|
+
});
|
|
106
|
+
return (await response.json());
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.log(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async get_placements(id:string) {
|
|
112
|
+
const token = await initializeToken(this.auth);
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
const response = await fetch(`${this.rootURL}/api/contacts/getPlacements/${id}`, {
|
|
116
|
+
method: "GET",
|
|
117
|
+
headers: {
|
|
118
|
+
"Authorization": `Bearer ${token}`,
|
|
119
|
+
"Content-Type": "application/json",
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
return (await response.json()) as Contact;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.log(error);
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import {configureStore} from '@reduxjs/toolkit'
|
|
2
|
-
import {combineReducers} from "redux"
|
|
3
|
-
import {persistReducer} from "redux-persist"
|
|
4
|
-
import jobsReducer from "./features/jobs/jobsSlice"
|
|
5
|
-
import upcomingStudentPlacementsReducer from "./features/placements/studentPlacements/upcomingStudentPlacementsSlice"
|
|
6
|
-
import completedStudentPlacementsReducer from "./features/placements/studentPlacements/completedStudentPlacementsSlice"
|
|
7
|
-
import contactsReducer from "./features/contacts/contactsSlice"
|
|
8
|
-
import activePlacementReducer from "./features/placements/studentPlacements/activePlacement"
|
|
9
|
-
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const persistConfig = {
|
|
13
|
-
key: "root",
|
|
14
|
-
version: 1,
|
|
15
|
-
storage: AsyncStorage,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const reducers = combineReducers({
|
|
19
|
-
upcomingStudentPlacements: upcomingStudentPlacementsReducer,
|
|
20
|
-
completedStudentPlacements: completedStudentPlacementsReducer,
|
|
21
|
-
contacts: contactsReducer,
|
|
22
|
-
activePlacement: activePlacementReducer,
|
|
23
|
-
jobs: jobsReducer
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const persistedReducers = persistReducer(persistConfig, reducers);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const store = configureStore({
|
|
31
|
-
reducer: persistedReducers,
|
|
32
|
-
devTools: process.env.NODE_ENV !== 'production',
|
|
33
|
-
middleware: (getDefaultMiddleware) =>
|
|
34
|
-
getDefaultMiddleware({
|
|
35
|
-
immutableCheck: false,
|
|
36
|
-
serializableCheck: false
|
|
37
|
-
}),
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export type RootStateType = ReturnType<typeof store.getState>
|
|
42
|
-
export type RootState = {
|
|
43
|
-
upcomingStudentPlacements: RootStateType["upcomingStudentPlacements"]
|
|
44
|
-
completedStudentPlacements: RootStateType["completedStudentPlacements"],
|
|
45
|
-
activePlacement: RootStateType["activePlacement"],
|
|
46
|
-
contacts: RootStateType["contacts"],
|
|
47
|
-
jobs: RootStateType["jobs"]
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import {configureStore} from '@reduxjs/toolkit'
|
|
2
|
+
import {combineReducers} from "redux"
|
|
3
|
+
import {persistReducer} from "redux-persist"
|
|
4
|
+
import jobsReducer from "./features/jobs/jobsSlice"
|
|
5
|
+
import upcomingStudentPlacementsReducer from "./features/placements/studentPlacements/upcomingStudentPlacementsSlice"
|
|
6
|
+
import completedStudentPlacementsReducer from "./features/placements/studentPlacements/completedStudentPlacementsSlice"
|
|
7
|
+
import contactsReducer from "./features/contacts/contactsSlice"
|
|
8
|
+
import activePlacementReducer from "./features/placements/studentPlacements/activePlacement"
|
|
9
|
+
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const persistConfig = {
|
|
13
|
+
key: "root",
|
|
14
|
+
version: 1,
|
|
15
|
+
storage: AsyncStorage,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const reducers = combineReducers({
|
|
19
|
+
upcomingStudentPlacements: upcomingStudentPlacementsReducer,
|
|
20
|
+
completedStudentPlacements: completedStudentPlacementsReducer,
|
|
21
|
+
contacts: contactsReducer,
|
|
22
|
+
activePlacement: activePlacementReducer,
|
|
23
|
+
jobs: jobsReducer
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const persistedReducers = persistReducer(persistConfig, reducers);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export const store = configureStore({
|
|
31
|
+
reducer: persistedReducers,
|
|
32
|
+
devTools: process.env.NODE_ENV !== 'production',
|
|
33
|
+
middleware: (getDefaultMiddleware) =>
|
|
34
|
+
getDefaultMiddleware({
|
|
35
|
+
immutableCheck: false,
|
|
36
|
+
serializableCheck: false
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type RootStateType = ReturnType<typeof store.getState>
|
|
42
|
+
export type RootState = {
|
|
43
|
+
upcomingStudentPlacements: RootStateType["upcomingStudentPlacements"]
|
|
44
|
+
completedStudentPlacements: RootStateType["completedStudentPlacements"],
|
|
45
|
+
activePlacement: RootStateType["activePlacement"],
|
|
46
|
+
contacts: RootStateType["contacts"],
|
|
47
|
+
jobs: RootStateType["jobs"]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
51
|
export type AppDispatch = typeof store.dispatch
|