fix: add enabled filter to private resources list endpoint

This commit is contained in:
ASPCODES
2026-10-26 09:40:07 -04:00
committed by Owen
parent a0fe03fad9
commit 3c76f42685
@@ -97,6 +97,15 @@ const listAllSiteResourcesByOrgQuerySchema = z.strictObject({
enum: ["pending", "approved"],
description: "Filter by site resource status"
}),
enabled: z
.enum(["true", "false"])
.transform((v) => v === "true")
.optional()
.catch(undefined)
.openapi({
type: "boolean",
description: "Filter site resources based on enabled status"
}),
labels: z
.preprocess((val) => {
if (val === undefined || val === null || val === "") {
@@ -322,6 +331,7 @@ export async function listAllSiteResourcesByOrg(
order,
siteId,
status,
enabled,
labels: labelFilter
} = parsedQuery.data;
@@ -399,6 +409,10 @@ export async function listAllSiteResourcesByOrg(
conditions.push(eq(siteResources.status, status));
}
if (typeof enabled !== "undefined") {
conditions.push(eq(siteResources.enabled, enabled));
}
if (labelFilter && labelFilter.length > 0) {
conditions.push(
inArray(