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
@@ -0,0 +1,111 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { MenuService } from './menu.service';
|
||||
import {
|
||||
ApiTags,
|
||||
ApiOperation,
|
||||
ApiBearerAuth,
|
||||
ApiQuery,
|
||||
} from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { RolesGuard } from '../common/guards/roles.guard';
|
||||
import { Roles } from '../common/decorators/roles.decorator';
|
||||
|
||||
@ApiTags('Menu - مدیریت منو')
|
||||
@Controller('menu')
|
||||
export class MenuController {
|
||||
constructor(private readonly menuService: MenuService) {}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'دریافت منو عمومی بر اساس نوع' })
|
||||
@ApiQuery({
|
||||
name: 'type',
|
||||
required: true,
|
||||
description: 'HEADER | FOOTER_COL1 | FOOTER_COL2 | FOOTER_COL3',
|
||||
})
|
||||
findByType(@Query('type') type: string) {
|
||||
return this.menuService.findByType(type);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles('Admin')
|
||||
@ApiBearerAuth()
|
||||
@Get('admin')
|
||||
@ApiOperation({ summary: 'دریافت تمام آیتمهای منو (ادمین)' })
|
||||
@ApiQuery({ name: 'type', required: false })
|
||||
findAllAdmin(@Query('type') type?: string) {
|
||||
return this.menuService.findAllAdmin(type);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles('Admin')
|
||||
@ApiBearerAuth()
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'ایجاد آیتم منو جدید' })
|
||||
create(
|
||||
@Body()
|
||||
body: {
|
||||
menuType: string;
|
||||
label: string;
|
||||
href: string;
|
||||
parentId?: string;
|
||||
order?: number;
|
||||
isActive?: boolean;
|
||||
isExternal?: boolean;
|
||||
icon?: string;
|
||||
badge?: string;
|
||||
},
|
||||
) {
|
||||
return this.menuService.create(body);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles('Admin')
|
||||
@ApiBearerAuth()
|
||||
@Put('reorder')
|
||||
@ApiOperation({ summary: 'مرتبسازی آیتمهای منو' })
|
||||
reorder(@Body() body: { items: { id: string; order: number }[] }) {
|
||||
return this.menuService.reorder(body.items);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles('Admin')
|
||||
@ApiBearerAuth()
|
||||
@Put(':id')
|
||||
@ApiOperation({ summary: 'ویرایش آیتم منو' })
|
||||
update(
|
||||
@Param('id') id: string,
|
||||
@Body()
|
||||
body: Partial<{
|
||||
menuType: string;
|
||||
label: string;
|
||||
href: string;
|
||||
parentId: string | null;
|
||||
order: number;
|
||||
isActive: boolean;
|
||||
isExternal: boolean;
|
||||
icon: string;
|
||||
badge: string;
|
||||
}>,
|
||||
) {
|
||||
return this.menuService.update(id, body);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles('Admin')
|
||||
@ApiBearerAuth()
|
||||
@Delete(':id')
|
||||
@ApiOperation({ summary: 'حذف آیتم منو' })
|
||||
remove(@Param('id') id: string) {
|
||||
return this.menuService.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user