Fix resource new id number

This commit is contained in:
Owen Schwartz
2024-10-26 12:15:03 -04:00
parent c6d4c4db20
commit 261b3c7e31
19 changed files with 31 additions and 28 deletions

View File

@@ -9,7 +9,7 @@ import { ActionsEnum, checkUserActionPermission } from '@server/auth/actions';
import logger from '@server/logger';
const createTargetParamsSchema = z.object({
resourceId: z.string(),
resourceId: z.string().transform(Number).pipe(z.number().int().positive()),
});
const createTargetSchema = z.object({

View File

@@ -11,7 +11,7 @@ import { fromError } from "zod-validation-error";
import logger from "@server/logger";
const listTargetsParamsSchema = z.object({
resourceId: z.string()
resourceId: z.string().transform(Number).pipe(z.number().int().positive()),
});
const listTargetsSchema = z.object({
@@ -29,7 +29,7 @@ const listTargetsSchema = z.object({
.pipe(z.number().int().nonnegative()),
});
function queryTargets(resourceId: string) {
function queryTargets(resourceId: number) {
let baseQuery = db
.select({
targetId: targets.targetId,