feat(blog): complete full-stack blog module with rich text editor, SEO analyzer, JSON-LD schema, and RSS feed
Deploy Canina / deploy (push) Successful in 1m43s

This commit is contained in:
parsa aghaei committed 2026-08-24 16:48:31 +03:30
1 parent eb63d22ac4
commit 5705354429
23 files changed
+124946 -120969

No files matched your search

+73 -3
View File
@@ -34,14 +34,84 @@ export class BlogsController {
@ApiQuery({ name: 'page', required: false })
@ApiQuery({ name: 'limit', required: false })
@ApiQuery({ name: 'search', required: false })
async getBlogs(@Query() query: PaginationDto) {
@ApiQuery({ name: 'status', required: false })
@ApiQuery({ name: 'categoryId', required: false })
async getBlogs(
@Query() query: PaginationDto & { status?: string; categoryId?: string; tagId?: string },
) {
return this.blogsService.getBlogs(query);
}
@Get('authors')
@ApiOperation({ summary: 'لیست کاربران برای انتخاب به عنوان نویسنده' })
async getAuthors() {
const data = await this.blogsService.getAuthors();
return { success: true, data };
}
@Get('categories')
@ApiOperation({ summary: 'لیست دسته‌بندی‌های وبلاگ' })
async getBlogCategories() {
const data = await this.blogsService.getBlogCategories();
return { success: true, data };
}
@Post('categories')
@ApiOperation({ summary: 'ایجاد دسته‌بندی جدید برای وبلاگ' })
async createBlogCategory(@Body() body: Prisma.BlogCategoryCreateInput) {
const data = await this.blogsService.createBlogCategory(body);
return { success: true, data };
}
@Put('categories/:id')
@ApiOperation({ summary: 'ویرایش دسته‌بندی وبلاگ' })
async updateBlogCategory(
@Param('id') id: string,
@Body() body: Prisma.BlogCategoryUpdateInput,
) {
const data = await this.blogsService.updateBlogCategory(id, body);
return { success: true, data };
}
@Delete('categories/:id')
@ApiOperation({ summary: 'حذف دسته‌بندی وبلاگ' })
async deleteBlogCategory(@Param('id') id: string) {
await this.blogsService.deleteBlogCategory(id);
return { success: true };
}
@Get('tags')
@ApiOperation({ summary: 'لیست تگ‌های وبلاگ' })
async getBlogTags() {
const data = await this.blogsService.getBlogTags();
return { success: true, data };
}
@Post('tags')
@ApiOperation({ summary: 'ایجاد تگ جدید برای وبلاگ' })
async createBlogTag(@Body() body: { name: string; slug?: string }) {
const data = await this.blogsService.createBlogTag(body);
return { success: true, data };
}
@Delete('tags/:id')
@ApiOperation({ summary: 'حذف تگ وبلاگ' })
async deleteBlogTag(@Param('id') id: string) {
await this.blogsService.deleteBlogTag(id);
return { success: true };
}
@Get(':id')
@ApiOperation({ summary: 'دریافت مشخصات یک مقاله' })
async getBlogById(@Param('id') id: string) {
const data = await this.blogsService.getBlogById(id);
return { success: true, data };
}
@Post()
@ApiOperation({ summary: 'ایجاد مقاله جدید' })
async createBlog(
@Body() body: Prisma.BlogCreateWithoutAuthorInput,
@Body() body: any,
@Request() req: { user: { id: string } },
) {
const data = await this.blogsService.createBlog(body, req.user.id);
@@ -52,7 +122,7 @@ export class BlogsController {
@ApiOperation({ summary: 'ویرایش مقاله' })
async updateBlog(
@Param('id') id: string,
@Body() body: Prisma.BlogUpdateInput,
@Body() body: any,
) {
const data = await this.blogsService.updateBlog(id, body);
return { success: true, data };