Fix Directus queries: disable messages collection, fix projects translations, fix featured boolean
Co-authored-by: denshooter <44590296+denshooter@users.noreply.github.com>
This commit is contained in:
@@ -92,6 +92,12 @@ async function directusRequest<T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getMessage(key: string, locale: string): Promise<string | null> {
|
export async function getMessage(key: string, locale: string): Promise<string | null> {
|
||||||
|
// Note: messages collection doesn't exist in Directus yet
|
||||||
|
// The app uses JSON files as fallback via i18n-loader
|
||||||
|
// Return null to skip Directus and use JSON fallback directly
|
||||||
|
return null;
|
||||||
|
|
||||||
|
/* Commented out until messages collection is created in Directus
|
||||||
const directusLocale = toDirectusLocale(locale);
|
const directusLocale = toDirectusLocale(locale);
|
||||||
|
|
||||||
// GraphQL Query für Directus Native Translations
|
// GraphQL Query für Directus Native Translations
|
||||||
@@ -132,6 +138,7 @@ export async function getMessage(key: string, locale: string): Promise<string |
|
|||||||
console.error(`Failed to fetch message ${key} (${locale}):`, error);
|
console.error(`Failed to fetch message ${key} (${locale}):`, error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getContentPage(
|
export async function getContentPage(
|
||||||
@@ -465,7 +472,7 @@ export async function getProjects(
|
|||||||
const filters = ['status: { _eq: "published" }'];
|
const filters = ['status: { _eq: "published" }'];
|
||||||
|
|
||||||
if (options?.featured !== undefined) {
|
if (options?.featured !== undefined) {
|
||||||
filters.push(`featured: { _eq: ${options.featured ? 1 : 0} }`);
|
filters.push(`featured: { _eq: ${options.featured ? 'true' : 'false'} }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove published filter since it doesn't exist in Directus schema
|
// Remove published filter since it doesn't exist in Directus schema
|
||||||
@@ -503,6 +510,9 @@ export async function getProjects(
|
|||||||
difficulty
|
difficulty
|
||||||
tags
|
tags
|
||||||
technologies
|
technologies
|
||||||
|
challenges
|
||||||
|
lessons_learned
|
||||||
|
future_improvements
|
||||||
github
|
github
|
||||||
live
|
live
|
||||||
image_url
|
image_url
|
||||||
@@ -515,9 +525,8 @@ export async function getProjects(
|
|||||||
title
|
title
|
||||||
description
|
description
|
||||||
content
|
content
|
||||||
challenges
|
meta_description
|
||||||
lessons_learned
|
keywords
|
||||||
future_improvements
|
|
||||||
languages_code { code }
|
languages_code { code }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -550,9 +559,9 @@ export async function getProjects(
|
|||||||
difficulty: proj.difficulty,
|
difficulty: proj.difficulty,
|
||||||
tags: proj.tags || [],
|
tags: proj.tags || [],
|
||||||
technologies: proj.technologies || [],
|
technologies: proj.technologies || [],
|
||||||
challenges: trans.challenges,
|
challenges: proj.challenges,
|
||||||
lessons_learned: trans.lessons_learned,
|
lessons_learned: proj.lessons_learned,
|
||||||
future_improvements: trans.future_improvements,
|
future_improvements: proj.future_improvements,
|
||||||
github_url: proj.github,
|
github_url: proj.github,
|
||||||
live_url: proj.live,
|
live_url: proj.live,
|
||||||
image_url: proj.image_url,
|
image_url: proj.image_url,
|
||||||
|
|||||||
Reference in New Issue
Block a user