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