mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-24 12:33:17 +00:00
21 lines
484 B
TypeScript
21 lines
484 B
TypeScript
import type { BuildLog } from '@prisma/client';
|
|
import { prisma, ErrorHandler } from './common';
|
|
|
|
export async function listLogs({
|
|
buildId,
|
|
last = 0
|
|
}: {
|
|
buildId: string;
|
|
last: number;
|
|
}): Promise<BuildLog[] | { status: number; body: { message: string; error: string } }> {
|
|
try {
|
|
const body = await prisma.buildLog.findMany({
|
|
where: { buildId, time: { gt: last } },
|
|
orderBy: { time: 'asc' }
|
|
});
|
|
return [...body];
|
|
} catch (error) {
|
|
return ErrorHandler(error);
|
|
}
|
|
}
|