add category response dto
This commit is contained in:
parent
878687e7ec
commit
f92af930d7
@ -28,6 +28,7 @@ import { CreateContentRevisionDto } from './dtos/create-content-revision.dto';
|
|||||||
import { ContentResponseDto } from './dtos/content-response.dto';
|
import { ContentResponseDto } from './dtos/content-response.dto';
|
||||||
import { ContentAssetType } from 'apps/catalog/src/enums/content-asset-type.enum';
|
import { ContentAssetType } from 'apps/catalog/src/enums/content-asset-type.enum';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
|
import { CategoryResponseDto } from './dtos/category-response.dto';
|
||||||
|
|
||||||
@Controller({
|
@Controller({
|
||||||
version: '1',
|
version: '1',
|
||||||
@ -40,6 +41,7 @@ export class CatalogController {
|
|||||||
constructor(@Inject('catalog') private catalog: ClientProxy) {}
|
constructor(@Inject('catalog') private catalog: ClientProxy) {}
|
||||||
|
|
||||||
@Get('categories')
|
@Get('categories')
|
||||||
|
@ApiOkResponse({ type: CategoryResponseDto, isArray: true })
|
||||||
@ApiOperation({ summary: 'Get catalog categories' })
|
@ApiOperation({ summary: 'Get catalog categories' })
|
||||||
async getCatalogCategories() {
|
async getCatalogCategories() {
|
||||||
return this.catalog.send('catalog.items.categories', {});
|
return this.catalog.send('catalog.items.categories', {});
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
|
export class CategoryContentTypeResponseDto {
|
||||||
|
@ApiProperty()
|
||||||
|
contentType: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CategoryResponseDto {
|
||||||
|
@ApiProperty()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
category: string;
|
||||||
|
|
||||||
|
@ApiProperty({ type: CategoryResponseDto, isArray: true })
|
||||||
|
children: CategoryResponseDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ type: CategoryContentTypeResponseDto, isArray: true })
|
||||||
|
contentTypes: CategoryContentTypeResponseDto[];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user