Deployment interface

This commit is contained in:
2026-01-03 20:15:58 +01:00
parent 61a9e1d8d9
commit 07a37f92df
6 changed files with 54 additions and 24 deletions
-20
View File
@@ -3,26 +3,6 @@ import testAuth from "../auth";
import { StatusCodes } from "http-status-codes";
import { deployApp, getDeployments } from "@/core/deployment";
export async function GET(req: NextRequest): Promise<NextResponse> {
const auth = await testAuth(req);
if (auth) {
return NextResponse.json(
{ message: auth },
{ status: StatusCodes.UNAUTHORIZED }
);
}
// const apps = await getApps();
const apps = await getDeployments([]);
return NextResponse.json({
message: "ok",
apps,
});
}
export async function POST(req: NextRequest): Promise<NextResponse> {
const auth = await testAuth(req);
const { name, appId }: { name: string; appId: string } = await req.json();
+29
View File
@@ -0,0 +1,29 @@
import { NextRequest, NextResponse } from "next/server";
import testAuth from "../auth";
import { StatusCodes } from "http-status-codes";
import { deployApp, getDeployments } from "@/core/deployment";
export async function POST(req: NextRequest): Promise<NextResponse> {
const auth = await testAuth(req);
const apps = await req.json();
if (auth) {
return NextResponse.json(
{ message: auth },
{ status: StatusCodes.UNAUTHORIZED }
);
}
if (!apps)
return NextResponse.json(
{ message: "Body should be Application[]" },
{ status: StatusCodes.UNAUTHORIZED }
);
const deployments = await getDeployments(apps);
return NextResponse.json({
message: "ok",
deployments,
});
}