mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-16 22:14:29 +00:00
♻️ add openapi schema types
This commit is contained in:
@@ -28,7 +28,14 @@ const getResourcePolicySchema = z
|
|||||||
})
|
})
|
||||||
.or(
|
.or(
|
||||||
z.strictObject({
|
z.strictObject({
|
||||||
resourcePolicyId: z.coerce.number<string>().int().positive()
|
resourcePolicyId: z.coerce
|
||||||
|
.number<string>()
|
||||||
|
.int()
|
||||||
|
.positive()
|
||||||
|
.openapi({
|
||||||
|
type: "integer",
|
||||||
|
description: "Resource policy ID"
|
||||||
|
})
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,13 @@ import { OpenAPITags, registry } from "@server/openApi";
|
|||||||
const setResourcePolicyAcccessControlBodySchema = z.strictObject({
|
const setResourcePolicyAcccessControlBodySchema = z.strictObject({
|
||||||
sso: z.boolean(),
|
sso: z.boolean(),
|
||||||
userIds: z.array(z.string()),
|
userIds: z.array(z.string()),
|
||||||
roleIds: z.array(z.int().positive()),
|
roleIds: z.array(z.int().positive()).openapi({
|
||||||
skipToIdpId: z.int().positive().optional().nullish()
|
type: "array"
|
||||||
|
}),
|
||||||
|
skipToIdpId: z.int().positive().optional().nullable().openapi({
|
||||||
|
type: "integer",
|
||||||
|
description: "Page number to retrieve"
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const setResourcePolicyAccessControlParamsSchema = z.strictObject({
|
const setResourcePolicyAccessControlParamsSchema = z.strictObject({
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ const ruleSchema = z.strictObject({
|
|||||||
description: "rule match"
|
description: "rule match"
|
||||||
}),
|
}),
|
||||||
value: z.string().min(1),
|
value: z.string().min(1),
|
||||||
priority: z.int(),
|
priority: z.int().openapi({
|
||||||
|
type: "integer",
|
||||||
|
description: "Rule priority"
|
||||||
|
}),
|
||||||
enabled: z.boolean().optional()
|
enabled: z.boolean().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const listSitesSchema = z.object({
|
|||||||
page: z.coerce
|
page: z.coerce
|
||||||
.number<string>() // for prettier formatting
|
.number<string>() // for prettier formatting
|
||||||
.int()
|
.int()
|
||||||
.min(0)
|
.positive()
|
||||||
.optional()
|
.optional()
|
||||||
.catch(1)
|
.catch(1)
|
||||||
.default(1)
|
.default(1)
|
||||||
@@ -278,7 +278,9 @@ export async function listSites(
|
|||||||
|
|
||||||
// we need to add `as` so that drizzle filters the result as a subquery
|
// we need to add `as` so that drizzle filters the result as a subquery
|
||||||
const countQuery = db.$count(
|
const countQuery = db.$count(
|
||||||
querySitesBase().where(and(...conditions)).as("filtered_sites")
|
querySitesBase()
|
||||||
|
.where(and(...conditions))
|
||||||
|
.as("filtered_sites")
|
||||||
);
|
);
|
||||||
|
|
||||||
const siteListQuery = baseQuery
|
const siteListQuery = baseQuery
|
||||||
|
|||||||
Reference in New Issue
Block a user