Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
46cd4a0
feat: initialize Expo app in /mobile
andrewx-bu Oct 2, 2025
341ba55
chore: configure Prettier with ESLint for code formatting
andrewx-bu Oct 2, 2025
cc0664f
feat: replace default template with custom HomeScreen layout
andrewx-bu Oct 2, 2025
3693cf9
docs: update README with setup and run instructions
andrewx-bu Oct 2, 2025
3b5e7f9
chore(mock): add events/users/reviews JSON matching design doc
NathanC0926 Oct 6, 2025
aa9b253
chore: add firebase for mobile app and remove .vscode from tracking
andrewx-bu Oct 6, 2025
eae7873
chore: load firebase env into expo and display projectId
andrewx-bu Oct 6, 2025
72547e6
chore: initialize SDK with env config and confirm setup in home screen
andrewx-bu Oct 6, 2025
38c439a
Merge pull request #15 from BU-Spark/mock/setup-mock-backend
arnavSingh23 Oct 7, 2025
20360ad
added login page, and installed NativeWind
NathanC0926 Oct 7, 2025
26a2727
builded a dummy login page, with dummy data
Oct 7, 2025
6ab6488
chore: add Firebase emulator runner and seed script (dummy data)
andrewx-bu Oct 7, 2025
02d22f1
docs: add Firestore data model and usage notes
andrewx-bu Oct 7, 2025
5cf25c1
feat: connect Firestore emulator and display Events on home screen
andrewx-bu Oct 7, 2025
a7cdd4d
chore: Ensure consistent formatting with prettier. Remove unused asse…
andrewx-bu Oct 7, 2025
360b222
docs: notes on how to setup dev environment
andrewx-bu Oct 7, 2025
fa4b521
feat: expand UI with detail sheet to prepare for admin posting flow
andrewx-bu Oct 7, 2025
1fa455e
chore: add more seeded Events for emulator
andrewx-bu Oct 7, 2025
27ff02e
feat: crude first attempt towards admin posting flow: edit/create eve…
andrewx-bu Oct 7, 2025
8cf6ba2
Merge pull request #16 from BU-Spark/feature/mobile-login-screen
arnavSingh23 Oct 7, 2025
6df4434
Merge branch 'dev' into feat/mobile-wireup
andrewx-bu Oct 7, 2025
026900e
chore: route admin users to /admin and update UI
andrewx-bu Oct 7, 2025
a6c6d5f
Merge pull request #17 from BU-Spark/feat/mobile-wireup
arnavSingh23 Oct 7, 2025
524a9ae
rebuild login page, with bu email and connected firebase
Oct 10, 2025
1b20a7a
Merge branch 'dev' into feature/mobile-login-screen-refined
NathanC0926 Oct 10, 2025
4ec8aec
Merge pull request #18 from BU-Spark/feature/mobile-login-screen-refined
arnavSingh23 Oct 11, 2025
11c7e2d
refactor: change to src/ structure
andrewx-bu Oct 11, 2025
407a051
feat: add unified color theme matching web app
andrewx-bu Oct 11, 2025
07fa625
refactor: integrate mock_data with emulator
andrewx-bu Oct 11, 2025
c187797
feat: add data types matching Firestore schema
andrewx-bu Oct 11, 2025
f384e39
chore: add appconfig scheme to silence expo linking warning, install …
andrewx-bu Oct 11, 2025
22b91d3
feat: add events CRUD API with docstring comments
andrewx-bu Oct 12, 2025
a572f13
feat: add reviews and users endpoints with comments
andrewx-bu Oct 12, 2025
2b6d505
chore: set up auth emulator to prepare for endpoint testing + update …
andrewx-bu Oct 12, 2025
f2807df
chore: format files
andrewx-bu Oct 12, 2025
65731c0
chore: remove formatting for web version
andrewx-bu Oct 12, 2025
6cfc075
test: cURL API smoketest, failing one for now because of malformed in…
andrewx-bu Oct 12, 2025
4cec7be
chore: add generic util functions, some more themeing options, extra …
andrewx-bu Oct 12, 2025
295d27c
feat: add hooks and AuthContext to mock login/register and prepare fo…
andrewx-bu Oct 12, 2025
af64dc8
chore: update comments, remove unecessary imports
andrewx-bu Oct 12, 2025
0eaf81c
feat: Add reusable primitive UI pieces using RN paper
andrewx-bu Oct 12, 2025
63d864b
refactor: refine login page and route to correct student/admin dashbo…
andrewx-bu Oct 12, 2025
4088892
chore: update dependencies to silence expo warnings
andrewx-bu Oct 12, 2025
9f3eaa0
test: fixed PATCH request using updateMask, read works fine
andrewx-bu Oct 12, 2025
2b4ea9d
feat: EventCard and EventDetail UI components
andrewx-bu Oct 12, 2025
d58694b
feat: student read only dashboard
andrewx-bu Oct 12, 2025
ad34689
feat: EventEditorModal UI component for admin dashboard
andrewx-bu Oct 12, 2025
e472be2
chore: export theme and status for easier integration
andrewx-bu Oct 12, 2025
526f11a
refactor: admin dashboard using new UI components, styling, and theme
andrewx-bu Oct 12, 2025
8722d36
Merge remote-tracking branch 'origin/dev' into chore/backend-restructure
andrewx-bu Oct 12, 2025
ced220b
fix: Capitalize Users docs so writes work
andrewx-bu Oct 12, 2025
9c0e77f
Merge pull request #19 from BU-Spark/chore/backend-restructure
arnavSingh23 Oct 12, 2025
2809dc9
added timer and photo funtion
Oct 14, 2025
2f2a870
deleted comments
Oct 14, 2025
0c8d994
Merge pull request #20 from BU-Spark/feature/event-ui-timer-and-photo
arnavSingh23 Oct 14, 2025
1582532
feat: integrate Clerk with Expo and add test admin & student users
andrewx-bu Oct 18, 2025
446269b
chore: add logout with Clerk hook, remove legacy Auth helpers, update…
andrewx-bu Oct 19, 2025
32d1c3b
feat: add sign in with google and sign out button
andrewx-bu Oct 19, 2025
479ead8
feat: add ui components for sign in screen
andrewx-bu Oct 19, 2025
0f9ac23
refactor: remove old sign in page, create new root welcome screen
andrewx-bu Oct 19, 2025
897df19
feat: new screens for sign-up, sign-in, verify
andrewx-bu Oct 19, 2025
65bcf08
chore: remove firebase auth
andrewx-bu Oct 19, 2025
5d3f75f
chore: remove unused UI components
andrewx-bu Oct 19, 2025
bf6e735
refactor: more robust time calculations for timer
andrewx-bu Oct 19, 2025
6a96d8f
refactor: merge verify with sign-up screen
andrewx-bu Oct 19, 2025
9f66c48
fix: use new components, fix logout button
andrewx-bu Oct 19, 2025
5d6bef8
Added to the welcome screen BU logo, sign in, signu up buttons. And …
abdallahkutbi Oct 20, 2025
d1be280
Merge pull request #21 from BU-Spark/feat/clerk-auth
arnavSingh23 Oct 20, 2025
88c5bb9
Added navbar for admin side
abdallahkutbi Oct 20, 2025
01fb4e9
fixed some errors
abdallahkutbi Oct 20, 2025
7c6ead8
Merge pull request #22 from BU-Spark/feat/update-login-flow-ui
arnavSingh23 Oct 21, 2025
45f541f
enable image upload via Expo ImagePicker and ensure user doc upsert o…
Oct 23, 2025
ba6b797
edited the photo function according to client
Oct 24, 2025
cff67d0
Merge pull request #23 from BU-Spark/feature/upload-pic-from-gallary
arnavSingh23 Oct 24, 2025
d5e17a0
Add Admin Analytics metric for total trays saved across closed events
Oct 25, 2025
310dcee
added more metrics, for the admin use
Oct 25, 2025
a82168c
changed nav bar color to white
Oct 25, 2025
ca4d9b7
Merge pull request #24 from BU-Spark/feat/admin-analytics-tray-metric
arnavSingh23 Oct 26, 2025
cf44678
feat(feedback): added for student side. student are able to leave fee…
Oct 28, 2025
0333900
added admin view for reviews
Oct 28, 2025
653780c
added fields for optional and required, and let student decide to sha…
Oct 28, 2025
3f5cb91
added average rating, and showing stars in each rating
Oct 28, 2025
52b1a0b
Merge pull request #25 from BU-Spark/feature/add-feedback-student
arnavSingh23 Oct 29, 2025
26b5d7f
Merge branch 'dev' into feature/reviews-display
NathanC0926 Oct 29, 2025
229fb68
deleted dulp code from merge conflict
Oct 29, 2025
734f66a
fix: resolve Android DateTimePicker crash and add proper datetime sel…
Oct 29, 2025
581acc5
Merge pull request #26 from BU-Spark/feature/reviews-display
NathanC0926 Oct 29, 2025
2fdcafe
feat(schema): add Zod validation schemas for events
andrewx-bu Oct 30, 2025
33f7a7f
feat(events): integrate EventSchema validation into CRUD operations
andrewx-bu Oct 30, 2025
feda02d
feat(reviews): Zod schema validation for reviews CRUD
andrewx-bu Oct 30, 2025
fc67e89
feat(users): Zod schema validation for user endpoints
andrewx-bu Oct 30, 2025
8bd36e7
test(API): remove Firebase Auth tests, minor tweaks to other cases
andrewx-bu Oct 30, 2025
3d47856
Add push notifications and student notification toggle
DheerBU Oct 30, 2025
e7cf09f
Merge pull request #27 from BU-Spark/fix/android-datepicker-crash
arnavSingh23 Oct 30, 2025
2f6c72b
Merge pull request #29 from BU-Spark/feat/zod-backend-validation
arnavSingh23 Oct 30, 2025
9b3fd53
Merge pull request #30 from BU-Spark/notifications-feature
arnavSingh23 Nov 3, 2025
a649d39
Edit mobile README for clarity, add SortDropdown component, update ad…
abdallahkutbi Oct 29, 2025
a154671
Merge pull request #32 from BU-Spark/feature/add-sort-dropdown-ak
arnavSingh23 Nov 3, 2025
caf6ed6
fixed the app.config.ts error
DheerBU Nov 3, 2025
2425938
Merge pull request #33 from BU-Spark/fix/notifications
arnavSingh23 Nov 4, 2025
dc14ff4
feat: Add settings page with theme toggle and sign out for student an…
abdallahkutbi Nov 4, 2025
756d79e
Merge pull request #34 from BU-Spark/feature/settings_page
arnavSingh23 Nov 4, 2025
e15feb4
fix: reverted back to emulator
DheerBU Nov 4, 2025
90b2704
chore: add deps
andrewx-bu Nov 5, 2025
4957418
feat(backend): init backend scaffolding
andrewx-bu Nov 5, 2025
a9b057a
feat(auth): add Clerk server-side util
andrewx-bu Nov 5, 2025
52b89a1
feat(rbac): simple role check and permissions mapping
andrewx-bu Nov 5, 2025
f34cf30
feat(rbac): allow users to request staff permision
andrewx-bu Nov 5, 2025
b1602c8
feat(admin): pending & approve role endpoints
andrewx-bu Nov 5, 2025
73af392
feat(api): ping (test) and me endpoints for user info
andrewx-bu Nov 5, 2025
8f3573e
test(rbac): simple curl smoketest on endpoints
andrewx-bu Nov 5, 2025
945d7f3
Merge pull request #35 from BU-Spark/fix/emulator
arnavSingh23 Nov 5, 2025
b4ef4aa
fix: update theme settings across admin and student pages
abdallahkutbi Nov 5, 2025
126298e
Merge pull request #37 from BU-Spark/bugfix/theme-settings
arnavSingh23 Nov 6, 2025
263503d
chore(cron): add daily cron ping to keep backend warm
andrewx-bu Nov 8, 2025
ab486f3
refactor(rbac): centralize role & status parsing in rbac.ts
andrewx-bu Nov 8, 2025
d15a008
refactor(api): simplify request-role endpoint to always request staff
andrewx-bu Nov 8, 2025
52e1cd1
feat(api): add revoke staff permissions endpoint
andrewx-bu Nov 8, 2025
2be82e2
chore: add comments explaining changes to Clerk metadata
andrewx-bu Nov 8, 2025
a2c4228
test: update to match new changes to request-role, revoke endpoints
andrewx-bu Nov 8, 2025
693bad0
chore: example env file for test script
andrewx-bu Nov 8, 2025
974fb30
fix(api): method validation and error handling for various endpoints
andrewx-bu Nov 8, 2025
cd07543
added onboarding page, and added option in setting page to let user c…
Nov 9, 2025
c70fc9e
.
Nov 9, 2025
e2585cc
deleted ai comments
Nov 9, 2025
a079e59
removed hardcoded terms
Nov 9, 2025
3c5ee5a
replaced dummy photo to the ones that client asked for, and modified …
Nov 9, 2025
bd7c692
Merge pull request #38 from BU-Spark/feat/rbac-backend
arnavSingh23 Nov 11, 2025
30e2ab2
Merge pull request #39 from BU-Spark/feat/onbarding-page-and-setting-…
arnavSingh23 Nov 11, 2025
93b4276
Merge pull request #40 from BU-Spark/feat/default-food-pic
arnavSingh23 Nov 11, 2025
abcb86d
feat: added faq page for students and location presets for admins
DheerBU Nov 12, 2025
8cba86a
Merge pull request #41 from BU-Spark/feat/faq-page
arnavSingh23 Nov 12, 2025
3dfe3aa
feat: add location filter dropdown to student events view
abdallahkutbi Nov 13, 2025
41ed7aa
Merge pull request #42 from BU-Spark/feature/filter-by-location
arnavSingh23 Nov 13, 2025
257466b
chore: remove firebase emulator junk from git
andrewx-bu Nov 15, 2025
c1e8f1a
feat: add RBAC client with Clerk backend helpers
andrewx-bu Nov 15, 2025
8735571
feat: new staff endpoint for listing active staff members
andrewx-bu Nov 15, 2025
db43342
refactor: rbac into welcome, route to pending, student, or admin/staf…
andrewx-bu Nov 15, 2025
948d57b
feat: add pending screen allowing staff signups to continue using app…
andrewx-bu Nov 15, 2025
1f2d2f0
feat: sign up as student OR staff to onboarding
andrewx-bu Nov 15, 2025
fd6a792
refactor: share admin/staff admin & analytics screen
andrewx-bu Nov 15, 2025
ac15d72
feat: accept pending and list staff members in settings
andrewx-bu Nov 15, 2025
e9fb15f
chore: minor UI changes & auth refactoring in admin pages
andrewx-bu Nov 15, 2025
42458b9
fix: more guards/error handling and clear rbac cache on refresh
andrewx-bu Nov 15, 2025
33451df
fix: rbac-aware edit screens
andrewx-bu Nov 15, 2025
3d768b1
Merge pull request #43 from BU-Spark/feat/rbac-wireup
arnavSingh23 Nov 16, 2025
97ca8fa
chore: format with prettier
andrewx-bu Nov 16, 2025
7872c2b
chore: add gitattributes to enforce LF line endings across repo
andrewx-bu Nov 16, 2025
0320e14
fix: minor refactoring to fix ESLint errs
andrewx-bu Nov 16, 2025
bfebb23
ci: add workflow to run Expo lint on push and PR
andrewx-bu Nov 16, 2025
f2ae5c0
test: replace curl smoketest with jest e2e test
andrewx-bu Nov 17, 2025
6886908
ci: add rbac e2e ci pipeline
andrewx-bu Nov 17, 2025
85da302
fix: add err handling for clerk API and missing env vars
andrewx-bu Nov 17, 2025
760038a
chore: trigger ci workflow
andrewx-bu Nov 17, 2025
c721bfd
fix: correct env names in ci
andrewx-bu Nov 17, 2025
1f19497
chore: test ci
andrewx-bu Nov 17, 2025
a02146a
fix: revert mobile linter ci config
andrewx-bu Nov 17, 2025
d07970b
chore: add README to github workflows folder
andrewx-bu Nov 17, 2025
40151b1
docs: update README for class assignment
andrewx-bu Nov 17, 2025
4f206ce
fix: add logs and remove getToken from dependency array to prevent re…
andrewx-bu Nov 20, 2025
a82d1b6
chore: add simple index for redirect & debugging
andrewx-bu Nov 20, 2025
cb48c7a
Merge pull request #44 from BU-Spark/feat/ci-and-tests
arnavSingh23 Nov 21, 2025
dac7dba
feat: add Google Maps link to event addresses
Nov 24, 2025
d9edf1b
Merge pull request #45 from BU-Spark/feature/address-google-maps-link
arnavSingh23 Nov 25, 2025
5912b4a
fix: improve keyboard UX on sign-in/sign-up screens
abdallahkutbi Nov 29, 2025
ef54cd9
- Fix DateTimePicker visibility in dark mode for event editor
abdallahkutbi Nov 29, 2025
cb97469
added poster
Dec 2, 2025
97d40e3
Merge pull request #46 from BU-Spark/fix/keyboard_in_signin_stuck
arnavSingh23 Dec 2, 2025
4aa7143
Merge pull request #47 from BU-Spark/fix/dark_theme_fixes
arnavSingh23 Dec 2, 2025
5dab8cb
added poster + pics
Dec 2, 2025
95ebc9e
added names
NathanC0926 Dec 2, 2025
61ed7b0
added client pics
NathanC0926 Dec 2, 2025
fcef67b
added client and pm, tpm
Dec 2, 2025
3bc937d
updated project goal
Dec 2, 2025
776ba92
final version
Dec 5, 2025
bdbe052
added updates
Dec 5, 2025
56d2037
added final poster, in pdf form
Dec 6, 2025
730d185
added bug readmee
Dec 15, 2025
ff111fa
docs: move mobile-specific READMEs to mobile/. update mobile/README.
andrewx-bu Dec 15, 2025
6dfd743
chore: format files
andrewx-bu Dec 15, 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
29 changes: 29 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CI Workflows

This project uses **GitHub Actions** for continuous integration.

## Workflows Included

- **Mobile Lint**
Runs ESLint in the `mobile/` app directory to enforce code quality and catch errors early.

- **Backend RBAC E2E**
Runs Jest end-to-end tests in `backend/` to verify secure role-based access control.

## How They Run

| Workflow | Trigger |
|---------|---------|
| Mobile Lint | Push to `main` / `dev` + all pull requests |
| Backend RBAC E2E | Push to `main` / `dev` or manual trigger |

## Challenges

- Ensuring proper working directories for monorepo structure (Fixed using `defaults.run.working-directory`)
- Performance during installs (Fixed by caching Node dependency installs)

## In the Future

As we add more testing suites, we will expand our CI pipeline accordingly.

We plan to include full mobile end-to-end testing using [Detox](https://wix.github.io/Detox/) to ensure the entire app behaves correctly on real devices (soon!).
5 changes: 2 additions & 3 deletions .github/workflows/add_collaborators.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Author: Rishab
# Author: Rishab
name: Add Collaborators v1.1

on:
on:
push:
branches:
- master
Expand Down Expand Up @@ -48,4 +48,3 @@ jobs:

}
});

36 changes: 36 additions & 0 deletions .github/workflows/backend-rbac-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Backend RBAC E2E

on:
push:
branches: [main, dev, feat/ci-and-tests]
workflow_dispatch:

jobs:
rbac-e2e:
runs-on: ubuntu-latest

defaults:
run:
working-directory: backend

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: backend/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run RBAC E2E Jest tests
env:
BASE: ${{ secrets.BASE }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
STUDENT_ID: ${{ secrets.STUDENT_ID }}
ADMIN_ID: ${{ secrets.ADMIN_ID }}
run: npm test
31 changes: 31 additions & 0 deletions .github/workflows/mobile-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Mobile Lint

on:
push:
branches: [main, dev]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest

defaults:
run:
working-directory: mobile

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: mobile/package-lock.json

- name: Install dependencies
run: npm ci

- name: Lint with ESLint (Expo)
run: npm run lint
8 changes: 4 additions & 4 deletions .github/workflows/release_archive.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Archive Repository into Release v1.0
on:
on:
push:
tags:
- "spark-archive-*"
- 'spark-archive-*'
jobs:
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
name: 'Tagged Release'
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

*.log
.firebase-data/


# Jetbrains Products
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
Expand Down Expand Up @@ -206,3 +208,7 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
node_modules



.expo/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
93 changes: 93 additions & 0 deletions DATABASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Firestore Data Model

This project stores application data in Google Cloud Firestore using a document-oriented (NoSQL) schema. The collections listed below are derived from the application's forms, utilities, and data-fetching logic and describe the shape of the documents the frontend expects.

## Collections and Documents

### `Users`

Each document is stored at `Users/{uid}` where the document ID matches the Firebase Authentication user ID. User documents are created on first sign-in and updated through the account settings and terms & conditions flows.

| Field | Type | Description |
| --------------- | ------------------- | ------------------------------------------------------------------------------------------- |
| `uid` | `string` | Firebase Authentication UID; also used as the document ID. |
| `email` | `string` | User email address sourced from authentication or edited later. |
| `name` | `string` | Display name captured at sign-up and editable in account settings. |
| `role` | `"User" \| "Admin"` | Determines access to admin-only event management screens. |
| `events` | `string[]` | Event IDs created by the user; maintained when publishing, copying, or deleting events. |
| `reviews` | `string[]` | Event IDs the user has reviewed; updated after submitting feedback. |
| `locPref` | `string[]` | Preferred campus sections used to filter event notifications (e.g., `"East"`, `"Central"`). |
| `timePref` | `string[]` | Reserved for notification time preferences (currently stored but unused). |
| `foodPref` | `string[]` | Reserved for dietary preferences (currently stored but unused). |
| `agreedToTerms` | `boolean` | Tracks whether the user accepted the program terms; required before accessing events. |

### `Events`

Event documents live at `Events/{eventId}` where `eventId` is generated by Firestore. Documents are created via the admin event form and updated through the event management actions.

| Field | Type | Description |
| ----------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `id` | `string` | Stored copy of the Firestore document ID for convenient lookups and client-side routing. |
| `host` | `string` | Hosting department or organization name. |
| `name` | `string` | Event title displayed across listings and detail views. |
| `Location` | `object` | Structured location with map metadata; see [Location object](#location-object). |
| `locationDetails` | `string` | Additional pickup instructions shown on the event page. |
| `notes` | `string` | Extra comments about the food or logistics. |
| `duration` | `number` (minutes) | Pickup window length derived from the time picker (stored as minutes even though the type is declared as string). |
| `foodArrived` | `Timestamp` | When food first became available; controls validation limits for pickup timing. |
| `foodAvailable` | `Timestamp` | Pickup start time displayed in event cards and previews. |
| `foods` | `FoodItem[]` | Array of food entries including quantity, unit, and item name. |
| `status` | `"drafted" \| "saved" \| "open" \| "closed"` | Workflow state toggled by publishing and ending events. |
| `images` | `string[]` | Up to three Firebase Storage download URLs representing event photos. |
| `reviewedBy` | `string[]` | User IDs that already submitted feedback; prevents duplicate reviews. |

Events reference the creating admin via the `Users/{uid}.events` array and are filtered client-side to show only `status === "open"` when listing public events.

#### Location object

The `Location` embedded object standardizes site-wide geocoding details used in filters and maps.

| Field | Type | Notes |
| -------------------- | --------- | ---------------------------------------------------------------------------- |
| `name` | `string` | Human-readable location name (defaults to "BU Campus"). |
| `address` | `string` | Full address displayed to users and in map popups. |
| `abbreviation` | `string` | Short label shown alongside `locationDetails`. |
| `lat` / `lon` | `string` | Latitude and longitude stored as strings, parsed when rendering maps. |
| `campus_section` | `string` | Campus region used for filtering and preference chips (e.g., East, Central). |
| `abbreviatedAddress` | `string?` | Optional shortened label when provided. |

### `Reviews/{eventId}/Reviews`

Feedback is organized under a top-level `Reviews` collection where each event ID has its own document containing a nested `Reviews` subcollection. Submissions append documents to `Reviews/{eventId}/Reviews/{reviewId}` with the following fields.

| Field | Type | Description |
| -------------- | ----------- | ----------------------------------------------------------------------------------- |
| `id` | `string` | Stored review document ID for client rendering. |
| `comment` | `string` | Participant feedback message (required). |
| `date` | `Timestamp` | Submission timestamp used for ordering newest-first. |
| `images` | `string[]` | Optional Firebase Storage download URLs; limited to three via the upload component. |
| `shareContact` | `boolean` | Indicates whether contact information can be shared with admins. |
| `name` | `string` | Reviewer name collected only when `shareContact` is true. |
| `email` | `string` | Reviewer email collected only when `shareContact` is true. |

Submitting feedback also updates `Users/{uid}.reviews` and `Events/{eventId}.reviewedBy` arrays to reflect participation.

## Media Storage

Event and review images are uploaded to Firebase Storage under `events/images/` or `reviews/images/`. Download URLs are stored directly in `images` arrays, and users can manage up to three images per record.

## Query & Index Considerations

The frontend issues several Firestore queries that influence indexing strategy:

- Event listings order by `foodAvailable` descending and filter client-side by `status === "open"`. Ensure a single-field index on `foodAvailable` exists (Firestore creates it automatically).
- Admin dashboards query events with `where("id", "in", user.events)` combined with `orderBy("foodAvailable", "desc")`; this requires a composite index on `(id asc, foodAvailable desc)` for best performance.
- Reviews are ordered by `date` within each `Reviews/{eventId}/Reviews` subcollection to show recent feedback first.

## Relationships Summary

- Users own events through the `events` array and must have `role === "Admin"` to create or manage them.
- Participants mark event attendance by submitting feedback, which updates both the user's `reviews` list and the event's `reviewedBy` list to prevent duplicate submissions.
- Access to event listings is gated by the `agreedToTerms` flag; users are redirected to accept terms before seeing live events.

This document should serve as a reference when adding new fields or updating Firestore security rules so that the client and backend remain in sync.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![Netlify Status](https://api.netlify.com/api/v1/badges/589b5f54-8e95-4ceb-950f-262659a1bc4c/deploy-status)](https://app.netlify.com/sites/bu-sustainability-leftovers/deploys)

# BU Sustainability Catering Leftovers

## Overview

The BU Leftover Catering application is a solution aimed at reducing food waste on campus by facilitating the redistribution of leftover food from catering events within the specified time constraints.

## Core Features
Expand All @@ -12,6 +14,7 @@ The BU Leftover Catering application is a solution aimed at reducing food waste
4. Tracking and Analytics: Tracks metrics such as reduced waste volume, types of food claimed, number of people engaged, speed of food pick-ups, and remaining food.

## Getting Started

```bash
git clone https://github.com/yourgithubusername/se-bu-catering-leftovers.git (or download the entire project to your desktop by pressing the green "code" button and selecting "Download ZIP")
cd se-bu-catering-leftovers
Expand All @@ -28,24 +31,27 @@ Sensitive keys and tokens are not stored wihtin the repository for security reas
This project was done on React with Next.js. MUI Materials is the main UI framework, and Google Cloud Firestore and Storage systems were utilized. Further, openStreetMaps for the mapping feature was empoyed.

### Tech Stack

The frontend of this project is built using React alongside Next.js. The primary UI framework utilized is MUI Materials. For additional styling, Styled-components and MUI Material Styles are implemented.

On the backend, Firebase Firestore serves as the database and Firebase Storage is used for storage. User authentication is managed through Firebase Auth, which includes integration with Google OAuth for user login processes. Custom API routes are handled within the Next.js framework and are detailed in the `src/pages/api/` directory.

For third-party services and APIs Google Cloud's Firestore and Storage are used for backend data management and file storage, and OpenStreetMaps is utilized for geographic mapping for locating events on campus.

## Known issues
* Google Auth issues on the deployed version if popups are blocked on browser.
* A more secure way of registering admins is suggested, particularly a changing, potentially one-time use, token, or any other better-suited alternative.
* Google Cloud Storage rules should be modified accordingly to only allow authenticated members its use.
* Swipeable images component on the event preview is optimized for phone use and is hard to maneuver on PC.


- Google Auth issues on the deployed version if popups are blocked on browser.
- A more secure way of registering admins is suggested, particularly a changing, potentially one-time use, token, or any other better-suited alternative.
- Google Cloud Storage rules should be modified accordingly to only allow authenticated members its use.
- Swipeable images component on the event preview is optimized for phone use and is hard to maneuver on PC.

## Future Improvements
* Managing storage: A function that automatically deletes events/images after a certain amount of time could be implemented to save storage.
* Events can't currently be deleted within the app, only closed.
* A notifications page to view new feedback could be implemented for a better user experience on the admin side.
* Email notifications: The component was created but it couldn't be tested as an official email wasn't provided and the security of sendGrid didn't allow the use of any email for testing purposes.

- Managing storage: A function that automatically deletes events/images after a certain amount of time could be implemented to save storage.
- Events can't currently be deleted within the app, only closed.
- A notifications page to view new feedback could be implemented for a better user experience on the admin side.
- Email notifications: The component was created but it couldn't be tested as an official email wasn't provided and the security of sendGrid didn't allow the use of any email for testing purposes.

## Deployment

To view our project deployed checkout: [https://bu-sustainability-leftovers.netlify.app/](https://testing--bu-sustainability-leftovers.netlify.app/)
7 changes: 7 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Clerk Config
CLERK_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# API Base URL
BASE=https://your-project.vercel.app
# Test User IDs (from Clerk Dashboard)
STUDENT_ID=user_xxxxxxxxxxxxxxxxxxxxx
ADMIN_ID=user_xxxxxxxxxxxxxxxxxxxxx
6 changes: 6 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.vercel
.env
.env.local
dist
*.log
Loading
Loading