Enhance image upload functionality for admin and improve course navigation. Added support for image uploads in course forms and generic forms, utilizing a new ImageUploadField component. Updated navigation to dynamically include course tags and refined layout components for better user experience. Configured Docker for persistent uploads with a dedicated volume.

This commit is contained in:
smhk1376 committed 2026-10-11 21:05:52 +03:30
1 parent ef1ccea0ad
commit 66a8e8f213
29 files changed
+748 -125

No files matched your search

+12
View File
@@ -9,6 +9,18 @@ export async function getCourses(): Promise<Course[]> {
return res.rows.map(rowToCourse);
}
/** Distinct tags on published courses, most-used first (for public nav/filters). */
export async function listPublishedCourseTags(): Promise<string[]> {
const res = await query<{ tag: string }>(
`SELECT tag
FROM courses, UNNEST(tags) AS tag
WHERE published = true
GROUP BY tag
ORDER BY COUNT(*) DESC, tag ASC`,
);
return res.rows.map((r) => r.tag);
}
export async function getCourseById(id: string): Promise<Course | null> {
const res = await query<CourseRow>(
"SELECT * FROM courses WHERE published = true AND (id = $1 OR slug = $1) LIMIT 1",