chore: add prettier with config and format all files

This commit is contained in:
Sebastian Seedorf
2026-06-04 11:44:20 +02:00
parent d212ae3f30
commit cf9bb33ecb
50 changed files with 1290 additions and 714 deletions

View File

@@ -13,7 +13,10 @@ export const GET = withAuth(async () => {
if (alertsResult.rows.length === 0) return NextResponse.json([]);
const latestResult = await pool.query<{
combinator: string; item_key: string; green: number; red: number;
combinator: string;
item_key: string;
green: number;
red: number;
}>(
`SELECT DISTINCT ON (combinator, item_key) combinator, item_key, green, red
FROM signals
@@ -22,9 +25,7 @@ export const GET = withAuth(async () => {
const localeMap = getServerLocaleMap();
const latestMap = new Map(
latestResult.rows.map(r => [`${r.combinator}::${r.item_key}`, r]),
);
const latestMap = new Map(latestResult.rows.map((r) => [`${r.combinator}::${r.item_key}`, r]));
const triggered: TriggeredAlert[] = [];
@@ -49,14 +50,15 @@ export const GET = withAuth(async () => {
const value = alert.signal_type === 'green' ? vals.green : vals.red;
const fired = alert.condition === 'above' ? value > alert.threshold : value < alert.threshold;
if (fired) triggered.push({
...alert,
current_value: value,
combinator_match: combinator,
matched_item_key: item_key,
});
if (fired)
triggered.push({
...alert,
current_value: value,
combinator_match: combinator,
matched_item_key: item_key,
});
}
}
return NextResponse.json(triggered);
});
});