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:
1 parent
ef1ccea0ad
commit
66a8e8f213
29 files changed
+748
-125
No files matched your search
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user