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;
@Type(() => CategoryEntity)
@Expose({ groups: ['category-tree'] })
@Expose({ groups: ['category-tree', 'category-detail'] })
@TreeChildren({ cascade: true })
children: Relation<CategoryEntity>[];
}

View File

@ -26,7 +26,7 @@ export class CategoryService {
}
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) {