feat : add stygian guide

This commit is contained in:
2026-09-29 21:23:18 +07:00 Unverified
parent 1654d3df3a
commit 69a4d34b97
27 changed files with 11196 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import "server-only";
import { cacheLife, cacheTag } from "next/cache";
import { getActiveStygianSchedule } from "@/lib/stygian/repository";
import { STYGIAN_CACHE_TAG } from "@/lib/cache/tags";
export { STYGIAN_CACHE_TAG };
export async function getCachedActiveStygianSchedule() {
"use cache: remote";
cacheLife({ stale: 30, revalidate: 60, expire: 60 * 60 });
cacheTag(STYGIAN_CACHE_TAG);
return getActiveStygianSchedule();
}
+2
View File
@@ -3,12 +3,14 @@ import { describe, expect, it } from "vitest";
import {
cacheTagsForOutboxEvent,
DIRECTORY_CACHE_TAG,
STYGIAN_CACHE_TAG,
} from "./tags";
describe("public cache tags", () => {
it("maps outbox events to dependency-aware tags", () => {
expect(cacheTagsForOutboxEvent({ eventType: "directory.updated", aggregateId: "id" })).toEqual([DIRECTORY_CACHE_TAG]);
expect(cacheTagsForOutboxEvent({ eventType: "page.updated", aggregateId: "page" })).toEqual(["buzz:page:page"]);
expect(cacheTagsForOutboxEvent({ eventType: "stygian.updated", aggregateId: "5269001" })).toEqual([STYGIAN_CACHE_TAG]);
expect(cacheTagsForOutboxEvent({ eventType: "admin.updated", aggregateId: "id" })).toEqual([]);
});
});
+2
View File
@@ -1,5 +1,6 @@
export const DIRECTORY_CACHE_TAG = "buzz:directory";
export const GLOSSARY_CACHE_TAG = "buzz:glossary";
export const STYGIAN_CACHE_TAG = "buzz:stygian";
export function pageCacheTag(pageId: string): string {
return `buzz:page:${pageId}`;
@@ -13,5 +14,6 @@ export type OutboxCacheEvent = {
export function cacheTagsForOutboxEvent(event: OutboxCacheEvent): string[] {
if (event.eventType === "directory.updated") return [DIRECTORY_CACHE_TAG];
if (event.eventType === "page.updated") return [pageCacheTag(event.aggregateId)];
if (event.eventType === "stygian.updated") return [STYGIAN_CACHE_TAG];
return [];
}