Ship site UI checklist, move admin to /mstcontroller, and add safe taxonomy label migration.
Deploy edu.mstaut.ir / deploy (push) Has been cancelled
Deploy edu.mstaut.ir / deploy (push) Has been cancelled
Production already has migrations through 008; 009 only updates four seed labels by id. Faculty sync remains upsert-by-email/name and does not wipe curated data. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3eea1c35a6
commit
2b0db26a93
171 files changed
+1477
-807
No files matched your search
+12
-2
@@ -3,20 +3,30 @@ import type { Course } from "@/lib/types";
|
||||
import { rowToCourse, type CourseRow } from "@/lib/db/mappers";
|
||||
import { COURSE_WITH_TAXONOMY_SELECT } from "@/lib/data/course-taxonomy-sql";
|
||||
|
||||
/** Past offerings tagged `tag-archive` — lowest catalog priority; excluded from home. */
|
||||
const ARCHIVE_TAG_ID = "tag-archive";
|
||||
|
||||
const isArchiveCourseSql = `EXISTS (
|
||||
SELECT 1 FROM course_tag_links ctl
|
||||
WHERE ctl.course_id = c.id AND ctl.tag_id = '${ARCHIVE_TAG_ID}'
|
||||
)`;
|
||||
|
||||
export async function getCourses(): Promise<Course[]> {
|
||||
const res = await query<CourseRow>(
|
||||
`${COURSE_WITH_TAXONOMY_SELECT}
|
||||
WHERE c.published = true
|
||||
ORDER BY c.title ASC`,
|
||||
ORDER BY CASE WHEN ${isArchiveCourseSql} THEN 1 ELSE 0 END ASC,
|
||||
c.title ASC`,
|
||||
);
|
||||
return res.rows.map(rowToCourse);
|
||||
}
|
||||
|
||||
/** Latest published courses for home preview (newest first). */
|
||||
/** Latest published courses for home preview (newest first; archive excluded). */
|
||||
export async function getLatestCourses(limit = 6): Promise<Course[]> {
|
||||
const res = await query<CourseRow>(
|
||||
`${COURSE_WITH_TAXONOMY_SELECT}
|
||||
WHERE c.published = true
|
||||
AND NOT ${isArchiveCourseSql}
|
||||
ORDER BY c.created_at DESC, c.title ASC
|
||||
LIMIT $1`,
|
||||
[limit],
|
||||
|
||||
Reference in new issue
Block a user