mirror of
https://github.com/fosrl/pangolin.git
synced 2026-10-29 06:59:06 +01:00
seperate attached to column
This commit is contained in:
@@ -104,7 +104,21 @@ const listSchema = z.object({
|
||||
.openapi({
|
||||
type: "boolean",
|
||||
description: "Filter redirects based on enabled status"
|
||||
})
|
||||
}),
|
||||
resourceId: z.coerce
|
||||
.number<string>()
|
||||
.int()
|
||||
.positive()
|
||||
.optional()
|
||||
.catch(undefined)
|
||||
.openapi({
|
||||
type: "integer",
|
||||
description: "Filter redirects attached to this resource"
|
||||
}),
|
||||
domainId: z.string().nonempty().optional().catch(undefined).openapi({
|
||||
type: "string",
|
||||
description: "Filter redirects attached to this domain"
|
||||
})
|
||||
});
|
||||
|
||||
registry.registerPath({
|
||||
@@ -160,8 +174,17 @@ export async function listRedirects(
|
||||
);
|
||||
}
|
||||
|
||||
const { pageSize, page, query, sort_by, order, type, enabled } =
|
||||
parsedQuery.data;
|
||||
const {
|
||||
pageSize,
|
||||
page,
|
||||
query,
|
||||
sort_by,
|
||||
order,
|
||||
type,
|
||||
enabled,
|
||||
resourceId,
|
||||
domainId
|
||||
} = parsedQuery.data;
|
||||
const conditions = [eq(redirects.orgId, orgId)];
|
||||
|
||||
if (type === "permanent") {
|
||||
@@ -174,6 +197,14 @@ export async function listRedirects(
|
||||
conditions.push(eq(redirects.enabled, enabled));
|
||||
}
|
||||
|
||||
if (typeof resourceId !== "undefined") {
|
||||
conditions.push(eq(redirects.resourceId, resourceId));
|
||||
}
|
||||
|
||||
if (typeof domainId !== "undefined") {
|
||||
conditions.push(eq(redirects.domainId, domainId));
|
||||
}
|
||||
|
||||
if (query) {
|
||||
const term = "%" + query.toLowerCase() + "%";
|
||||
conditions.push(
|
||||
|
||||
Reference in New Issue
Block a user