You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(api): correctly serialize nested objects for db insertion
When creating new headlines or sources, the API was failing with a
database error because it tried to insert nested `source`, `category`,
and `headquarters` objects directly into the database. The database
schema expects flattened foreign key columns (`source_id`, `category_id`,
`headquarters_country_id`).
This fix updates the `toJson` functions provided during the setup of
the `headlineRepository` and `sourceRepository` in `AppDependencies`.
These custom functions now correctly flatten the nested objects into
their respective ID fields before the data is sent to the database
client, resolving the "column does not exist" error.
0 commit comments