feat(blog): add city_id query parameter to blog detail endpoint for domain scoping

This commit is contained in:
hamed
2026-07-24 10:01:30 +03:30
parent e766407bd1
commit c729bb13e0
3 changed files with 85 additions and 4 deletions
+9 -2
View File
@@ -90,7 +90,14 @@ Get a single blog post by slug.
### Path Parameters
| Param | Type | Description |
|-------|------|-------------|
| `slug` | string | URL slug (e.g. `ashnayi-ba-bimari-diabat`) |
| `slug` | string | URL slug (e.g. `ashnayi-ba-bimari-diabat`) or UUID |
### Query Parameters
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| `city_id` | int | ❌ | Domain scope of the caller. Same rule as `GET /api/v1/blogs?city_id=…`: the post is returned only when it belongs to this city **or** is nationwide (`city IS NULL`). A post owned by another city — including a post assigned to the root record `نوبت 724` (id `600`) — returns **404**. Omit on the main domain (`nobat724.com`) to read any post. |
> بدون این پارامتر، پستی که از لیستِ یک دامنه فیلتر شده بود همچنان با URL مستقیم روی همان دامنه ۲۰۰ می‌گرفت و یک محتوا روی چند دامنه تکرار می‌شد. سایت عمومی (`nobat724_front`) روی دامنه‌های شهری همیشه `city_id` را می‌فرستد.
### Response `200`
```json
@@ -115,7 +122,7 @@ Get a single blog post by slug.
### Errors
| Code | HTTP | Description |
|------|------|-------------|
| `ERR_NOT_FOUND_001` | 404 | Blog not found or not published |
| `ERR_NOT_FOUND_001` | 404 | Blog not found, not published, or owned by another city (when `city_id` is sent) |
---