import { Controller, Get, Post, Body, Patch, Param, Delete, Query, } from '@nestjs/common'; import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; import { TokenData } from 'src/common/decorator/token-data.decorator'; import { CreateLiveTeachingDto } from '../dto/live-create.dto'; import { UpdateLiveTeachingDto } from '../dto/live-update.dto'; import { LiveTeachingService } from '../service/live-teaching.service'; import { PaginationDTO } from '../../online-course/common/pagination.dto'; import { CreateCourseclassifyDto } from 'src/online-course/dto/course-manage/course-classify.dto'; import { updateCourseclassifyDto } from 'src/online-course/dto/course-manage/update-course-classify.dto'; import { DeleteDto } from 'src/online-course/common/delete-dto'; import { get } from 'http'; import { SearchLsitDto } from 'src/online-course/dto/course-manage/get-course-list-dto'; import { NoAuthToken } from 'src/common/decorator/no-token.decorator'; @ApiTags('在线教学') @ApiBearerAuth() // @NoAuthToken() @Controller('live-teaching') export class LiveTeachingController { constructor(private readonly LiveTeachingService: LiveTeachingService) {} // 获取直播列表 @Get() @ApiOperation({ summary: '获取直播列表' }) findLiveList(@Query() pageInfo: PaginationDTO, @TokenData() tokenInfo: any) { return this.LiveTeachingService.findLiveList(pageInfo, tokenInfo); } @Get('live-publish/:id') @ApiOperation({ summary: '教员端直播时获取直播详情' }) getLiveInfo(@Param('id') id: number, @TokenData() tokenInfo: any) { return this.LiveTeachingService.getLiveInfo(id, tokenInfo); } // 编辑时获取某个直播的详细信息 @Get(':id') @NoAuthToken() @ApiOperation({ summary: '获取某个直播的详细信息' }) findOneInfo(@Param('id') id: number, @TokenData() tokenInfo: any) { return this.LiveTeachingService.findOneInfo(id, tokenInfo); } // 搜索直播名称 @NoAuthToken() @Post('search') @ApiOperation({ summary: '搜索直播' }) searchSomeLive(@Body() searchInfo: SearchLsitDto) { return this.LiveTeachingService.searchSomeLive(searchInfo); } // 更新课件的学习信息 @Post() @ApiOperation({ summary: '新建直播' }) createLive( @Body() LiveInfo: CreateLiveTeachingDto, @TokenData() tokenInfo: any, ) { return this.LiveTeachingService.createLive(LiveInfo, tokenInfo); } @Patch() @ApiOperation({ summary: '更新直播信息' }) updateLive( @Body() LiveInfo: UpdateLiveTeachingDto, @TokenData() tokenInfo: any, ) { return this.LiveTeachingService.updateLive(LiveInfo, tokenInfo); } @Delete(':id') @ApiOperation({ summary: '删除直播' }) deleteLive(@Param('id') id: [string], @TokenData() tokenInfo: any) { let sId: any = id; sId = sId.split(','); return this.LiveTeachingService.deleteLive(sId, tokenInfo); } @Post('update') updateLiveInfo(@Body() data: object) { return this.LiveTeachingService.updateLiveInfo(data); } // -------------------分类模块------------------ // // 分类查询 @Get('classify') @ApiOperation({ summary: '查询所有分类' }) getclassifyList() { return this.LiveTeachingService.getclassifyList(); } // 新建分类 @Post('classify') @ApiOperation({ summary: '新增分类' }) createclassify(@Body() createclassify: CreateCourseclassifyDto) { return this.LiveTeachingService.createclassify(createclassify); } // 编辑分类 @Patch('classify/:id') @ApiOperation({ summary: '编辑分类' }) updateCourseclassify( @Param('id') id: number, @Body() updateclassify: updateCourseclassifyDto, ) { return this.LiveTeachingService.updateclassify(id, updateclassify); } // 删除分类 @Post('classify/delete') @ApiOperation({ summary: '删除分类' }) deleteCourseclassify(@Body() id: DeleteDto) { return this.LiveTeachingService.deleteclassify(id); } }