api service add filter by dnaId of Profile

This commit is contained in:
Warunee Tamkoo 2026-05-21 11:44:28 +07:00
parent b2d59ef698
commit b071bc2d92
3 changed files with 129 additions and 1 deletions

View file

@ -17,7 +17,17 @@ export async function handleWebServiceAuth(request: express.Request) {
// ตรวจสอบ API Key กับฐานข้อมูล
const apiKeyData = await AppDataSource.getRepository(ApiKey).findOne({
select: { id: true, name: true, keyApi: true },
select: {
id: true,
name: true,
keyApi: true,
accessType: true,
dnaRootId: true,
dnaChild1Id: true,
dnaChild2Id: true,
dnaChild3Id: true,
dnaChild4Id: true,
},
where: { keyApi: apiKey },
relations: ["apiNames"],
});
@ -40,6 +50,12 @@ export async function handleWebServiceAuth(request: express.Request) {
name: apiKeyData.name,
type: "web-service",
accessApi: apiKeyData.apiNames.map((x) => x.id) ?? [],
accessType: apiKeyData.accessType,
dnaRootId: apiKeyData.dnaRootId,
dnaChild1Id: apiKeyData.dnaChild1Id,
dnaChild2Id: apiKeyData.dnaChild2Id,
dnaChild3Id: apiKeyData.dnaChild3Id,
dnaChild4Id: apiKeyData.dnaChild4Id,
};
}

View file

@ -25,5 +25,11 @@ export type RequestWithUserWebService = Request & {
id: string;
name: string;
accessApi: string[];
accessType?: string;
dnaRootId?: string | null;
dnaChild1Id?: string | null;
dnaChild2Id?: string | null;
dnaChild3Id?: string | null;
dnaChild4Id?: string | null;
};
};