Skip to content

Commit

Permalink
Feat/samvritsrinath firebase auth (#18)
Browse files Browse the repository at this point in the history
* Generate Branch for Firebase

* random frontend testing + set up user mongo model

* created file for custom errors + started backend firebase setup

* Basic firebase scheme

* Scaffolding for Login Page

* added function to decode auth token

* firebase running on frontend, bug: hitting login button is not calling the intended function

* made text input field a reusable component

* updated input field + firebase call works on frontend

* minor code clean up

* created backend route for getting user -error: appears as if route is not being called

* firebase auth fully functional. to-do: send both firebase uid and mongo _id in route, currently only sending uid

firebase auth fully functional, need to send mongo id in addition to firerbase UID from backend

* added mongoId to API route - ready for PR

* moved logo up

* linting

* fixed env issues

* changed some routing

* linting issue

* Fixing Imports for Lint Check

* Modifying Imports

* Use cleanEnv for env vars & add secrets to GH actions

* Fix syntax issue in GH actions yml file

* Add env vars for backend to GH actions yml file

* Add env variables to GH actions unit tests yml

* Add env variables to GH actions unit tests yml

* Fix unit tests GH actions yml

* Trigger re-run of GH actions

* Fix env var issues in frontend and backend

* addressed changes

* removed unnecssary comments and console statements

* Fix light vs dark theme issues with login page

---------

Co-authored-by: SB1019 <[email protected]>
Co-authored-by: Harsh Gurnani <[email protected]>
Co-authored-by: benjaminjohnson2204 <[email protected]>
  • Loading branch information
4 people authored Feb 20, 2024
1 parent 70c48b6 commit c60b6b4
Show file tree
Hide file tree
Showing 29 changed files with 1,462 additions and 745 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Lint, style, and compilation checks

on:
pull_request:
branches:
branches:
- main

jobs:
Expand All @@ -16,6 +16,16 @@ jobs:
run: |
npm ci
npm run lint-check
env:
PORT: ${{ secrets.PORT }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
FRONTEND_ORIGIN: ${{ secrets.FRONTEND_ORIGIN }}
EMAIL_USER: ${{ secrets.EMAIL_USER }}
EMAIL_APP_PASSWORD: ${{ secrets.EMAIL_APP_PASSWORD }}
EMAIL_NOTIFICATIONS_RECIPIENT: ${{ secrets.EMAIL_NOTIFICATIONS_RECIPIENT }}
BACKEND_FIREBASE_SETTINGS: ${{ secrets.BACKEND_FIREBASE_SETTINGS }}
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}

frontend:
name: Frontend check
runs-on: ubuntu-latest
Expand All @@ -27,3 +37,6 @@ jobs:
npm ci
npm run lint-check
npm run build
env:
NEXT_PUBLIC_BACKEND_URL: ${{ secrets.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_FIREBASE_SETTINGS: ${{ secrets.NEXT_PUBLIC_FIREBASE_SETTINGS }}
22 changes: 17 additions & 5 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Run frontend & backend unit tests
on:
pull_request:
branches:
branches:
- main

jobs:
backend:
name: Backend tests
Expand All @@ -12,11 +13,20 @@ jobs:
- uses: actions/setup-node@v3
- name: Run tests
working-directory: backend
env:
CI: true
run: |
npm ci
npm run test
env:
CI: true
PORT: ${{ secrets.PORT }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
FRONTEND_ORIGIN: ${{ secrets.FRONTEND_ORIGIN }}
EMAIL_USER: ${{ secrets.EMAIL_USER }}
EMAIL_APP_PASSWORD: ${{ secrets.EMAIL_APP_PASSWORD }}
EMAIL_NOTIFICATIONS_RECIPIENT: ${{ secrets.EMAIL_NOTIFICATIONS_RECIPIENT }}
BACKEND_FIREBASE_SETTINGS: ${{ secrets.BACKEND_FIREBASE_SETTINGS }}
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}

frontend:
name: Frontend tests
runs-on: ubuntu-latest
Expand All @@ -25,8 +35,10 @@ jobs:
- uses: actions/setup-node@v3
- name: Run tests
working-directory: frontend
env:
CI: true
run: |
npm ci
npm run test
env:
CI: true
NEXT_PUBLIC_BACKEND_URL: ${{ secrets.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_FIREBASE_SETTINGS: ${{ secrets.NEXT_PUBLIC_FIREBASE_SETTINGS }}
17 changes: 9 additions & 8 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Example environment variables for backend. Any "<example>"s should be
# replaced with the real values.
PORT=3001
MONGODB_URI="mongodb://127.0.0.1:27017/pap"
FRONTEND_ORIGIN="http://localhost:3000"
EMAIL_USER="<example>@gmail.com"
EMAIL_APP_PASSWORD="<example>"
BACKEND_FIREBASE_SETTINGS='<example>'
# Example environment variables for backend. Any "<example>"s should be
# replaced with the real values.
PORT=3001
MONGODB_URI="mongodb://127.0.0.1:27017/pap"
FRONTEND_ORIGIN="http://localhost:3000"
EMAIL_USER="<example>@gmail.com"
EMAIL_APP_PASSWORD="<example>"
BACKEND_FIREBASE_SETTINGS='<example>'
SERVICE_ACCOUNT_KEY='<example>'
Loading

0 comments on commit c60b6b4

Please sign in to comment.