no message

This commit is contained in:
kittapath 2025-01-10 18:24:41 +07:00
parent c937b96119
commit f59734d47b

View file

@ -5471,37 +5471,65 @@ export class OrganizationController extends Controller {
async findNodeAllOrg(@Body() requestBody: { node: number; nodeId: string }) { async findNodeAllOrg(@Body() requestBody: { node: number; nodeId: string }) {
switch (requestBody.node) { switch (requestBody.node) {
case 0: { case 0: {
const data = await this.orgRootRepository.findOne({ const data = await this.orgRootRepository.find({
where: { id: requestBody.nodeId }, 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: { case 1: {
const data = await this.child1Repository.findOne({ const data = await this.child1Repository.find({
where: { id: requestBody.nodeId }, where: { id: requestBody.nodeId },
}); });
return new HttpSuccess(data); return new HttpSuccess(data);
} }
case 2: { case 2: {
const data = await this.child2Repository.findOne({ const data = await this.child2Repository.find({
where: { id: requestBody.nodeId }, where: { id: requestBody.nodeId },
}); });
return new HttpSuccess(data); return new HttpSuccess(data);
} }
case 3: { case 3: {
const data = await this.child3Repository.findOne({ const data = await this.child3Repository.find({
where: { id: requestBody.nodeId }, where: { id: requestBody.nodeId },
}); });
return new HttpSuccess(data); return new HttpSuccess(data);
} }
case 4: { case 4: {
const data = await this.child4Repository.findOne({ const data = await this.child4Repository.find({
where: { id: requestBody.nodeId }, where: { id: requestBody.nodeId },
}); });
return new HttpSuccess(data); return new HttpSuccess(data);
} }
default: default: {
return new HttpSuccess([]); 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);
}
} }
} }