Repository navigation
Conversation
|
Thanks for putting this together, and for your interest in improving the API. I'm not inclined to merge this at this time, for a few reasons:
If we plan a v2 of the API, we can look at including the series image then, since it could be designed with that kind of use in mind from the start. I appreciate the effort here, and I'm sorry this one doesn't fit right now. P.S. I noticed you're based in Columbus, Ohio. It's nice to see a contributor from here! |
|
@bpepple Thanks for the thorough explanation, that all makes sense, especially the bandwidth situation. I'll close this out. If a v2 gets planned, I'd be glad to help with the series image design. And good to meet a fellow Columbus-area dev. |
Closes #443
Description
/series/,/series/{id}/and/publisher/{id}/series_list/now return animageURL.image, that is used.cover_date,store_date,number,id).nullif there is no cover.Serieshas no image field today, so for now every value comes from the fallback. The precedence check is there so a dedicated image can be added later without changing the API.How
SeriesImageMixininapi/v1_0/serializers/series.pyadds a read-onlyimagefield toSeriesListSerializerandSeriesSerializer(soSeriesReadSerializerinherits it). Because it is aSerializerMethodField, the write path is unaffected.api/views.pyadds afirst_issue_imagesubquery, annotated on the series list, series retrieve and publisherseries_listquerysets, so there is no per-row query. If the annotation is missing, the serializer falls back toSeries.first_issue_cover().ModelLabel.ISSUEis added to the seriescache_detail_dependent_labels, so a cached detail response does not keep a stale cover after an issue changes. The list view already depended on it.Tests
Added to
tests/comicsdb/test_api_series.py: null cases, detail and list fallback, publisher series list, no per-row queries, dedicated image precedence, and the unannotated serializer path.I could not run the test suite locally (no Postgres available), so CI is the first real run.
ruff checkandruff format --checkpass. The query-count test is a relative comparison and may need adjusting.Checklist
pytest). Not run, no Postgres available to me; relying on CI.ruff checkandruff format --check)