fix(ops): interpolera varumärke i wall board från brand.config.json
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { timingSafeEqual } from "node:crypto";
|
||||
import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
import BRAND from "../../../../brand.config.json" with { type: "json" };
|
||||
import { errors } from "../lib/errors.js";
|
||||
|
||||
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." } });
|
||||
}
|
||||
|
||||
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({
|
||||
...summary,
|
||||
...enriched,
|
||||
cached_at: ts ?? summary.as_of,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -588,7 +588,7 @@ export function buildWall(summary: OpsSummary): OpsWallBlock {
|
||||
];
|
||||
|
||||
return {
|
||||
boards: [{ title: "Cibello", tiles }],
|
||||
boards: [{ title: "{brand}", tiles }],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user