feat: 录播图列表接口
This commit is contained in:
1 parent
398a09ad83
commit
efab650808
3 files changed
+21
-1
No files matched your search
@@ -61,6 +61,15 @@ export class CarousalController {
|
||||
);
|
||||
}
|
||||
|
||||
@Get('active-list')
|
||||
@ApiBearerAuth()
|
||||
@ApiOkResponse({
|
||||
type: Array<CarousalVo>,
|
||||
})
|
||||
async activeList() {
|
||||
return CarousalMapper.toVos(await this.carousalService.activeList());
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@ApiBearerAuth()
|
||||
@ApiOkResponse({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNotEmpty } from 'class-validator';
|
||||
import { IsNotEmpty, IsOptional } from 'class-validator';
|
||||
import { CarousalTargetType } from '../enum/carousal-target-type.enum';
|
||||
|
||||
export class CreateCarousalRequest {
|
||||
@@ -16,8 +16,10 @@ export class CreateCarousalRequest {
|
||||
@ApiProperty({
|
||||
example: 'https://example.cc',
|
||||
})
|
||||
@IsOptional()
|
||||
targetUrl: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
targetId: string;
|
||||
}
|
||||
@@ -65,4 +65,13 @@ export class CarousalService {
|
||||
const carousal = await this.get(id);
|
||||
return this.carousalRepository.remove(carousal);
|
||||
}
|
||||
|
||||
async activeList() {
|
||||
return this.carousalRepository.find({
|
||||
where: {
|
||||
status: CarousalStatus.ACTIVE,
|
||||
},
|
||||
order: { createdTime: 'DESC' },
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user