update:add ci cd files ==> do not edit those file
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import { Body, Controller, Delete, Get, Param, Post, UseGuards } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiBody, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { CourseCategoryService } from './courseCategory.service';
|
||||
import { CourseCategory } from '../../models/schemas/courseCategory.schema';
|
||||
import { CreateCourseCategoryDto } from '../../DTO/courseCategory.dto';
|
||||
import { AuthGuard } from '../../auth/auth.guard';
|
||||
import { Roles } from '../../decorators/role.decorators';
|
||||
import { Role } from '../../common/eNums/role.enum';
|
||||
import { HttpStatus } from 'aws-sdk/clients/lambda';
|
||||
|
||||
@ApiTags('courseCategory')
|
||||
@Controller('courseCategory')
|
||||
export class CourseCategoryController {
|
||||
constructor(private readonly courseCategoryService: CourseCategoryService) {}
|
||||
|
||||
@ApiOperation({
|
||||
summary: 'ایجاد دسته بندی دوره',
|
||||
})
|
||||
@ApiBody({
|
||||
type: CreateCourseCategoryDto,
|
||||
description: 'get Body',
|
||||
})
|
||||
@UseGuards(AuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Roles(Role.Admin)
|
||||
@Post()
|
||||
async createCourseCategory(
|
||||
@Body() createCourseCategoryDto: CreateCourseCategoryDto,
|
||||
): Promise<CourseCategory> {
|
||||
return this.courseCategoryService.createCourseCategory(
|
||||
createCourseCategoryDto,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation({
|
||||
summary: 'دریافت همه دسته بندی ها',
|
||||
})
|
||||
@Get()
|
||||
async getAllCourseCategories(): Promise<CourseCategory[]> {
|
||||
return this.courseCategoryService.getAllCourseCategories();
|
||||
}
|
||||
|
||||
@ApiOperation({
|
||||
summary: 'دریافت دسته بندی دوره با آیدی',
|
||||
})
|
||||
@Get(':id')
|
||||
async getCourseCategoryById(
|
||||
@Param('id') id: string,
|
||||
): Promise<CourseCategory> {
|
||||
return this.courseCategoryService.getCourseCategoryById(id);
|
||||
}
|
||||
|
||||
@ApiOperation({
|
||||
summary: 'حذف دسته بندی دوره با آیدی',
|
||||
})
|
||||
@UseGuards(AuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Roles(Role.Admin)
|
||||
@Delete(':id')
|
||||
async deleteCourseCategoryById(@Param('id') id: string): Promise<{
|
||||
status: HttpStatus;
|
||||
message: string;
|
||||
}> {
|
||||
return this.courseCategoryService.deleteCourseCategoryById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user