backend setup

This commit is contained in:
Owen
2025-10-04 21:25:31 -07:00
committed by Pallavi Kumari
parent b47fc9f901
commit ff2bcfb0e7
7 changed files with 56 additions and 9 deletions

View File

@@ -53,7 +53,8 @@ const createTargetSchema = z
path: z.string().optional().nullable(),
pathMatchType: z.enum(["exact", "prefix", "regex"]).optional().nullable(),
rewritePath: z.string().optional().nullable(),
rewritePathType: z.enum(["exact", "prefix", "regex", "stripPrefix"]).optional().nullable()
rewritePathType: z.enum(["exact", "prefix", "regex", "stripPrefix"]).optional().nullable(),
priority: z.number().int().min(1).max(1000).default(100)
})
.strict();

View File

@@ -62,7 +62,8 @@ function queryTargets(resourceId: number) {
path: targets.path,
pathMatchType: targets.pathMatchType,
rewritePath: targets.rewritePath,
rewritePathType: targets.rewritePathType
rewritePathType: targets.rewritePathType,
priority: targets.priority,
})
.from(targets)
.leftJoin(sites, eq(sites.siteId, targets.siteId))

View File

@@ -50,7 +50,8 @@ const updateTargetBodySchema = z
path: z.string().optional().nullable(),
pathMatchType: z.enum(["exact", "prefix", "regex"]).optional().nullable(),
rewritePath: z.string().optional().nullable(),
rewritePathType: z.enum(["exact", "prefix", "regex", "stripPrefix"]).optional().nullable()
rewritePathType: z.enum(["exact", "prefix", "regex", "stripPrefix"]).optional().nullable(),
priority: z.number().int().min(1).max(1000).default(100)
})
.strict()
.refine((data) => Object.keys(data).length > 0, {