Skip to content

Commit

Permalink
Reorganize backend folder
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynzhang18 committed May 23, 2024
1 parent c878b03 commit e119c3d
Show file tree
Hide file tree
Showing 46 changed files with 83 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/heroku-deploy-dev-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- "backend/typescript/**"
- "backend/**"

jobs:
deploy:
Expand Down Expand Up @@ -50,4 +50,4 @@ jobs:
env:
HEROKU_APP_NAME: "${{ secrets.DEV_PROJECT_ID }}"
- name: Push to Heroku
run: git push heroku `git subtree split --prefix backend/typescript`:main --force
run: git push heroku `git subtree split --prefix backend`:main --force
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:
- main
paths:
- "frontend/**"
- "backend/typescript/**"
- "backend/**"
- "backend/python/**"
pull_request:
branches:
- main
paths:
- "frontend/**"
- "backend/typescript/**"
- "backend/**"
- "backend/python/**"

jobs:
Expand All @@ -31,7 +31,7 @@ jobs:
frontend:
- "frontend/**"
typescript-backend:
- "backend/typescript/**"
- "backend/**"
python-backend:
- "backend/python/**"
Expand All @@ -43,11 +43,11 @@ jobs:
cache: "yarn"
cache-dependency-path: |
frontend/yarn.lock
backend/typescript/yarn.lock
backend/yarn.lock
- name: Install Node.js dependencies
if: steps.changes.outputs.frontend == 'true' || steps.changes.outputs.typescript-backend == 'true'
run: yarn --cwd ./frontend --prefer-offline && yarn --cwd ./backend/typescript --prefer-offline
run: yarn --cwd ./frontend --prefer-offline && yarn --cwd ./backend --prefer-offline

- name: Lint frontend
if: steps.changes.outputs.frontend == 'true'
Expand All @@ -56,7 +56,7 @@ jobs:

- name: Lint TypeScript backend
if: steps.changes.outputs.typescript-backend == 'true'
working-directory: ./backend/typescript
working-directory: ./backend
run: yarn lint

- name: Lint Python backend
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions backend/typescript/package.json → backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"firebase-admin": "^9.5.0",
"json2csv": "^5.0.6",
"lodash": "^4.17.21",
"mongodb": "^6.6.2",
"mongoose": "^5.13.20",
"multer": "^1.4.2",
"node-fetch": "^2.6.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 66 additions & 0 deletions backend/typescript/yarn.lock → backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,13 @@
"@types/yargs" "^16.0.0"
chalk "^4.0.0"

"@mongodb-js/saslprep@^1.1.5":
version "1.1.7"
resolved "https://registry.yarnpkg.com/@mongodb-js/saslprep/-/saslprep-1.1.7.tgz#d1700facfd6916c50c2c88fd6d48d363a56c702f"
integrity sha512-dCHW/oEX0KJ4NjDULBo3JiOaK5+6axtpBbS+ao2ZInoAL9/YRQLhXzSNAFz7hP4nzLkIqsfYAK/PDE3+XHny0Q==
dependencies:
sparse-bitfield "^3.0.3"

"@nodelib/fs.scandir@2.1.4":
version "2.1.4"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69"
Expand Down Expand Up @@ -1138,6 +1145,18 @@
resolved "https://registry.yarnpkg.com/@types/verror/-/verror-1.10.4.tgz#805c0612b3a0c124cf99f517364142946b74ba3b"
integrity sha512-OjJdqx6QlbyZw9LShPwRW+Kmiegeg3eWNI41MQQKaG3vjdU2L9SRElntM51HmHBY1cu7izxQJ1lMYioQh3XMBg==

"@types/webidl-conversions@*":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz#1306dbfa53768bcbcfc95a1c8cde367975581859"
integrity sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==

"@types/whatwg-url@^11.0.2":
version "11.0.5"
resolved "https://registry.yarnpkg.com/@types/whatwg-url/-/whatwg-url-11.0.5.tgz#aaa2546e60f0c99209ca13360c32c78caf2c409f"
integrity sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==
dependencies:
"@types/webidl-conversions" "*"

"@types/yamljs@^0.2.31":
version "0.2.31"
resolved "https://registry.yarnpkg.com/@types/yamljs/-/yamljs-0.2.31.tgz#b1a620b115c96db7b3bfdf0cf54aee0c57139245"
Expand Down Expand Up @@ -1647,6 +1666,11 @@ bson@^1.1.4:
resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.5.tgz#2aaae98fcdf6750c0848b0cba1ddec3c73060a34"
integrity sha512-kDuEzldR21lHciPQAIulLs1LZlCXdLziXI6Mb/TDkwXhb//UORJNPXgcRs2CuO4H0DcMkpfT3/ySsP3unoZjBg==

bson@^6.7.0:
version "6.7.0"
resolved "https://registry.yarnpkg.com/bson/-/bson-6.7.0.tgz#51973b132cdc424c8372fda3cb43e3e3e2ae2227"
integrity sha512-w2IquM5mYzYZv6rs3uN2DZTOBe2a0zXLj53TGDqwF4l6Sz/XsISrisXOJihArF9+BZ6Cq/GjVht7Sjfmri7ytQ==

buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
Expand Down Expand Up @@ -4435,6 +4459,14 @@ mkdirp@^1.0.4:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==

mongodb-connection-string-url@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz#c13e6ac284ae401752ebafdb8cd7f16c6723b141"
integrity sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==
dependencies:
"@types/whatwg-url" "^11.0.2"
whatwg-url "^13.0.0"

mongodb-memory-server-core@6.10.0:
version "6.10.0"
resolved "https://registry.yarnpkg.com/mongodb-memory-server-core/-/mongodb-memory-server-core-6.10.0.tgz#9239c7941e5b0a225b50494563f0fc528c056690"
Expand Down Expand Up @@ -4479,6 +4511,15 @@ mongodb@3.7.4, mongodb@^3.6.9:
optionalDependencies:
saslprep "^1.0.0"

mongodb@^6.6.2:
version "6.6.2"
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-6.6.2.tgz#7ecdd788e9162f6c5726cef40bdd2813cc01e56c"
integrity sha512-ZF9Ugo2JCG/GfR7DEb4ypfyJJyiKbg5qBYKRintebj8+DNS33CyGMkWbrS9lara+u+h+yEOGSRiLhFO/g1s1aw==
dependencies:
"@mongodb-js/saslprep" "^1.1.5"
bson "^6.7.0"
mongodb-connection-string-url "^3.0.0"

mongoose-legacy-pluralize@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4"
Expand Down Expand Up @@ -5132,6 +5173,11 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

punycode@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==

pupa@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.1.1.tgz#f5e8fd4afc2c5d97828faa523549ed8744a20d62"
Expand Down Expand Up @@ -5909,6 +5955,13 @@ tr46@^2.1.0:
dependencies:
punycode "^2.1.1"

tr46@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-4.1.1.tgz#281a758dcc82aeb4fe38c7dfe4d11a395aac8469"
integrity sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==
dependencies:
punycode "^2.3.0"

triple-beam@^1.2.0, triple-beam@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9"
Expand Down Expand Up @@ -6182,6 +6235,11 @@ webidl-conversions@^6.1.0:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514"
integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==

webidl-conversions@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a"
integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==

websocket-driver@>=0.5.1:
version "0.7.4"
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760"
Expand All @@ -6208,6 +6266,14 @@ whatwg-mimetype@^2.3.0:
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==

whatwg-url@^13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-13.0.0.tgz#b7b536aca48306394a34e44bda8e99f332410f8f"
integrity sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==
dependencies:
tr46 "^4.1.1"
webidl-conversions "^7.0.0"

whatwg-url@^8.0.0, whatwg-url@^8.5.0:
version "8.7.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ services:
container_name: eaf_backend
restart: always
build:
context: ./backend/typescript
context: ./backend
dockerfile: Dockerfile
ports:
- 8080:8080
dns:
- 8.8.8.8
volumes:
- ./backend/typescript:/app
- ./backend:/app
env_file:
- ./.env
8 changes: 6 additions & 2 deletions frontend/src/APIClients/BaseAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ baseAPIClient.interceptors.request.use(async (config: AxiosRequestConfig) => {
const newConfig = { ...config };

// if access token in header has expired, do a refresh
const authHeaderParts = config.headers.Authorization?.split(" ");
const authHeaderParts =
typeof config.headers?.Authorization === "string" &&
config.headers?.Authorization.split(" ");
if (
authHeaderParts &&
authHeaderParts.length >= 2 &&
Expand All @@ -43,7 +45,9 @@ baseAPIClient.interceptors.request.use(async (config: AxiosRequestConfig) => {
accessToken,
);

newConfig.headers.Authorization = `Bearer ${accessToken}`;
if (newConfig.headers) {
newConfig.headers.Authorization = `Bearer ${accessToken}`;
}
}
}

Expand Down

0 comments on commit e119c3d

Please sign in to comment.