feat(platform): checkpoint current implementation state
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { checkChargeabilityAlerts } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const runtime = "nodejs";
|
||||
@@ -35,7 +36,7 @@ export async function GET(request: Request) {
|
||||
checkedAt: new Date().toISOString(),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("[cron/chargeability-alerts] Error:", error);
|
||||
logger.error({ error, route: "/api/cron/chargeability-alerts" }, "Chargeability alert cron failed");
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "Internal error" },
|
||||
{ status: 500 },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { checkPendingEstimateReminders } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const runtime = "nodejs";
|
||||
@@ -37,7 +38,7 @@ export async function GET(request: Request) {
|
||||
checkedAt: new Date().toISOString(),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("[cron/estimate-reminders] Error:", error);
|
||||
logger.error({ error, route: "/api/cron/estimate-reminders" }, "Estimate reminder cron failed");
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "Internal error" },
|
||||
{ status: 500 },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { createNotificationsForUsers } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { createConnection } from "net";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -123,7 +124,7 @@ export async function GET(request: Request) {
|
||||
{ status: allHealthy ? 200 : 503 },
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("[cron/health-check] Error:", error);
|
||||
logger.error({ error, route: "/api/cron/health-check" }, "Health check cron failed");
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "Internal error" },
|
||||
{ status: 500 },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { autoImportPublicHolidays } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const runtime = "nodejs";
|
||||
@@ -49,7 +50,7 @@ export async function GET(request: Request) {
|
||||
skippedExisting: result.skippedExisting,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("[cron/public-holidays] Error:", error);
|
||||
logger.error({ error, route: "/api/cron/public-holidays", year }, "Public holiday import cron failed");
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "Internal error" },
|
||||
{ status: 500 },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { createNotificationsForUsers } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
@@ -87,7 +88,7 @@ function scanPackageJson(): Finding[] {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[security-audit] Error scanning package.json:", error);
|
||||
logger.error({ error, route: "/api/cron/security-audit" }, "Failed to scan package manifests for security audit");
|
||||
}
|
||||
|
||||
return findings;
|
||||
@@ -149,7 +150,7 @@ export async function GET(request: Request) {
|
||||
scannedAt: new Date().toISOString(),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("[cron/security-audit] Error:", error);
|
||||
logger.error({ error, route: "/api/cron/security-audit" }, "Security audit cron failed");
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "Internal error" },
|
||||
{ status: 500 },
|
||||
|
||||
@@ -45,8 +45,19 @@ const handler = async (req: NextRequest) => {
|
||||
};
|
||||
|
||||
if (process.env["NODE_ENV"] === "development") {
|
||||
options.onError = ({ path, error }: { path?: string; error: { message: string } }) => {
|
||||
console.error(`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`);
|
||||
options.onError = ({
|
||||
path,
|
||||
error,
|
||||
}: {
|
||||
path?: string;
|
||||
error: { message: string; code?: string };
|
||||
}) => {
|
||||
const label = `tRPC ${path ?? "<no-path>"}`;
|
||||
if (error.code === "NOT_FOUND") {
|
||||
console.warn(`⚠️ ${label}: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
console.error(`❌ ${label}: ${error.message}`);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user