mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-09 17:18:31 +00:00
♻️ add openapi schema types
This commit is contained in:
parent
1a5e9f1005
commit
8a3c0d9a08
4 changed files with 23 additions and 6 deletions
|
|
@ -28,7 +28,14 @@ const getResourcePolicySchema = z
|
|||
})
|
||||
.or(
|
||||
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({
|
||||
sso: z.boolean(),
|
||||
userIds: z.array(z.string()),
|
||||
roleIds: z.array(z.int().positive()),
|
||||
skipToIdpId: z.int().positive().optional().nullish()
|
||||
roleIds: z.array(z.int().positive()).openapi({
|
||||
type: "array"
|
||||
}),
|
||||
skipToIdpId: z.int().positive().optional().nullable().openapi({
|
||||
type: "integer",
|
||||
description: "Page number to retrieve"
|
||||
})
|
||||
});
|
||||
|
||||
const setResourcePolicyAccessControlParamsSchema = z.strictObject({
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ const ruleSchema = z.strictObject({
|
|||
description: "rule match"
|
||||
}),
|
||||
value: z.string().min(1),
|
||||
priority: z.int(),
|
||||
priority: z.int().openapi({
|
||||
type: "integer",
|
||||
description: "Rule priority"
|
||||
}),
|
||||
enabled: z.boolean().optional()
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ const listSitesSchema = z.object({
|
|||
page: z.coerce
|
||||
.number<string>() // for prettier formatting
|
||||
.int()
|
||||
.min(0)
|
||||
.positive()
|
||||
.optional()
|
||||
.catch(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
|
||||
const countQuery = db.$count(
|
||||
querySitesBase().where(and(...conditions)).as("filtered_sites")
|
||||
querySitesBase()
|
||||
.where(and(...conditions))
|
||||
.as("filtered_sites")
|
||||
);
|
||||
|
||||
const siteListQuery = baseQuery
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue