feat: resolve doctors query error, add FAQ, testimonials, blog preview, and full menu management
Deploy Canina / deploy (push) Successful in 1m41s
Deploy Canina / deploy (push) Successful in 1m41s
This commit is contained in:
1 parent
70d58e7086
commit
2c452215c3
31 files changed
+1987
-76
No files matched your search
@@ -1,4 +1,14 @@
|
||||
import { Controller, Get, Param, HttpStatus, Query } from '@nestjs/common';
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Param,
|
||||
Body,
|
||||
HttpStatus,
|
||||
Query,
|
||||
UseGuards,
|
||||
Request,
|
||||
} from '@nestjs/common';
|
||||
import { BlogsService } from './blogs.service';
|
||||
import {
|
||||
ApiTags,
|
||||
@@ -6,8 +16,10 @@ import {
|
||||
ApiResponse,
|
||||
ApiOkResponse,
|
||||
ApiNotFoundResponse,
|
||||
ApiBearerAuth,
|
||||
} from '@nestjs/swagger';
|
||||
import { PaginationDto } from '../common/dto/pagination.dto';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
|
||||
@ApiTags('Blogs - مجله سلامت')
|
||||
@Controller('blogs')
|
||||
@@ -25,6 +37,13 @@ export class BlogsController {
|
||||
return this.blogsService.findAll(query);
|
||||
}
|
||||
|
||||
@Get('homepage')
|
||||
@ApiOperation({ summary: 'دریافت مقالات برای نمایش در صفحه اصلی' })
|
||||
@ApiOkResponse({ description: 'مقالات انتخاب شده برای صفحه اصلی' })
|
||||
findHomepage() {
|
||||
return this.blogsService.findHomepage();
|
||||
}
|
||||
|
||||
@Get(':slug')
|
||||
@ApiOperation({ summary: 'دریافت مقاله با اسلاگ (Slug)' })
|
||||
@ApiOkResponse({ description: 'اطلاعات کامل مقاله' })
|
||||
@@ -32,4 +51,25 @@ export class BlogsController {
|
||||
findOne(@Param('slug') slug: string) {
|
||||
return this.blogsService.findOneBySlug(slug);
|
||||
}
|
||||
|
||||
@Get(':slug/comments')
|
||||
@ApiOperation({ summary: 'دریافت نظرات تأیید شده مقاله' })
|
||||
findComments(@Param('slug') slug: string) {
|
||||
return this.blogsService.findCommentsBySlug(slug);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Post(':slug/comments')
|
||||
@ApiOperation({ summary: 'ارسال نظر برای مقاله (نیازمند ورود)' })
|
||||
addComment(
|
||||
@Param('slug') slug: string,
|
||||
@Body() body: { userName: string; content: string },
|
||||
@Request() req: any,
|
||||
) {
|
||||
return this.blogsService.addComment(slug, {
|
||||
...body,
|
||||
userId: req.user?.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user