Saving an event returns 500 for a second user, a repeat save, or no google_event_id #35
Labels
No labels
bug
chore
data
feature
frontend
good first issue
intermediate
needs/docs
needs/research
needs/upstream
type/bug
type/external
type/feature
type/refactor
urgency
high
urgency
immediate
urgency
low
urgency
medium
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ScottyLabs/cal#35
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's wrong
POST /api/events/user_saved_eventsinserts aUserSavedEventwithgoogle_event_id=data["google_event_id"]. That column is NOT NULL and globally UNIQUE (user_saved_events_google_event_id_key), and the web client fills it with the CMUCal event id (web/src/context/EventStateContext.tsxL104-107, marked TODO). Results:google_event_idraises KeyError: 500;event_idviolates the foreign key on Postgres: 500.The web client swallows the error, so the event looks saved but is not stored. Nothing reads
UserSavedEvent.google_event_id; Google sync is tracked insynced_events.How to reproduce
In a test, POST
{"event_id": <id>, "google_event_id": "<id>"}asALICE, then the same body asBOB: the second call returns 500. POST withoutgoogle_event_id: 500.Expected
google_event_idis optional; an unknown event returns 404.Where to look
api/app/api/events.pyuser_save_event()(L915-934).api/app/models/models.pyclass UserSavedEvent; new Alembic migration inapi/migrations/versions/to make the column nullable and drop the global unique constraint.2c5f2e9.Done when
api/tests/api/test_user_saved_events.py: two users save one event, a repeat save, nogoogle_event_id, an unknown eventgoogle_event_id