feat(blog): add city_id to blogs for city-specific scoping
- Introduced a new nullable city_id column in the blogs table to allow scoping of blog posts to specific cities. - Updated Blog entity to include a ManyToOne relationship with the City entity. - Enhanced BlogController to handle city_id in the request, allowing filtering of posts by city. - Modified BlogRepository to support querying published posts based on city_id. - Added tests to ensure correct behavior for city-scoped and nationwide posts, including creation and updating of posts with city associations.
This commit is contained in:
@@ -16,9 +16,13 @@ import { api } from '@/lib/api';
|
||||
import BlogFormPage from '@/pages/BlogFormPage';
|
||||
|
||||
const post = api.post as ReturnType<typeof vi.fn>;
|
||||
const get = api.get as ReturnType<typeof vi.fn>;
|
||||
|
||||
beforeEach(() => {
|
||||
post.mockReset();
|
||||
// فرم شهرها را برای انتخابگر «سراسری / شهر» میگیرد
|
||||
get.mockReset();
|
||||
get.mockResolvedValue({ data: [], meta: { totalRecords: 0, totalPages: 0, currentPage: 1 } });
|
||||
});
|
||||
|
||||
describe('BlogFormPage — اعتبارسنجی zod (حالت ساخت)', () => {
|
||||
|
||||
Reference in New Issue
Block a user