Remove unused redirects from the Next.js configuration and update package dependencies to include new Tiptap extensions for enhanced text editing capabilities. Clean up the database seeding script by removing commented-out code and ensuring proper deletion of obsolete entries. Update various pages to handle not found scenarios gracefully, improving user experience across the application.

This commit is contained in:
smhk1376 committed 2026-10-28 14:04:17 +03:30
1 parent 4b84409ed7
commit 2858b9c746
106 files changed
+2516 -1004

No files matched your search

@@ -0,0 +1,8 @@
-- Public sections other than courses are retired.
-- Drop their rows so they cannot be served or listed again.
DELETE FROM articles;
DELETE FROM events;
DELETE FROM programs;
DELETE FROM intersection_topics;
DELETE FROM alumni_stories;
DELETE FROM testimonials;
+4
View File
@@ -0,0 +1,4 @@
-- Optional schedule for a course: when it starts, and when it is held.
ALTER TABLE courses
ADD COLUMN IF NOT EXISTS start_date DATE,
ADD COLUMN IF NOT EXISTS held_date DATE;
+21
View File
@@ -0,0 +1,21 @@
-- News items shown on /news. Separate from articles (long-form insights).
CREATE TABLE IF NOT EXISTS news_items (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
banner_image_url TEXT NOT NULL,
body TEXT NOT NULL,
gallery_images JSONB NOT NULL DEFAULT '[]',
published_at DATE NOT NULL,
published BOOLEAN DEFAULT true,
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_news_items_published_at
ON news_items (published, published_at DESC);
DROP TRIGGER IF EXISTS trg_news_items_set_updated_at ON news_items;
CREATE TRIGGER trg_news_items_set_updated_at
BEFORE UPDATE ON news_items
FOR EACH ROW EXECUTE FUNCTION set_updated_at();
+6
View File
@@ -0,0 +1,6 @@
-- One date per course: when it starts being held.
UPDATE courses
SET start_date = held_date
WHERE start_date IS NULL AND held_date IS NOT NULL;
ALTER TABLE courses DROP COLUMN IF EXISTS held_date;
+11 -33
View File
@@ -8,17 +8,11 @@ import { fileURLToPath } from "node:url";
import pg from "pg";
import { courses } from "../src/lib/mock/courses.ts";
import { programs } from "../src/lib/mock/programs.ts";
import { events } from "../src/lib/mock/events.ts";
import { articles } from "../src/lib/mock/articles.ts";
import {
alumniStories,
campaignBanners,
faculty,
intersections,
legalPages,
stats,
testimonials,
} from "../src/lib/mock/site.ts";
import {
SEED_COURSE_CATEGORIES,
@@ -26,17 +20,11 @@ import {
} from "../src/lib/taxonomy.ts";
import {
alumniStoryToRow,
articleToRow,
campaignBannerToRow,
courseToRow,
eventToRow,
facultyMemberToRow,
intersectionTopicToRow,
legalPageToRow,
programToRow,
siteStatToRow,
testimonialToRow,
} from "../src/lib/db/mappers.ts";
if (!process.env.DATABASE_URL) {
@@ -156,29 +144,22 @@ async function main() {
}
results.push(["course_category_links", catLinks]);
results.push(["course_tag_links", tagLinks]);
await upsert("programs", programs.map(programToRow), [
"id", "slug", "title", "blurb", "group_key", "href", "tagline", "audience",
"duration_label", "format_label", "highlights", "body", "published",
]);
await upsert("events", events.map(eventToRow), [
"id", "title", "start_date", "end_date", "location", "href", "summary", "published",
]);
await upsert("articles", articles.map(articleToRow), [
"id", "title", "category", "excerpt", "image_url", "href", "featured",
"body", "published_at", "author", "published",
]);
await client.query(`DELETE FROM intersection_topics`);
await upsert("intersection_topics", intersections.map(intersectionTopicToRow), [
"id", "slug", "title", "description", "href", "image_url", "body", "highlights", "published",
]);
for (const table of [
"programs",
"events",
"articles",
"intersection_topics",
"alumni_stories",
"testimonials",
]) {
const deleted = await client.query(`DELETE FROM ${table}`);
results.push([`${table}_cleared`, deleted.rowCount]);
}
await upsert("faculty_members", faculty.map(facultyMemberToRow), [
"id", "name", "title", "focus", "bio", "image_url",
"email", "office", "phone", "department", "linkedin_url", "scholar_url",
"published",
]);
await upsert("alumni_stories", alumniStories.map(alumniStoryToRow), [
"id", "title", "excerpt", "name", "program", "image_url", "href", "published",
]);
await upsert("campaign_banners", campaignBanners.map(campaignBannerToRow), [
"id", "version", "text", "href", "cta", "published",
]);
@@ -188,9 +169,6 @@ async function main() {
await upsert("site_stats", stats.map(siteStatToRow), [
"id", "value", "label", "published",
]);
await upsert("testimonials", testimonials.map(testimonialToRow), [
"id", "quote", "name", "role", "course_title", "published",
]);
const counts = await client.query(`
SELECT (SELECT count(*) FROM courses) AS courses,