Based on this dto import { ApiProperty } from '@nestjs/swagger'; import { AbstractDto }…
Jump to turn (6)
- 1Based on this dto import { ApiProperty } from '@nestjs/swagger'; import { Abstra
- 2import { Column, Entity, ManyToOne } from 'typeorm'; import { AbstractIdEntity }
- 3import { Column, Entity, ManyToOne } from 'typeorm'; import { AbstractIdEntity }
- 4TSError: ⨯ Unable to compile TypeScript: src/modules/categories/categories.servi
- 5it throws return new TSError(diagnosticText, diagnosticCodes, diagnostics); ^ TS
- 6Response body Download [ { "id": 1, "name": "New Category", "color": 2, "parentC
- User
Based on this dto import { ApiProperty } from '@nestjs/swagger';
import { AbstractDto } from '../../../common/dto/abstract.dto'; import { CategoryEntity } from '../entities/category.entity';
export class CategoryDto extends AbstractDto { @ApiProperty({ description: 'Name of category', type: String, }) name: string;
code@ApiProperty({ description: 'Color of category', type: Number, }) color: number; @ApiProperty({ description: 'Parent category of category', type: CategoryDto, nullable: true, }) parentCategory: CategoryDto; constructor(category: CategoryEntity) { super(category); this.name = category.name; this.color = category.color; this.parentCategory = category.parentCategory ? category.parentCategory.toDto() : null; }} add a service that will return only categories with an array of their subcategories.
- Assistant