Add organization pages #28

Open
opened 2026-10-03 19:44:36 +00:00 by jalenluorion · 0 comments
Member

Goal
Clubs have no home on CMUCal. Add /orgs/[id] pages with the club's name, description, and upcoming events, and make club names on event cards link there.

What you'll learn
A full-stack feature: a Flask route with a SQLAlchemy query, and a Next.js page that calls it.

Resources

Where to start

  • api/app/api/organizations.py, get_organization_data (GET /api/organizations/org/<id>, @public): returns name, type, categories, and every occurrence grouped by category, but no description and no date filter. Reuse its active-calendar-source filter.
  • Add GET /api/organizations/<int:org_id>/summary, marked @public, returning name, description, type, and the next 20 EventOccurrence rows with start_datetime >= now, ordered by start, filtered and limited in SQL.
  • api/app/api/events.py, get_all_events: Explore results only have org_id. Add Organization.name as org_name (the query already joins Event.org).
  • web/src/app/orgs/[id]/page.tsx: new page. Add a client helper in web/src/app/utils/api/organizations.ts.
  • web/src/app/components/SearchResultSidebar.tsx and EventPopover.tsx: link the org name with next/link.

Done when

  • /orgs/<id> shows name, description, and upcoming events, with an empty state when there are none
  • Unknown ids show "Organization not found"
  • Org names on Explore results and in the popover link to the org page
  • A pytest covers the new route (past events excluded, sorted by start)
  • Works in light and dark mode

Notes
Do not reuse GET /api/events/by_org/<id>. It reads ev.all_day and ev.updated_at, which do not exist on Event, so it fails whenever an org has events. With the tag filter, get_all_events groups by Event.id, so add Organization.id to that group_by when you select the name.

**Goal** Clubs have no home on CMUCal. Add `/orgs/[id]` pages with the club's name, description, and upcoming events, and make club names on event cards link there. **What you'll learn** A full-stack feature: a Flask route with a SQLAlchemy query, and a Next.js page that calls it. **Resources** - [Flask quickstart (routing)](https://flask.palletsprojects.com/en/stable/quickstart/) - [SQLAlchemy ORM query guide](https://docs.sqlalchemy.org/en/20/orm/queryguide/index.html) - [Next.js dynamic routes](https://nextjs.org/docs/app/api-reference/file-conventions/dynamic-routes) **Where to start** - `api/app/api/organizations.py`, `get_organization_data` (`GET /api/organizations/org/<id>`, `@public`): returns name, type, categories, and every occurrence grouped by category, but no description and no date filter. Reuse its active-calendar-source filter. - Add `GET /api/organizations/<int:org_id>/summary`, marked `@public`, returning `name`, `description`, `type`, and the next 20 `EventOccurrence` rows with `start_datetime >= now`, ordered by start, filtered and limited in SQL. - `api/app/api/events.py`, `get_all_events`: Explore results only have `org_id`. Add `Organization.name` as `org_name` (the query already joins `Event.org`). - `web/src/app/orgs/[id]/page.tsx`: new page. Add a client helper in `web/src/app/utils/api/organizations.ts`. - `web/src/app/components/SearchResultSidebar.tsx` and `EventPopover.tsx`: link the org name with `next/link`. **Done when** - [ ] `/orgs/<id>` shows name, description, and upcoming events, with an empty state when there are none - [ ] Unknown ids show "Organization not found" - [ ] Org names on Explore results and in the popover link to the org page - [ ] A pytest covers the new route (past events excluded, sorted by start) - [ ] Works in light and dark mode **Notes** Do not reuse `GET /api/events/by_org/<id>`. It reads `ev.all_day` and `ev.updated_at`, which do not exist on `Event`, so it fails whenever an org has events. With the tag filter, `get_all_events` groups by `Event.id`, so add `Organization.id` to that `group_by` when you select the name.
jalenluorion added this to the Phase 2 milestone 2026-10-03 19:44:36 +00:00
jalenluorion added this to the CMUCal project 2026-10-03 19:45:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/cal#28
No description provided.