fix(ops): interpolera varumärke i wall board från brand.config.json

This commit is contained in:
Sven (AAMOS AI)
2026-08-11 02:47:25 +07:00
parent 335cfe0bf6
commit 33b0a8267b
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -1,5 +1,6 @@
import { timingSafeEqual } from "node:crypto"; import { timingSafeEqual } from "node:crypto";
import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify"; import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
import BRAND from "../../../../brand.config.json" with { type: "json" };
import { errors } from "../lib/errors.js"; import { errors } from "../lib/errors.js";
const CACHE_KEY = "ops:summary:cache"; const CACHE_KEY = "ops:summary:cache";
@@ -54,8 +55,19 @@ export async function opsRoutes(app: FastifyInstance) {
.send({ error: { code: "CACHE_INVALID", message: "Cachen innehåller ogiltig JSON." } }); .send({ error: { code: "CACHE_INVALID", message: "Cachen innehåller ogiltig JSON." } });
} }
const enriched = structuredClone(summary);
if (
enriched.wall &&
typeof enriched.wall === "object" &&
Array.isArray((enriched.wall as Record<string, unknown>).boards)
) {
for (const board of (enriched.wall as { boards: Array<{ title?: string }> }).boards) {
if (board.title === "{brand}") board.title = BRAND.name;
}
}
return reply.send({ return reply.send({
...summary, ...enriched,
cached_at: ts ?? summary.as_of, cached_at: ts ?? summary.as_of,
}); });
}); });
+1 -1
View File
@@ -588,7 +588,7 @@ export function buildWall(summary: OpsSummary): OpsWallBlock {
]; ];
return { return {
boards: [{ title: "Cibello", tiles }], boards: [{ title: "{brand}", tiles }],
}; };
} }