Just v2
This commit is contained in:
Andras Bacsai
2022-02-10 15:47:44 +01:00
committed by GitHub
parent a64b095c13
commit 460ae85226
403 changed files with 22039 additions and 12465 deletions

View File

@@ -0,0 +1,28 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
import { PrismaErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
if (status === 401) return { status, body };
const buildId = event.url.searchParams.get('buildId');
const sequence = Number(event.url.searchParams.get('sequence'));
try {
let logs = await db.prisma.buildLog.findMany({
where: { buildId, time: { gt: sequence } },
orderBy: { time: 'asc' }
});
const { status } = await db.prisma.build.findFirst({ where: { id: buildId } });
return {
body: {
logs,
status
}
};
} catch (error) {
return PrismaErrorHandler(error);
}
};