no message

This commit is contained in:
Kittapath 2024-02-01 11:34:13 +07:00
parent c89126a8a2
commit 1845b489ba

View file

@ -865,15 +865,16 @@ export class OrganizationController extends Controller {
if (!orgChild1) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child1");
}
const datas = await this.child1Repository.find({
where: [
{ isAncestorDNA: orgChild1.isAncestorDNA },
{ isAncestorDNA: Not("00000000-0000-0000-0000-000000000000") },
{ isAncestorDNA: Not(IsNull()) },
],
relations: ["orgRevision"],
order: { lastUpdatedAt: "DESC" },
});
const datas = await this.child1Repository
.createQueryBuilder("child1")
.where("child1.isAncestorDNA = :isAncestorDNA", { isAncestorDNA: orgChild1.isAncestorDNA })
.andWhere("child1.isAncestorDNA <> :nullUUID", {
nullUUID: "00000000-0000-0000-0000-000000000000",
})
.andWhere("child1.isAncestorDNA IS NOT NULL")
.leftJoinAndSelect("child1.orgRevision", "orgRevision")
.orderBy("child1.lastUpdatedAt", "DESC")
.getMany();
const _data = datas.map((item) => ({
id: item.id,
orgRevisionName: item.orgRevision == null ? null : item.orgRevision.orgRevisionName,
@ -888,15 +889,16 @@ export class OrganizationController extends Controller {
if (!orgChild2) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child2");
}
const datas = await this.child2Repository.find({
where: [
{ isAncestorDNA: orgChild2.isAncestorDNA },
{ isAncestorDNA: Not("00000000-0000-0000-0000-000000000000") },
{ isAncestorDNA: Not(IsNull()) },
],
relations: ["orgRevision"],
order: { lastUpdatedAt: "DESC" },
});
const datas = await this.child2Repository
.createQueryBuilder("child2")
.where("child2.isAncestorDNA = :isAncestorDNA", { isAncestorDNA: orgChild2.isAncestorDNA })
.andWhere("child2.isAncestorDNA <> :nullUUID", {
nullUUID: "00000000-0000-0000-0000-000000000000",
})
.andWhere("child2.isAncestorDNA IS NOT NULL")
.leftJoinAndSelect("child2.orgRevision", "orgRevision")
.orderBy("child2.lastUpdatedAt", "DESC")
.getMany();
const _data = datas.map((item) => ({
id: item.id,
orgRevisionName: item.orgRevision == null ? null : item.orgRevision.orgRevisionName,
@ -911,15 +913,16 @@ export class OrganizationController extends Controller {
if (!orgChild3) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child3");
}
const datas = await this.child3Repository.find({
where: [
{ isAncestorDNA: orgChild3.isAncestorDNA },
{ isAncestorDNA: Not("00000000-0000-0000-0000-000000000000") },
{ isAncestorDNA: Not(IsNull()) },
],
relations: ["orgRevision"],
order: { lastUpdatedAt: "DESC" },
});
const datas = await this.child3Repository
.createQueryBuilder("child3")
.where("child3.isAncestorDNA = :isAncestorDNA", { isAncestorDNA: orgChild3.isAncestorDNA })
.andWhere("child3.isAncestorDNA <> :nullUUID", {
nullUUID: "00000000-0000-0000-0000-000000000000",
})
.andWhere("child3.isAncestorDNA IS NOT NULL")
.leftJoinAndSelect("child3.orgRevision", "orgRevision")
.orderBy("child3.lastUpdatedAt", "DESC")
.getMany();
const _data = datas.map((item) => ({
id: item.id,
orgRevisionName: item.orgRevision == null ? null : item.orgRevision.orgRevisionName,
@ -934,15 +937,16 @@ export class OrganizationController extends Controller {
if (!orgChild4) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child4");
}
const datas = await this.child4Repository.find({
where: [
{ isAncestorDNA: orgChild4.isAncestorDNA },
{ isAncestorDNA: Not("00000000-0000-0000-0000-000000000000") },
{ isAncestorDNA: Not(IsNull()) },
],
relations: ["orgRevision"],
order: { lastUpdatedAt: "DESC" },
});
const datas = await this.child4Repository
.createQueryBuilder("child4")
.where("child4.isAncestorDNA = :isAncestorDNA", { isAncestorDNA: orgChild4.isAncestorDNA })
.andWhere("child4.isAncestorDNA <> :nullUUID", {
nullUUID: "00000000-0000-0000-0000-000000000000",
})
.andWhere("child4.isAncestorDNA IS NOT NULL")
.leftJoinAndSelect("child4.orgRevision", "orgRevision")
.orderBy("child4.lastUpdatedAt", "DESC")
.getMany();
const _data = datas.map((item) => ({
id: item.id,
orgRevisionName: item.orgRevision == null ? null : item.orgRevision.orgRevisionName,
@ -957,15 +961,16 @@ export class OrganizationController extends Controller {
if (!orgRoot) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Root");
}
const datas = await this.orgRootRepository.find({
where: [
{ isAncestorDNA: orgRoot.isAncestorDNA },
{ isAncestorDNA: Not("00000000-0000-0000-0000-000000000000") },
{ isAncestorDNA: Not(IsNull()) },
],
relations: ["orgRevision"],
order: { lastUpdatedAt: "DESC" },
});
const datas = await this.orgRootRepository
.createQueryBuilder("root")
.where("root.isAncestorDNA = :isAncestorDNA", { isAncestorDNA: orgRoot.isAncestorDNA })
.andWhere("root.isAncestorDNA <> :nullUUID", {
nullUUID: "00000000-0000-0000-0000-000000000000",
})
.andWhere("root.isAncestorDNA IS NOT NULL")
.leftJoinAndSelect("root.orgRevision", "orgRevision")
.orderBy("root.lastUpdatedAt", "DESC")
.getMany();
const _data = datas.map((item) => ({
id: item.id,
orgRevisionName: item.orgRevision == null ? null : item.orgRevision.orgRevisionName,