Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Phase 1 - Relations service (internal): owns ContainerRelation, exposes get-children data + attach/detach-child actions. Retargeted events, blog, market callers from cart to relations. Phase 2 - Likes service (internal): unified Like model replaces ProductLike and PostLike with generic target_type/target_slug/target_id. Exposes is-liked, liked-slugs, liked-ids data + toggle action. Phase 3 - PageConfig → blog: moved ownership to blog with direct DB queries, removed proxy endpoints from cart. Phase 4 - Orders service (public): owns Order/OrderItem + SumUp checkout flow. Cart checkout now delegates to orders via create-order action. Webhook/return routes and reconciliation moved to orders. Phase 5 - Infrastructure: docker-compose, deploy.sh, Dockerfiles updated for all 3 new services. Added orders_url helper and factory model imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
from ...blog.ghost_db import DBClient # adjust import path
|
|
from shared.infrastructure.data_client import fetch_data
|
|
from quart import g
|
|
|
|
async def post_data(slug, session, include_drafts=False):
|
|
client = DBClient(session)
|
|
posts = (await client.posts_by_slug(slug, include_drafts=include_drafts))
|
|
|
|
if not posts:
|
|
# 404 page (you can make a template for this if you want)
|
|
return None
|
|
post, original_post = posts[0]
|
|
|
|
# Check if current user has liked this post
|
|
is_liked = False
|
|
if g.user:
|
|
liked_data = await fetch_data("likes", "is-liked", params={
|
|
"user_id": g.user.id, "target_type": "post", "target_id": post["id"],
|
|
}, required=False)
|
|
is_liked = (liked_data or {}).get("liked", False)
|
|
|
|
# Add is_liked to post dict
|
|
post["is_liked"] = is_liked
|
|
|
|
tags=await client.list_tags(
|
|
limit=50000
|
|
) # <-- new
|
|
authors=await client.list_authors(
|
|
limit=50000
|
|
)
|
|
|
|
return {
|
|
"post": post,
|
|
"original_post": original_post,
|
|
"tags": tags,
|
|
"authors": authors,
|
|
}
|