mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 10:16:41 +00:00
🚧 wip: healthStatus
This commit is contained in:
@@ -61,6 +61,10 @@ const listResourcesSchema = z.object({
|
|||||||
authState: z
|
authState: z
|
||||||
.enum(["protected", "not_protected", "none"])
|
.enum(["protected", "not_protected", "none"])
|
||||||
.optional()
|
.optional()
|
||||||
|
.catch(undefined),
|
||||||
|
healthStatus: z
|
||||||
|
.enum(["online", "degraded", "offline", "unknown"])
|
||||||
|
.optional()
|
||||||
.catch(undefined)
|
.catch(undefined)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -206,7 +210,8 @@ export async function listResources(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const { page, pageSize, authState, enabled, query } = parsedQuery.data;
|
const { page, pageSize, authState, enabled, query, healthStatus } =
|
||||||
|
parsedQuery.data;
|
||||||
|
|
||||||
const parsedParams = listResourcesParamsSchema.safeParse(req.params);
|
const parsedParams = listResourcesParamsSchema.safeParse(req.params);
|
||||||
if (!parsedParams.success) {
|
if (!parsedParams.success) {
|
||||||
@@ -318,6 +323,15 @@ export async function listResources(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof healthStatus !== "undefined") {
|
||||||
|
switch (healthStatus) {
|
||||||
|
case "online":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const countQuery: any = db
|
const countQuery: any = db
|
||||||
.select({ count: count() })
|
.select({ count: count() })
|
||||||
.from(resources)
|
.from(resources)
|
||||||
|
|||||||
Reference in New Issue
Block a user