add test case

This commit is contained in:
liuyi 2025-05-27 21:46:00 +08:00
parent 4350232069
commit e71f08a3de
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ export class CategoryEntity extends BaseEntity {
parent: Relation<CategoryEntity> | null; parent: Relation<CategoryEntity> | null;
@Type(() => CategoryEntity) @Type(() => CategoryEntity)
@Expose({ groups: ['category-tree'] }) @Expose({ groups: ['category-tree', 'category-detail'] })
@TreeChildren({ cascade: true }) @TreeChildren({ cascade: true })
children: Relation<CategoryEntity>[]; children: Relation<CategoryEntity>[];
} }

View File

@ -26,7 +26,7 @@ export class CategoryService {
} }
async detail(id: string) { async detail(id: string) {
return this.repository.findOneOrFail({ where: { id }, relations: ['parent'] }); return this.repository.findOneOrFail({ where: { id }, relations: ['parent', 'children'] });
} }
async create(data: CreateCategoryDto) { async create(data: CreateCategoryDto) {