api manage add isMain table & fix type & key

This commit is contained in:
Warunee Tamkoo 2025-08-07 16:01:03 +07:00
parent 321896f94b
commit 537d70a8f3

View file

@ -131,12 +131,14 @@ export class ApiManageController extends Controller {
name: "Profile",
repository: this.profileRepository,
description: "ข้อมูลหลัก",
isMain: true,
system: ["registry"],
},
{
name: "ProfileEmployee",
repository: this.profileEmployeeRepository,
description: "ข้อมูลหลัก",
isMain: true,
system: ["registry_emp", "registry_temp"],
},
{
@ -257,6 +259,7 @@ export class ApiManageController extends Controller {
name: "OrgRoot",
repository: this.orgRootRepository,
description: "ข้อมูลหน่วยงาน",
isMain: true,
system: ["organization"],
},
{
@ -293,9 +296,10 @@ export class ApiManageController extends Controller {
const result = entities
.filter((s) => s.system.includes(system))
.map(({ name, repository, description }) => ({
.map(({ name, repository, description, isMain }) => ({
tb: name,
description,
isMain: isMain || false,
propertys: repository.metadata.columns
.filter(
(column) =>
@ -305,9 +309,9 @@ export class ApiManageController extends Controller {
)
.map((column) => ({
propertyName: column.propertyName,
type: column.type,
type: typeof column.type === "string" ? column.type : "string",
comment: column.comment,
key: `${name}.${column.propertyName}`,
key: column.propertyName,
})),
}));