project setup with core files including configuration, package management, and basic structure. Added .gitignore, README, and various TypeScript types for CMS components. Implemented initial components and layouts for the application.

This commit is contained in:
Peter Meier
2025-12-13 23:26:13 +01:00
parent ea288a5bbc
commit b1a556dc6d
167 changed files with 19057 additions and 131 deletions

View File

@@ -0,0 +1,32 @@
import ApolloServerPluginResponseCache from "@apollo/server-plugin-response-cache";
import type { GraphQLRequestContext } from "@apollo/server";
/**
* Response Caching Plugin für Apollo Server
* Cached GraphQL Responses basierend auf Query und Variablen
*/
export const createResponseCachePlugin = () => {
return ApolloServerPluginResponseCache({
// Session-ID für User-spezifisches Caching
sessionId: async (
requestContext: GraphQLRequestContext<any>
): Promise<string | null> => {
// Optional: User-ID aus Headers oder Context
const userId = requestContext.request.http?.headers.get("x-user-id");
return userId || null;
},
// Cache nur bei erfolgreichen Queries
shouldWriteToCache: async (
requestContext: GraphQLRequestContext<any>
): Promise<boolean> => {
const query = requestContext.request.query;
if (!query) return false;
// Cache nur bestimmte Queries
const cacheableQueries = ["products", "pageSeo", "navigation", "page"];
return cacheableQueries.some((q) => query.includes(q));
},
});
};