Conversation
Backend Test ResultsTest Summary ✅
Coverage
|
There was a problem hiding this comment.
Pull request overview
This PR updates the data model and API so event occurrences no longer carry their own location_id, and instead location is associated with the organization (and intended to be required there). It also regenerates the frontend API client/types and updates backend SQL, handlers, and tests accordingly.
Changes:
- Drop
event_occurrence.location_idand update queries to resolve location viaevent -> organization -> location. - Make organization
location_idnon-optional in backend models/handlers and update related tests/utilities. - Regenerate/update frontend API client code and OpenAPI schema to reflect updated event occurrence inputs.
Reviewed changes
Copilot reviewed 31 out of 46 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/packages/api-client/src/generated/skillSparkAPI.schemas.ts | Regenerated API schemas (includes event occurrence location removal and additional review schema changes). |
| frontend/packages/api-client/src/generated/schools/schools.ts | Regenerated query client wrapper formatting/typing. |
| frontend/packages/api-client/src/generated/saved/saved.ts | Regenerated query/mutation client wrapper formatting/typing. |
| frontend/packages/api-client/src/generated/managers/managers.ts | Regenerated query/mutation client wrapper formatting/typing. |
| frontend/packages/api-client/src/generated/locations/locations.ts | Regenerated query/mutation client wrapper formatting/typing. |
| frontend/packages/api-client/src/generated/health/health.ts | Regenerated query client wrapper formatting/typing. |
| frontend/packages/api-client/src/generated/guardians/guardians.ts | Regenerated query/mutation client wrapper formatting/typing. |
| frontend/packages/api-client/src/generated/events/events.ts | Regenerated events client; event occurrence endpoints remain but payload types align with schema regen. |
| frontend/packages/api-client/src/generated/auth/auth.ts | Regenerated auth mutation wrappers formatting/typing. |
| backend/internal/supabase/seed/09_event_occurrence.sql | Seed update removing location_id from event_occurrence inserts. |
| backend/internal/supabase/migrations/20260324155444_event-location-update.sql | Migration dropping event_occurrence.location_id. |
| backend/internal/storage/postgres/schema/organization/util.go | Test helper now creates a location and sets organization.location_id. |
| backend/internal/storage/postgres/schema/organization/update_test.go | Tests updated for required org location_id and updated location assertions. |
| backend/internal/storage/postgres/schema/organization/update.go | Fix assignment to match non-pointer Organization.LocationID. |
| backend/internal/storage/postgres/schema/organization/sql/get_by_organization_id.sql | Query updated to join org and derive location via org. |
| backend/internal/storage/postgres/schema/organization/delete_test.go | Tests updated to create org with a location. |
| backend/internal/storage/postgres/schema/organization/create_test.go | Tests updated for required org location_id and non-pointer assertions. |
| backend/internal/storage/postgres/schema/event/sql/get_by_event_id.sql | Query updated to derive location via org (currently contains a SQL syntax issue). |
| backend/internal/storage/postgres/schema/event-occurrence/util.go | Test helper no longer creates/sets event_occurrence.location_id. |
| backend/internal/storage/postgres/schema/event-occurrence/update_test.go | Tests updated to remove location_id update/assertions. |
| backend/internal/storage/postgres/schema/event-occurrence/update.go | Repository update no longer passes location_id into SQL. |
| backend/internal/storage/postgres/schema/event-occurrence/sql/update.sql | SQL update no longer updates/returns location_id; joins location via org. |
| backend/internal/storage/postgres/schema/event-occurrence/sql/get_by_id.sql | Query updated to join org and derive location via org. |
| backend/internal/storage/postgres/schema/event-occurrence/sql/get_all.sql | Query updated to join org and derive location via org. |
| backend/internal/storage/postgres/schema/event-occurrence/sql/create.sql | Insert/return updated to exclude location_id; joins location via org. |
| backend/internal/storage/postgres/schema/event-occurrence/get_by_id_test.go | Tests updated to remove location assertions. |
| backend/internal/storage/postgres/schema/event-occurrence/delete_test.go | Tests updated to remove location from create inputs. |
| backend/internal/storage/postgres/schema/event-occurrence/create_test.go | Tests updated to remove location from create inputs/assertions. |
| backend/internal/storage/postgres/schema/event-occurrence/create.go | Repository create no longer passes location_id into SQL. |
| backend/internal/service/routes/organizations.go | Route now passes non-pointer LocationID into create body. |
| backend/internal/service/routes/organization_routes_test.go | Route tests updated for required org location and new expectations. |
| backend/internal/service/routes/event_occurrences_routes_test.go | Validation tests updated to remove event occurrence location_id usage/mocking. |
| backend/internal/service/handler/organization/handler_test.go | Handler tests updated for required org location and new expectations. |
| backend/internal/service/handler/organization/createOrganization.go | Handler now always validates location_id existence (no nil-check). |
| backend/internal/service/handler/event-occurrence/update.go | Removes location FK existence check for event occurrence updates. |
| backend/internal/service/handler/event-occurrence/handler_test.go | Handler tests updated to remove location inputs/assertions. |
| backend/internal/service/handler/event-occurrence/create.go | Removes location FK existence check for event occurrence creates. |
| backend/internal/models/organization.go | Organization and create body updated to make location_id non-optional. |
| backend/internal/models/event_occurrence.go | Removes location_id from create/update event occurrence inputs. |
| backend/api/openapi.yaml | OpenAPI updated to remove location_id from event occurrence schemas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type CreateOrganizationBody struct { | ||
| Name string `json:"name" minLength:"1" maxLength:"255" doc:"Organization name"` | ||
| Active *bool `json:"active,omitempty" doc:"Active status (defaults to true)"` | ||
| LocationID *uuid.UUID `json:"location_id,omitempty" format:"uuid" doc:"Associated location ID"` | ||
| Name string `json:"name" minLength:"1" maxLength:"255" doc:"Organization name"` | ||
| Active *bool `json:"active,omitempty" doc:"Active status (defaults to true)"` | ||
| LocationID uuid.UUID `json:"location_id" format:"uuid" doc:"Associated location ID"` | ||
| } |
There was a problem hiding this comment.
CreateOrganizationBody.LocationID is now non-optional, but the multipart form structs (CreateOrganizationFormData / UpdateOrganizationFormData) still don't mark location_id as required. That means requests could omit it and end up with a zero UUID, producing a less clear "location does not exist" error instead of a validation error, and the generated OpenAPI may not mark it as required. Consider adding required:"true" (and any other relevant validation) to the form field and regenerating the OpenAPI/client.
backend/internal/storage/postgres/schema/event/sql/get_by_event_id.sql
Outdated
Show resolved
Hide resolved
backend/internal/supabase/migrations/20260324155444_event-location-update.sql
Outdated
Show resolved
Hide resolved
backend/internal/storage/postgres/schema/event-occurrence/sql/get_all.sql
Outdated
Show resolved
Hide resolved
backend/internal/storage/postgres/schema/organization/sql/get_by_organization_id.sql
Outdated
Show resolved
Hide resolved
…t_id.sql Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…illspark into event-location-fix
…by_organization_id.sql Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…get_all.sql Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Backend Test ResultsTest Summary ✅
Coverage
|
3 similar comments
Backend Test ResultsTest Summary ✅
Coverage
|
Backend Test ResultsTest Summary ✅
Coverage
|
Backend Test ResultsTest Summary ✅
Coverage
|
moving location from events to orgs, making location required for orgs