mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-26 14:56:39 +00:00
fix issues from test deploy
This commit is contained in:
@@ -9,10 +9,12 @@ import logger from "@server/logger";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { fromError } from "zod-validation-error";
|
||||
|
||||
const addUserSiteSchema = z.object({
|
||||
userId: z.string(),
|
||||
siteId: z.string().transform(Number).pipe(z.number().int().positive()),
|
||||
});
|
||||
const addUserSiteSchema = z
|
||||
.object({
|
||||
userId: z.string(),
|
||||
siteId: z.string().transform(Number).pipe(z.number().int().positive())
|
||||
})
|
||||
.strict();
|
||||
|
||||
export async function addUserSite(
|
||||
req: Request,
|
||||
@@ -36,7 +38,7 @@ export async function addUserSite(
|
||||
.insert(userSites)
|
||||
.values({
|
||||
userId,
|
||||
siteId,
|
||||
siteId
|
||||
})
|
||||
.returning();
|
||||
|
||||
@@ -48,7 +50,7 @@ export async function addUserSite(
|
||||
for (const resource of siteResources) {
|
||||
await db.insert(userResources).values({
|
||||
userId,
|
||||
resourceId: resource.resourceId,
|
||||
resourceId: resource.resourceId
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,7 +59,7 @@ export async function addUserSite(
|
||||
success: true,
|
||||
error: false,
|
||||
message: "Site added to user successfully",
|
||||
status: HttpCode.CREATED,
|
||||
status: HttpCode.CREATED
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
|
||||
Reference in New Issue
Block a user