mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
Some checks failed
Publish to ghcr / build (linux/amd64, blacksmith-4vcpu-ubuntu-2404) (push) Has been cancelled
Publish to ghcr / build (linux/arm64, blacksmith-8vcpu-ubuntu-2204-arm) (push) Has been cancelled
Update Roadmap Released / update (push) Has been cancelled
Publish to ghcr / merge (push) Has been cancelled
25 lines
No EOL
840 B
TypeScript
25 lines
No EOL
840 B
TypeScript
'use server';
|
|
|
|
import { fetchAuditRecords } from "@/ee/features/audit/actions";
|
|
import { ErrorCode } from "@/lib/errorCodes";
|
|
import { serviceErrorResponse } from "@/lib/serviceError";
|
|
import { isServiceError } from "@/lib/utils";
|
|
import { getEntitlements } from "@sourcebot/shared";
|
|
import { StatusCodes } from "http-status-codes";
|
|
|
|
export const GET = async () => {
|
|
const entitlements = getEntitlements();
|
|
if (!entitlements.includes('audit')) {
|
|
return serviceErrorResponse({
|
|
statusCode: StatusCodes.FORBIDDEN,
|
|
errorCode: ErrorCode.NOT_FOUND,
|
|
message: "Audit logging is not enabled for your license",
|
|
});
|
|
}
|
|
|
|
const result = await fetchAuditRecords();
|
|
if (isServiceError(result)) {
|
|
return serviceErrorResponse(result);
|
|
}
|
|
return Response.json(result);
|
|
};
|