Fix #150: Show linked project on post details page and expose in API #151
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "typosaurus/ticket-150"
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?
Resolves #150.
Plan
Implementation Plan: Show Linked Project on Post Details Page & Expose in API
1. Add
project_uidtoPostOutschemaFile:
devplacepy/schemas/content.py(lines 75–85)project_uid: Optional[int] = Nonefield toPostOutclass._Outbase if listed; add explicit field).2. Create a project resolution helper
File:
devplacepy/templating.py(or a new utility module)get_project_by_uid(project_uid: int) -> Optional[dict]that queries theprojectstable foruid,name,slug.uid,name,slug,url(constructed using existing project detail route, e.g.,url_for('project.view', slug=slug)).3. Update
PostDetailOutandFeedItemOutschemasFiles:
devplacepy/schemas/listings.pyproject: Optional[dict] = Nonefield to bothPostDetailOutandFeedItemOut.uid,name,url.4. Wire project info into
load_detail()anddetail_context()File:
devplacepy/content.pyload_detail(line ~654): after loading the post, ifpost.project_uidis set, callget_project_by_uid()and addprojectto the returned dict.detail_context(line ~492): pass theprojectdict fromload_detailinto the context.5. Wire project info into feed
enrich_items()File:
devplacepy/content.py(line ~697)enrich_items, if the post has a non‑noneproject_uid, resolve the project info via the helper and attach it to the item’sprojectfield (or to thePostOutequivalent in the feed item).6. Update post detail template
File:
devplacepy/templates/posts/detail.html(or similar)7. Update feed card template (optional but consistent)
File:
devplacepy/templates/feed/_card.htmlor similar8. Expose project in DevRant API
File:
devplacepy/services/devrant/serializers.py(line ~46)serialize_rantto includeproject_uidand aprojectdict (uid, name, url) when the rant’sproject_uidis set.routers/devrant/rants.pyline 98) to respect the incomingproject_uidfrom the request (currently hardcodedNone). The form data already carries it; pass it through.9. Add test coverage
Files:
tests/api/posts/create.pytests/api/posts/detail.py(new or existing)tests/api/devrant/rants.pytests/e2e/posts/detail.pyChanges:
project_uid(create a project first or use a seeded one).projectinfo when the post has a linked project.projectdata.10. (Optional) Add
project_uidto edit routeFile:
devplacepy/routers/posts.pyline 231–235project_uidto the list of updatable fields inedit_post. This fills a gap identified in the investigation but is not strictly required by the ticket.Definition of Done
PostOutschema includesproject_uidfield.PostDetailOutandFeedItemOutschemas include an optionalprojectdict (uid,name,url).get_project_by_uid()exists and resolves project info correctly.load_detail()returns project info anddetail_context()passes it to the template.serialize_rantincludesproject_uidandprojectdict.project_uid: None– it passes the incoming value.pip install -e '.[dev]' -q && python -m pytest {test_files}passes (where{test_files}includes all relevant test files, e.g.,tests/api/ tests/e2e/ tests/units/).Opened automatically by Typosaurus.
Checkout
From your project repository, check out a new branch and test the changes.