diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index 7e591da9..547bd035 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -5471,37 +5471,65 @@ export class OrganizationController extends Controller { async findNodeAllOrg(@Body() requestBody: { node: number; nodeId: string }) { switch (requestBody.node) { case 0: { - const data = await this.orgRootRepository.findOne({ + const data = await this.orgRootRepository.find({ where: { id: requestBody.nodeId }, }); - return new HttpSuccess(data); + return new HttpSuccess( + data.map((y) => ({ + name: y.orgRootName, + rootId: y.id, + child1Id: null, + child2Id: null, + child3Id: null, + child4Id: null, + })), + ); } case 1: { - const data = await this.child1Repository.findOne({ + const data = await this.child1Repository.find({ where: { id: requestBody.nodeId }, }); return new HttpSuccess(data); } case 2: { - const data = await this.child2Repository.findOne({ + const data = await this.child2Repository.find({ where: { id: requestBody.nodeId }, }); return new HttpSuccess(data); } case 3: { - const data = await this.child3Repository.findOne({ + const data = await this.child3Repository.find({ where: { id: requestBody.nodeId }, }); return new HttpSuccess(data); } case 4: { - const data = await this.child4Repository.findOne({ + const data = await this.child4Repository.find({ where: { id: requestBody.nodeId }, }); return new HttpSuccess(data); } - default: - return new HttpSuccess([]); + default: { + const data = await this.orgRootRepository.find({ + where: { + orgRevision: { + orgRevisionIsCurrent: true, + orgRevisionIsDraft: false, + }, + }, + }); + return new HttpSuccess( + data.map((y) => ({ + name: y.orgRootName, + rootId: y.id, + child1Id: null, + child2Id: null, + child3Id: null, + child4Id: null, + })), + ); + return new HttpSuccess(data); + } } }