statistiques/src/notion/publish/v2/publishStatsGenerales.ts
2024-09-20 12:55:52 +02:00

33 lines
1 KiB
TypeScript

import { Client } from "@notionhq/client";
import { createMermaidCodeBlock } from "../blocks/createMermaidCodeBlock";
import { createParagraphBlock } from "../blocks/createParagraphBlock";
import { createStatGroupChildrenListItemBlock } from "./createStatGroupListItemBlock";
import { updatePageContent } from "./updatePageContent";
import {
StatsGenerales,
statsGeneralesDesc,
} from "../../../statistiques/v2/generales/StatsGenerales";
export async function publishStatsGenerales(
notionClient: Client,
header: string,
statsGenerales: StatsGenerales,
mermaidDiagramStatsGeneralesMensuelles: string
) {
const headerBlock = createParagraphBlock(header);
const statsBlocks = createStatGroupChildrenListItemBlock(
statsGeneralesDesc,
statsGenerales
);
const diagramBlock = createMermaidCodeBlock(
mermaidDiagramStatsGeneralesMensuelles
);
const blocks = [headerBlock, ...statsBlocks, diagramBlock];
await updatePageContent(
notionClient,
"313751fb-daed-4b33-992f-c86d7ac2de37",
blocks
);
}