Repository navigation
feat(catalog): add GET /v1/catalogs/{id} - #16038
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Adds a new authenticated GET /v1/catalogs/{id} endpoint returning catalog version, products, and neighboring version IDs, plus generated client updates. Because this adds API surface/contract, a human should sign off on the endpoint design and exposure.
View guided diff | Turn on auto-fix | Re-trigger cubic
fbb10e2 to
bd4ef22
Compare
14a44ac to
d4df9cb
Compare
Returns one catalog version with its products and the IDs of the versions published before and after it, so the dashboard can show a version page and step between versions.
…/{id}
Neighbors depend on the list ordering and change whenever a new version is
published. The dashboard can find them from the list endpoint.
d4df9cb to
f9824ae
Compare
…on-endpoint Co-authored-by: Villiam Strandh <villiam.strandh@outlook.com> # Conflicts: # clients/packages/client/src/v1.ts # server/polar/catalog/schemas.py
| return relationship("Catalog", remote_side="Catalog.id", lazy="raise") | ||
|
|
||
| @declared_attr | ||
| def products(cls) -> Mapped[list["CatalogProduct"]]: |
There was a problem hiding this comment.
Mmm Product.catalog already exists and Catalog.products can be read as the inverse of the first one. This returns a CatalogProduct and it's not the same type. I think it's better to find a better name for this, maybe members as we already use it in the publish ?
There was a problem hiding this comment.
Yeah very good call! Renamed it to product_members. So that we later can also have benefit_members etc if I understand the design doc correctly?
There was a problem hiding this comment.
1 issue found across 6 files
Confidence score: 4/5
CatalogVersioninserver/polar/catalog/schemas.pyomits the successor ID, so clients can’t navigate to the next catalog version without listing all catalogs. Add the field and populate it in the endpoint or service.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/polar/catalog/schemas.py">
<violation number="1" location="server/polar/catalog/schemas.py:39">
P2: `CatalogVersion` omits the ID of the catalog version after this one. Add the successor ID to the response and populate it in the endpoint/service so clients can navigate both directions without listing all catalogs.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| product_id: UUID4 = Field(description="The product version in this catalog.") | ||
|
|
||
|
|
||
| class CatalogVersion(Catalog): |
There was a problem hiding this comment.
P2: CatalogVersion omits the ID of the catalog version after this one. Add the successor ID to the response and populate it in the endpoint/service so clients can navigate both directions without listing all catalogs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At server/polar/catalog/schemas.py, line 39:
<comment>`CatalogVersion` omits the ID of the catalog version after this one. Add the successor ID to the response and populate it in the endpoint/service so clients can navigate both directions without listing all catalogs.</comment>
<file context>
@@ -29,3 +29,17 @@ class Catalog(IDSchema, TimestampedSchema):
+ product_id: UUID4 = Field(description="The product version in this catalog.")
+
+
+class CatalogVersion(Catalog):
+ """A catalog version with its products."""
+
</file context>
We want a dashboard page for each catalog version, showing what was in it (#16039). There was no way to fetch a single version and its products, so this adds one.
GET /v1/catalogs/{id}(private) returns the catalog, its products, and the IDs of the versions before and after it.