mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Ready for release soon.
This commit is contained in:
@@ -6,6 +6,7 @@ import * as drizzleDb from "@/db";
|
||||
import {db} from "@/db";
|
||||
import {EDbmsSchema} from "@/db/schema/types";
|
||||
import {eq} from "drizzle-orm";
|
||||
import {isUuidv4} from "@/utils/verify-uuid";
|
||||
|
||||
export type databaseAgent = {
|
||||
name: string,
|
||||
@@ -34,6 +35,14 @@ export async function POST(
|
||||
const body: Body = await request.json();
|
||||
const lastContact = new Date();
|
||||
|
||||
if (!isUuidv4(agentId)) {
|
||||
return NextResponse.json(
|
||||
{error: "agentId is not a valid uuid"},
|
||||
{status: 500}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const agent = await db.query.agent.findFirst({
|
||||
where: eq(drizzleDb.schemas.agent.id, agentId),
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function GET(
|
||||
{status: 403}
|
||||
);
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
const expiresAt = parseInt(expires, 10);
|
||||
if (Date.now() > expiresAt) {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in New Issue
Block a user