Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Credential Engine launch #2415

Open
wants to merge 999 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
999 commits
Select commit Hold shift + click to select a range
feb1bed
fix warning errors
Sun-Mountain Jun 25, 2024
0832519
fix warning errors
Sun-Mountain Jun 25, 2024
b20d4de
apply filters and close drawer
Sun-Mountain Jun 25, 2024
faa2986
apply filters and close drawer
Sun-Mountain Jun 25, 2024
a0e423e
readd search results page test
Sun-Mountain Jun 25, 2024
f3991d5
readd search results page test
Sun-Mountain Jun 25, 2024
8ad7828
readd training compare
Sun-Mountain Jun 25, 2024
399a3e2
readd training compare
Sun-Mountain Jun 25, 2024
1799c13
add filter btn float
Sun-Mountain Jun 25, 2024
03640e4
add filter btn float
Sun-Mountain Jun 25, 2024
60534fe
update styling
Sun-Mountain Jun 25, 2024
8311012
update styling
Sun-Mountain Jun 25, 2024
a0a08c6
make header sticky
Sun-Mountain Jun 25, 2024
f694f9b
make header sticky
Sun-Mountain Jun 25, 2024
d62cd5c
cypress tests
Sun-Mountain Jun 26, 2024
76f9733
cypress tests
Sun-Mountain Jun 26, 2024
73c3856
finish cypress tests
Sun-Mountain Jun 26, 2024
ed25076
finish cypress tests
Sun-Mountain Jun 26, 2024
ab5ef10
fix cypress tests
Sun-Mountain Jun 26, 2024
cfaff3e
fix cypress tests
Sun-Mountain Jun 26, 2024
4bec8ef
fix tests
Sun-Mountain Jun 26, 2024
3260152
fix tests
Sun-Mountain Jun 26, 2024
4421f73
Merge pull request #2576 from newjersey/njwe-1818/db-pct-employed
ChelseaKR Jun 27, 2024
3ab8256
latest
ChelseaKR Jun 27, 2024
9eae138
Merge branch 'master' into credential-engine
ChelseaKR Jun 27, 2024
4427dc9
latest
ChelseaKR Jun 27, 2024
4e1dfcd
Merge branch 'credential-engine' into nz/2115-filter-drawer
ChelseaKR Jun 27, 2024
f0da7d9
Merge branch 'credential-engine' into NJWE-1847
ChelseaKR Jun 28, 2024
7672ad9
latest
ChelseaKR Jul 2, 2024
efa049a
Merge branch 'master' into credential-engine
ChelseaKR Jul 2, 2024
a4a2c0d
Merge branch 'credential-engine' into nz/2115-filter-drawer
ChelseaKR Jul 2, 2024
1757589
Merge branch 'credential-engine' into NJWE-1847
ChelseaKR Jul 2, 2024
7c52c05
fixed provider services label, was previously "Languages"
ChelseaKR Jul 9, 2024
baca6d5
i18next enhancements
ChelseaKR Jul 9, 2024
84f29b8
Added new function getLearningDeliveryTypes
ChelseaKR Jul 9, 2024
ecb011d
merge
Sun-Mountain Jul 10, 2024
1388708
removed ceterms:availableAt; looped over all records; changed endpoin…
denish-fearless Jul 11, 2024
57cf51e
fix type
Sun-Mountain Jul 11, 2024
0c5c3a6
fix object+object err
Sun-Mountain Jul 11, 2024
11077d7
clean up code
Sun-Mountain Jul 11, 2024
d66f123
Merge pull request #2575 from newjersey/NJWE-1847
denish-fearless Jul 11, 2024
83b9b1b
Merge branch 'credential-engine' into nz/2115-filter-drawer
Sun-Mountain Jul 11, 2024
6fa7f6b
switched to using hasOnlineOffering
ChelseaKR Jul 11, 2024
18ccff8
rm eslint error
ChelseaKR Jul 11, 2024
bf85069
Merge branch 'credential-engine' into njwe-2249/ctdl-learningDelivery…
ChelseaKR Jul 12, 2024
038d177
implemented ctdl language terms (BCP47 language tags)
ChelseaKR Jul 12, 2024
cb376bf
soc code here even though it's not really used for anything
ChelseaKR Jul 12, 2024
3178acd
Merge remote-tracking branch 'origin/credential-engine' into credenti…
ChelseaKR Jul 12, 2024
e5c6bbc
Merge branch 'credential-engine' into njwe-2250/ctdl-inLanguage
ChelseaKR Jul 12, 2024
2f52de9
Merge branch 'credential-engine' into njwe-2249/ctdl-learningDelivery…
ChelseaKR Jul 12, 2024
b4d102d
Merge branch 'credential-engine' into nz/2115-filter-drawer
Sun-Mountain Jul 12, 2024
b711a87
frontend changes
Sun-Mountain Jul 17, 2024
a439585
skip relevant tests for now
Sun-Mountain Jul 17, 2024
fb65550
remove console.log
Sun-Mountain Jul 17, 2024
4ac6047
remove console logs
Sun-Mountain Jul 17, 2024
7e314d3
return array
Sun-Mountain Jul 17, 2024
4f7023c
remove console.log functions
Sun-Mountain Jul 17, 2024
f41a786
skipping failing tests for now
Sun-Mountain Jul 17, 2024
b41aab1
add filters
Sun-Mountain Jul 17, 2024
c1c4aa9
add sorts to be
Sun-Mountain Jul 17, 2024
f1c93e8
fix router test
Sun-Mountain Jul 17, 2024
def3ec6
remove skip
Sun-Mountain Jul 17, 2024
523012d
Merge pull request #2678 from newjersey/nz/1680-filter-backend
Sun-Mountain Jul 17, 2024
541f3cc
remove filter float button
Sun-Mountain Jul 18, 2024
923a1b9
move filter drop downs to filter drawer btn line;
Sun-Mountain Jul 18, 2024
e530cea
disregard period in cip code
Sun-Mountain Jul 18, 2024
c6699d0
change btn color
Sun-Mountain Jul 18, 2024
5dca7cf
fix filter multi option bug
Sun-Mountain Jul 18, 2024
4834b72
Merge pull request #2644 from newjersey/njwe-2249/ctdl-learningDelive…
ChelseaKR Jul 22, 2024
c2021fa
Merge branch 'credential-engine' into njwe-2250/ctdl-inLanguage
ChelseaKR Jul 22, 2024
21d181f
Merge pull request #2655 from newjersey/njwe-2250/ctdl-inLanguage
ChelseaKR Jul 22, 2024
9d098a8
Merge branch 'credential-engine' into nz/2115-filter-drawer
ChelseaKR Jul 27, 2024
13c785a
latest
ChelseaKR Aug 1, 2024
3910d66
Merge remote-tracking branch 'innovation-origin/credential-engine' in…
ChelseaKR Aug 1, 2024
cebefff
latest
ChelseaKR Aug 1, 2024
dc45d9c
search change
ChelseaKR Aug 1, 2024
efbc06d
merge
ChelseaKR Aug 10, 2024
94f7e68
fixed eslint errors
ChelseaKR Aug 12, 2024
4ec6e24
latest
ChelseaKR Aug 12, 2024
f083b8e
latest
ChelseaKR Aug 12, 2024
4ba67d3
Merge pull request #2582 from newjersey/nz/2115-filter-drawer
ChelseaKR Aug 12, 2024
e0485f4
add CIP code to searchQueryLabel
ChelseaKR Aug 12, 2024
43b8ade
Refactor caching mechanism for training search results
ChelseaKR Aug 15, 2024
3ed1a52
fix lint errors
ChelseaKR Aug 15, 2024
1ce3fd2
Merge pull request #2783 from newjersey/ce-improve-caching
denish-fearless Aug 15, 2024
6d9e55a
skeleton
scwambach Aug 15, 2024
4f7d688
translations
scwambach Aug 16, 2024
8d2f667
using cached data
scwambach Aug 19, 2024
7a07f3f
removing loading from pagination
scwambach Aug 20, 2024
fd1b94f
Merge pull request #2790 from newjersey/NJWE-2334-loading-screen
ChelseaKR Aug 23, 2024
d40d6b2
latest
ChelseaKR Aug 23, 2024
359628f
Update Pagination.tsx
scwambach Sep 16, 2024
35030e4
Merge pull request #2876 from newjersey/scott/NJWE-2353-pagination-sc…
ChelseaKR Sep 16, 2024
954602c
merge
ChelseaKR Sep 16, 2024
07e3df1
Merge remote-tracking branch 'origin/credential-engine' into credenti…
ChelseaKR Sep 16, 2024
ed17799
latest
ChelseaKR Sep 27, 2024
a0d07aa
latest
ChelseaKR Sep 27, 2024
64b6e31
latest
ChelseaKR Oct 16, 2024
ee237a6
fix error
ChelseaKR Oct 18, 2024
75bc223
latest
ChelseaKR Oct 18, 2024
75eb7c4
updated search query base
ChelseaKR Oct 19, 2024
28866a6
updated search query
ChelseaKR Oct 19, 2024
6c5f033
add comments for hardcoding test data
ChelseaKR Oct 22, 2024
0b6ec98
sentence case
scwambach Oct 24, 2024
a424ad9
temp rv for prod registry
ChelseaKR Oct 25, 2024
2140b23
latest
ChelseaKR Oct 25, 2024
d185ddc
Merge branch 'credential-engine' into NJWE-2332-filter-drawer-updates
scwambach Oct 28, 2024
ad578b6
filter fix start
scwambach Oct 29, 2024
d328822
use LearningOpportunityProfiles
ChelseaKR Oct 29, 2024
69b5bd1
small adjustments
scwambach Oct 29, 2024
371ddc7
chips desktop
scwambach Oct 30, 2024
5cf191c
mobile styles
scwambach Oct 30, 2024
7241ad7
search bar function
scwambach Oct 30, 2024
0638aae
Update _search-results-page.scss
scwambach Oct 30, 2024
49c7b18
matt's notes
scwambach Oct 31, 2024
8ed9f71
Merge pull request #2987 from newjersey/NJWE-2332-filter-drawer-updates
ChelseaKR Nov 7, 2024
b757098
updated extractPrerequisites
ChelseaKR Nov 15, 2024
af9666c
look for non-english langauges instead of showing multilanguage servi…
ChelseaKR Nov 15, 2024
c997c02
latest
ChelseaKR Nov 20, 2024
1b480ba
added total clock hours
ChelseaKR Nov 20, 2024
f81fc72
fixed support services
ChelseaKR Nov 20, 2024
14c73cb
Update .gitignore
scwambach Nov 21, 2024
b87fe7c
Update package-lock.json
scwambach Nov 21, 2024
7bf4b0e
title bar and blocks
scwambach Nov 22, 2024
2c7d2ad
groupings
scwambach Nov 25, 2024
5bba669
Update TrainingPage.tsx
scwambach Nov 25, 2024
b2643d9
Added basic implementation of DeliveryType as replacement for "online…
ChelseaKR Nov 25, 2024
5bec3c8
quick facts
scwambach Nov 25, 2024
f320957
Merge pull request #3044 from newjersey/njwe-2476/handle-blended-deli…
ChelseaKR Nov 26, 2024
5d4afc1
quick facts
scwambach Nov 26, 2024
93cc2b2
Merge branch 'credential-engine' into NJWE-2452-training-page-design-…
scwambach Nov 26, 2024
29222c4
labels and buttons
scwambach Nov 27, 2024
aaf5740
Update _training-page.scss
scwambach Nov 27, 2024
eb9ebc1
Update TrainingPage.tsx
scwambach Nov 27, 2024
ffda6f2
Update training-page.cy.js
scwambach Nov 27, 2024
091104d
Update training-page.cy.js
scwambach Nov 27, 2024
f895639
Update _stat-block.scss
scwambach Nov 27, 2024
402c809
Update TrainingPage.tsx
scwambach Nov 27, 2024
4908b8e
divider line
scwambach Dec 2, 2024
daf505f
funding section
scwambach Dec 2, 2024
48e63ce
Update ProviderServices.tsx
scwambach Dec 2, 2024
a7fd784
drawer content
scwambach Dec 2, 2024
b05b82e
copy changes
scwambach Dec 2, 2024
71b1369
disclaimer
scwambach Dec 2, 2024
cb2e973
fix capitalization for inPersonClass
ChelseaKR Dec 3, 2024
b4030a7
refactor certifications => credentials
ChelseaKR Dec 3, 2024
73b7eae
latest
ChelseaKR Dec 3, 2024
316ae94
rearrange for mobile
scwambach Dec 3, 2024
641b8f5
classname
scwambach Dec 3, 2024
3e95da5
Merge branch 'NJWE-2452-training-page-design-update' of https://githu…
scwambach Dec 3, 2024
62e06fc
Update _training-page.scss
scwambach Dec 3, 2024
24a18b7
more notes
scwambach Dec 3, 2024
71cadda
Update _grouping.scss
scwambach Dec 3, 2024
21253a7
button fix
scwambach Dec 4, 2024
dbd4448
Merge pull request #3061 from newjersey/NJWE-2452-training-page-desig…
ChelseaKR Dec 4, 2024
5a5425b
fix misalignment of percentEmployed div
ChelseaKR Dec 5, 2024
97e9567
Merge remote-tracking branch 'origin/credential-engine' into credenti…
ChelseaKR Dec 5, 2024
50db2ed
fix county filter
ChelseaKR Dec 5, 2024
01c3476
Merge pull request #3082 from newjersey/fix-county-filter
ChelseaKR Dec 5, 2024
cc7520f
added deliverytype translations
ChelseaKR Dec 5, 2024
f45b1a3
Fixed class format filter and added blended delivery option
ChelseaKR Dec 5, 2024
00f1841
Fixed distance from zip filter
ChelseaKR Dec 5, 2024
65ba734
Merge pull request #3085 from newjersey/fix-classformat-filter
ChelseaKR Dec 5, 2024
e3f5d2f
Merge branch 'credential-engine' into fix-zip-distance-filter
ChelseaKR Dec 5, 2024
5206634
Merge pull request #3086 from newjersey/fix-zip-distance-filter
ChelseaKR Dec 5, 2024
771c495
temp not found
scwambach Dec 9, 2024
4ac4d3a
translation
scwambach Dec 9, 2024
10eb361
quick fixes
scwambach Dec 9, 2024
62c99d2
fix outcomesDefinition bug
ChelseaKR Dec 10, 2024
c42290f
refactored certificate -> record
ChelseaKR Dec 10, 2024
806aef5
fix formatting bug
ChelseaKR Dec 10, 2024
02bf5d9
rm unnecessary comment
ChelseaKR Dec 10, 2024
92ace45
Merge pull request #3098 from newjersey/temp-not-found
ChelseaKR Dec 10, 2024
c67f781
fix employment rate
ChelseaKR Dec 11, 2024
f133550
Merge remote-tracking branch 'origin/credential-engine' into credenti…
ChelseaKR Dec 11, 2024
4c06877
fixed up target contact info / provider address
ChelseaKR Dec 11, 2024
3ffe3f2
rm logs
ChelseaKR Dec 11, 2024
8eb5059
Merge pull request #3108 from newjersey/contactpoint-info
ChelseaKR Dec 11, 2024
6fb5371
fixed sorting
ChelseaKR Dec 14, 2024
4ea2b1a
feat: cache filtered results to optimize sorting performance
ChelseaKR Dec 14, 2024
bc6814a
cleanup
ChelseaKR Dec 16, 2024
6819024
Run Node.js tests and capture output
ChelseaKR Dec 16, 2024
2292b8d
Run Node.js tests and capture output
ChelseaKR Dec 16, 2024
62215aa
fix
ChelseaKR Dec 16, 2024
6789de8
fix
ChelseaKR Dec 16, 2024
2646bea
latest
ChelseaKR Dec 17, 2024
92fffd2
mock data stump
ChelseaKR Dec 17, 2024
58bf077
mock data stump
ChelseaKR Dec 17, 2024
4ba8313
feat: optimize parallel execution of API calls in searchTrainings
ChelseaKR Dec 18, 2024
00c859a
feat: add caching to findTrainingsBy to improve performance
ChelseaKR Dec 18, 2024
0ae5041
info box
scwambach Dec 19, 2024
c18bc07
Merge pull request #3129 from newjersey/NJWE-2493-not-seeing-results
ChelseaKR Dec 20, 2024
8c1086b
latest
ChelseaKR Dec 20, 2024
00aa0a8
Merge remote-tracking branch 'origin/credential-engine' into credenti…
ChelseaKR Dec 20, 2024
c808e41
Merge branch 'main' into credential-engine
ChelseaKR Dec 20, 2024
83ceb96
Fix code scanning alert no. 30: DOM text reinterpreted as HTML
ChelseaKR Dec 20, 2024
52667d6
latest
ChelseaKR Dec 20, 2024
177c0cb
checkpt
ChelseaKR Dec 21, 2024
6779599
test db name
ChelseaKR Dec 23, 2024
31048af
test db name
ChelseaKR Dec 23, 2024
426f68f
test db name
ChelseaKR Dec 23, 2024
dd6b0bc
Merge pull request #3134 from newjersey/dependabot/npm_and_yarn/front…
ChelseaKR Dec 23, 2024
b5fca50
fixed migrations
ChelseaKR Dec 23, 2024
9d9e1e3
Merge remote-tracking branch 'origin/credential-engine' into credenti…
ChelseaKR Dec 23, 2024
cf5f2dd
latest
ChelseaKR Dec 23, 2024
013fe9f
skipping failing tests for now the sake of timeline, sorry
ChelseaKR Dec 24, 2024
78100fe
Merge branch 'credential-engine' into fix-sorting
denish-fearless Dec 27, 2024
750edec
Merge pull request #3116 from newjersey/fix-sorting
denish-fearless Dec 27, 2024
c2ffcd9
cached unfiltered data and applied filter to it
denish-fearless Dec 30, 2024
479b45c
using const instead of let for filtered_results
denish-fearless Jan 3, 2025
4b37739
deleted p from the query to navigate users to initial page
denish-fearless Jan 3, 2025
2fa5f5f
Merge pull request #3147 from newjersey/NJWE-2547
ChelseaKR Jan 3, 2025
6ad7329
Merge branch 'credential-engine' into NJWE-2525
ChelseaKR Jan 3, 2025
cc71bf3
Merge pull request #3141 from newjersey/NJWE-2525
ChelseaKR Jan 3, 2025
aa84216
remove langauges from provider services
ChelseaKR Jan 3, 2025
38c5cf1
Fix: Display <SearchTips> only on the first page of search results
ChelseaKR Jan 3, 2025
f40f947
Fix: Reset page number to 1 when search query changes
ChelseaKR Jan 4, 2025
9e24096
feat: Normalize CIP code handling in backend search logic
ChelseaKR Jan 4, 2025
23888c6
rm extra quote
ChelseaKR Jan 4, 2025
70740c6
feat: Implement SOC code filtering using socCodes array
ChelseaKR Jan 4, 2025
187b9b6
implemented language filter to CE datas
denish-fearless Jan 6, 2025
bf4300b
fix: Handle missing provider data gracefully across backend and frontend
ChelseaKR Jan 7, 2025
861e75e
fix: Handle missing provider data gracefully across backend and frontend
ChelseaKR Jan 7, 2025
35ffa45
Merge pull request #3154 from newjersey/credential-engine-handle-opti…
ChelseaKR Jan 8, 2025
e5b7efe
Merge branch 'credential-engine' into NJWE-2550
ChelseaKR Jan 8, 2025
bd95f33
Merge pull request #3150 from newjersey/NJWE-2550
ChelseaKR Jan 8, 2025
6653164
latest
ChelseaKR Jan 8, 2025
926d1e6
sending whitespace instead of + to search the entire query
denish-fearless Jan 8, 2025
92af8c1
Optimize fetchAllCertsInBatches with parallelized Credential Engine S…
ChelseaKR Jan 8, 2025
e28ba01
checkpt
ChelseaKR Jan 9, 2025
b11124c
lazy loading supportservices
ChelseaKR Jan 9, 2025
0e5f269
Merge branch 'credential-engine' into hotfix/queryappend
ChelseaKR Jan 9, 2025
53a8e5b
Merge pull request #3156 from newjersey/hotfix/queryappend
ChelseaKR Jan 9, 2025
a062362
feat(cache): Implement provider data caching and fix type mismatches
ChelseaKR Jan 9, 2025
5d2c885
fix failing tests
ChelseaKR Jan 9, 2025
a7a6abf
fix: resolve AWS CommonJS compatibility issue with p-limit
ChelseaKR Jan 9, 2025
dc79c7f
checkpt
ChelseaKR Jan 10, 2025
ce939de
checkpt
ChelseaKR Jan 10, 2025
37eb78e
latest
ChelseaKR Jan 10, 2025
b42d6e7
latest
ChelseaKR Jan 10, 2025
77d518c
program contact pt
ChelseaKR Jan 10, 2025
838310d
fixed $0 cost
ChelseaKR Jan 10, 2025
a587187
implemented support services filter
denish-fearless Jan 14, 2025
987f169
Merge pull request #3168 from newjersey/NJWE-2582
ChelseaKR Jan 14, 2025
49838a5
fix deliverytype
ChelseaKR Jan 17, 2025
66f11ae
enhance query readability
ChelseaKR Jan 17, 2025
9f86bb4
feat: include and prioritize exact matches while retaining broader co…
ChelseaKR Jan 17, 2025
7a3f6dc
more readability enhancement
ChelseaKR Jan 17, 2025
54d1199
Merge branch 'credential-engine' into ce-deliverytype-fix
ChelseaKR Jan 17, 2025
9dfffc3
Merge pull request #3180 from newjersey/ce-deliverytype-fix
ChelseaKR Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions backend/.env-sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CE_AUTH_TOKEN = { CE_AUTH_TOKEN }
CE_ENVIRONMENT = { CE_ENVIRONMENT_TOKEN }
8,155 changes: 4,325 additions & 3,830 deletions backend/data/standardized_etpl_for_data_migration.csv

Large diffs are not rendered by default.

46 changes: 22 additions & 24 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"fs-extra": "^11.1.0",
"good-fences": "^1.1.2",
"jest": "^29.3.1",
"jest-mock-axios": "^4.7.3",
"prettier": "^3.0.0",
"supertest": "^7.0.0",
"ts-jest": "^29.0.3",
Expand Down
7 changes: 3 additions & 4 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { routerFactory } from "./routes/router";
import emailSubmissionRouter from './routes/emailRoutes';
import contentfulRouter from './contentful/index';
import { PostgresDataClient } from "./database/data/PostgresDataClient";
import { PostgresSearchClient } from "./database/search/PostgresSearchClient";
import { findTrainingsByFactory } from "./domain/training/findTrainingsBy";
import { searchTrainingsFactory } from "./domain/search/searchTrainings";
import { getInDemandOccupationsFactory } from "./domain/occupations/getInDemandOccupations";
Expand All @@ -18,6 +17,7 @@ import { OnetClient } from "./oNET/OnetClient";
import { getEducationTextFactory } from "./domain/occupations/getEducationText";
import { getSalaryEstimateFactory } from "./domain/occupations/getSalaryEstimate";
import { CareerOneStopClient } from "./careeronestop/CareerOneStopClient";
import { credentialEngineFactory } from "./domain/credentialengine/CredentialEngineFactory";
import {getOccupationDetailByCIPFactory} from "./domain/occupations/getOccupationDetailByCIP";

dotenv.config();
Expand Down Expand Up @@ -160,11 +160,10 @@ if (!isCI) {
}

const postgresDataClient = new PostgresDataClient(connection);
const postgresSearchClient = new PostgresSearchClient(connection);
const findTrainingsBy = findTrainingsByFactory(postgresDataClient);

const router = routerFactory({
searchTrainings: searchTrainingsFactory(findTrainingsBy, postgresSearchClient),
searchTrainings: searchTrainingsFactory(postgresDataClient),
findTrainingsBy: findTrainingsBy,
getInDemandOccupations: getInDemandOccupationsFactory(postgresDataClient),
getOccupationDetail: getOccupationDetailFactory(
Expand All @@ -180,9 +179,9 @@ const router = routerFactory({
apiValues.careerOneStopUserId,
apiValues.careerOneStopAuthToken
),
findTrainingsBy,
postgresDataClient
),
getAllCertificates: credentialEngineFactory(),
getOccupationDetailByCIP: getOccupationDetailByCIPFactory(
OnetClient(
apiValues.onetBaseUrl,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
84 changes: 84 additions & 0 deletions backend/src/credentialengine/CredentialEngineAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { searchAPI } from "./CredentialEngineConfig";
import { getRecordAPI } from "./CredentialEngineConfig";

const searchGateway = `/assistant/search/ctdl`;
const graphGateway = `/graph`;
const resourcesGateway = `/resources`;

export const credentialEngineAPI = {
/**
*
* @param query this should be a JSON-LD blob representing specific CE term collections.
* @param skip part of pagination, number of results to skip
* @param take part of pagination, number of results to return
* @param sort CE provides several sorting methods
*
* @return a collection of results from Credential Engine.
*
*/

getResults: async function (query: object, skip: number, take: number, sort: string) {
const response = await searchAPI.request({
url: `${searchGateway}`,
method: "post",
data: {
Query: query,
Skip: skip,
Take: take,
Sort: sort,
},
// retrieving the signal value by using the property name
// signal: cancel ? cancelApiObject[this.get.name].handleRequestCancellation().signal : undefined,
});

// return "Connection works.";
return response;
},

getGraphByCTID: async function (ctid: string) {
const response = await getRecordAPI({
url: `${graphGateway}/${ctid}`,
method: "get",
});

return response.data;
},

getResourceByCTID: async function (ctid: string) {
const response = await getRecordAPI({
url: `${resourcesGateway}/${ctid}`,
method: "get",
});

return response.data;
},

// TODO: Discuss how we can use Cips for better results
// getResultByCips: async function (cips: string[]) {
// if(cips.length === 0) return []
// const query = `
// {
// "ceterms:instructionalProgramType": {
// "ceterms:codedNotation": ${JSON.stringify(cips)}
// },
// "ceterms:availableOnlineAt": "search:anyValue",
// "ceterms:availableAt": {
// "ceterms:addressRegion": [
// {
// "search:value": "NJ",
// "search:value": "jersey",
// "search:matchType": "search:exactMatch"
// }
// ]
// },
// "ceterms:credentialStatusType": {
// "ceterms:targetNode": "credentialStat:Active"
// },
// "search:recordPublishedBy": "ce-cc992a07-6e17-42e5-8ed1-5b016e743e9d"
// }
// `
// const result = await this.getResults(JSON.parse(query), 0, 4, "")
// return result.data.data
// }

}
49 changes: 49 additions & 0 deletions backend/src/credentialengine/CredentialEngineConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import axios from "axios";

export const searchAPI = axios.create({
withCredentials: true,
baseURL: `https://${process.env.CE_ENVIRONMENT}.credentialengine.org`,
responseType: "json",
headers: {
"Access-Control-Request-Method": "POST",
"Access-Control-Request-Headers": "Content-Type, Authorization",
Authorization: `Bearer ${process.env.CE_AUTH_TOKEN}`,
"Content-type": "application/json",
},
});

export const getRecordAPI = axios.create({
withCredentials: false,
baseURL: process.env.CE_ENVIRONMENT == "sandbox" ? `https://${process.env.CE_ENVIRONMENT}.credentialengineregistry.org` : `https://credentialengineregistry.org`,
responseType: "json"
})

const errorHandler = (error: { response: { status: unknown } }) => {
const statusCode = error.response?.status;

if (statusCode && statusCode !== 401) {
console.error(error);
}

return Promise.reject(error);
};

searchAPI.interceptors.response.use(undefined, (error) => {
return errorHandler(error);
});

getRecordAPI.interceptors.response.use(undefined, (error) => {
return errorHandler(error);
});

/*

curl "https://sandbox.credentialengine.org/assistant/search/ctdl" \
-H "Origin: http://localhost:3000" \
-H 'Access-Control-Request-Method: POST' \
-H 'Access-Control-Request-Headers: Content-Type, Authorization' \
-H "Authorization: Bearer bc5989e5-8b5b-4099-85f3-961b4913c24c" \
-H 'Content-Type: application/json' \
-d "{'Query': { '@type': 'ceterms:Certificate' }, 'Skip': 0, 'Take': 5, 'Sort': '^search:recordCreated' }"

*/
Loading
Loading