fully working item descendants
This commit is contained in:
parent
93398c8279
commit
92993ef105
|
@ -19,6 +19,6 @@ export class ItemModel {
|
||||||
@Field((type) => [ItemModel])
|
@Field((type) => [ItemModel])
|
||||||
children: ItemModel[];
|
children: ItemModel[];
|
||||||
|
|
||||||
@Field((type) => [ItemModel], { deprecationReason: 'typeorm issues' })
|
@Field((type) => [ItemModel])
|
||||||
descendents: ItemModel[];
|
descendents: ItemModel[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,8 @@ export class ItemsService {
|
||||||
const parentItem = await this.itemRepository.findOneOrFail(item.id, {
|
const parentItem = await this.itemRepository.findOneOrFail(item.id, {
|
||||||
relations: ['parent'],
|
relations: ['parent'],
|
||||||
});
|
});
|
||||||
return this.treeRepository.findDescendants(parentItem);
|
// TreeRepository.findDescendants()[0] is always the parent item
|
||||||
|
return (await this.treeRepository.findDescendants(parentItem)).slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
async createItem(input: NewItemInput): Promise<Item> {
|
async createItem(input: NewItemInput): Promise<Item> {
|
||||||
|
|
Loading…
Reference in a new issue