Enhance Next.js configuration and dependencies for improved functionality and localization support. Added support for internationalization with next-intl, updated global styles, and integrated new fonts. Removed default home page and updated README with project details and setup instructions.
This commit is contained in:
1 parent
2911dea00b
commit
44f4fa98e2
320 files changed
+31666
-220
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { query } from "@/lib/db";
|
||||
import type { Course } from "@/lib/types";
|
||||
import { rowToCourse, type CourseRow } from "@/lib/db/mappers";
|
||||
|
||||
export async function getCourses(): Promise<Course[]> {
|
||||
const res = await query<CourseRow>(
|
||||
"SELECT * FROM courses WHERE published = true ORDER BY title ASC",
|
||||
);
|
||||
return res.rows.map(rowToCourse);
|
||||
}
|
||||
|
||||
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",
|
||||
[id],
|
||||
);
|
||||
return res.rows[0] ? rowToCourse(res.rows[0]) : null;
|
||||
}
|
||||
Reference in new issue
Block a user