Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a60718aaf9 | ||
|
|
2858b9c746 | ||
|
|
8cf4490f21 | ||
|
|
4b84409ed7 | ||
|
|
1641edfd01 | ||
|
|
0a57ef2b80 | ||
|
|
7d7b55f060 | ||
|
|
fe3d153ef1 | ||
|
|
29b71c228e | ||
|
|
e1b5286946 | ||
|
|
bd2cfa5a26 | ||
|
|
afd2b3333c | ||
|
|
05b0a1af72 | ||
|
|
5b0a394216 | ||
|
|
2709181557 |
No files matched your search
@@ -18,6 +18,9 @@
|
|||||||
.claude
|
.claude
|
||||||
skills
|
skills
|
||||||
|
|
||||||
|
# unused design candidates (not referenced by the app)
|
||||||
|
/public/CandidatesIMages
|
||||||
|
|
||||||
# project meta / docs
|
# project meta / docs
|
||||||
memory-bank
|
memory-bank
|
||||||
docs
|
docs
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: local-host
|
runs-on: local-host
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout and deploy on the VPS
|
- name: Build and deploy on the VPS
|
||||||
env:
|
env:
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
REPO_ACTOR: ${{ github.actor }}
|
REPO_ACTOR: ${{ github.actor }}
|
||||||
@@ -27,16 +27,13 @@ jobs:
|
|||||||
git -C "$TARGET" init
|
git -C "$TARGET" init
|
||||||
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
|
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
|
||||||
fi
|
fi
|
||||||
# Clear stale locks from interrupted shallow fetches (common after crash/timeout).
|
|
||||||
# This checkout is deploy-only; concurrency group already serializes jobs.
|
|
||||||
rm -f \
|
rm -f \
|
||||||
"$TARGET/.git/shallow.lock" \
|
"$TARGET/.git/shallow.lock" \
|
||||||
"$TARGET/.git/index.lock" \
|
"$TARGET/.git/index.lock" \
|
||||||
"$TARGET/.git/HEAD.lock" \
|
"$TARGET/.git/HEAD.lock" \
|
||||||
"$TARGET/.git/config.lock"
|
"$TARGET/.git/config.lock"
|
||||||
# Supply the job token only for fetch; never store it in .git/config.
|
|
||||||
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
|
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
|
||||||
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"
|
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"
|
||||||
unset AUTH REPO_TOKEN
|
unset AUTH REPO_TOKEN
|
||||||
git -C "$TARGET" checkout --detach --force FETCH_HEAD
|
git -C "$TARGET" checkout --detach --force FETCH_HEAD
|
||||||
bash "$TARGET/scripts/deploy-production.sh"
|
bash "$TARGET/scripts/vps-autodeploy.sh"
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/.npm-cache
|
||||||
/.pnp
|
/.pnp
|
||||||
.pnp.*
|
.pnp.*
|
||||||
.yarn/*
|
.yarn/*
|
||||||
@@ -24,9 +25,9 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
*.pem
|
*.pem
|
||||||
|
|
||||||
# admin-uploaded images (keep folder via .gitkeep)
|
# admin-uploaded images (served by GET /uploads/[...path], not public/)
|
||||||
/public/uploads/*
|
/uploads/
|
||||||
!/public/uploads/.gitkeep
|
/public/uploads/
|
||||||
|
|
||||||
# debug
|
# debug
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
@@ -37,6 +38,9 @@ yarn-error.log*
|
|||||||
# env files (can opt-in for committing if needed)
|
# env files (can opt-in for committing if needed)
|
||||||
.env*
|
.env*
|
||||||
|
|
||||||
|
# local database dumps — never commit
|
||||||
|
/backups/
|
||||||
|
|
||||||
# vercel
|
# vercel
|
||||||
.vercel
|
.vercel
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,11 @@ COPY --from=builder /app/public ./public
|
|||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
# Writable dir for admin image uploads (mount a volume in compose for persistence)
|
# Writable dir for admin image uploads (mount a volume in compose for persistence).
|
||||||
RUN mkdir -p ./public/uploads && chown -R nextjs:nodejs ./public/uploads
|
# Keep this outside public/: Next standalone does not serve runtime public files.
|
||||||
|
RUN rm -rf ./public/uploads \
|
||||||
|
&& mkdir -p ./uploads \
|
||||||
|
&& chown -R nextjs:nodejs ./uploads
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ COPY --chown=nextjs:nodejs . ./
|
|||||||
# Next warns/breaks if a legacy root-level ./static exists alongside ./public
|
# Next warns/breaks if a legacy root-level ./static exists alongside ./public
|
||||||
RUN rm -rf ./static
|
RUN rm -rf ./static
|
||||||
|
|
||||||
# Writable dir for admin image uploads (mount a volume in compose for persistence)
|
# Writable dir for admin image uploads (mount a volume in compose for persistence).
|
||||||
RUN mkdir -p ./public/uploads && chown -R nextjs:nodejs ./public/uploads
|
# Keep this outside public/: Next standalone does not serve runtime public files.
|
||||||
|
RUN rm -rf ./public/uploads \
|
||||||
|
&& mkdir -p ./uploads \
|
||||||
|
&& chown -R nextjs:nodejs ./uploads
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Rich HTML fields for course detail: ad lead under hero title + main body.
|
||||||
|
ALTER TABLE courses
|
||||||
|
ADD COLUMN IF NOT EXISTS lead_html TEXT NOT NULL DEFAULT '',
|
||||||
|
ADD COLUMN IF NOT EXISTS body_html TEXT NOT NULL DEFAULT '';
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- Catalog pin + manual order for current courses.
|
||||||
|
-- Archive grouping still uses tag-archive; featured never lifts an archive course.
|
||||||
|
ALTER TABLE courses
|
||||||
|
ADD COLUMN IF NOT EXISTS featured BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
ADD COLUMN IF NOT EXISTS sort_order INT NOT NULL DEFAULT 0;
|
||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -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();
|
||||||
@@ -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;
|
||||||
@@ -8,17 +8,11 @@ import { fileURLToPath } from "node:url";
|
|||||||
import pg from "pg";
|
import pg from "pg";
|
||||||
|
|
||||||
import { courses } from "../src/lib/mock/courses.ts";
|
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 {
|
import {
|
||||||
alumniStories,
|
|
||||||
campaignBanners,
|
campaignBanners,
|
||||||
faculty,
|
faculty,
|
||||||
intersections,
|
|
||||||
legalPages,
|
legalPages,
|
||||||
stats,
|
stats,
|
||||||
testimonials,
|
|
||||||
} from "../src/lib/mock/site.ts";
|
} from "../src/lib/mock/site.ts";
|
||||||
import {
|
import {
|
||||||
SEED_COURSE_CATEGORIES,
|
SEED_COURSE_CATEGORIES,
|
||||||
@@ -26,17 +20,11 @@ import {
|
|||||||
} from "../src/lib/taxonomy.ts";
|
} from "../src/lib/taxonomy.ts";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
alumniStoryToRow,
|
|
||||||
articleToRow,
|
|
||||||
campaignBannerToRow,
|
campaignBannerToRow,
|
||||||
courseToRow,
|
courseToRow,
|
||||||
eventToRow,
|
|
||||||
facultyMemberToRow,
|
facultyMemberToRow,
|
||||||
intersectionTopicToRow,
|
|
||||||
legalPageToRow,
|
legalPageToRow,
|
||||||
programToRow,
|
|
||||||
siteStatToRow,
|
siteStatToRow,
|
||||||
testimonialToRow,
|
|
||||||
} from "../src/lib/db/mappers.ts";
|
} from "../src/lib/db/mappers.ts";
|
||||||
|
|
||||||
if (!process.env.DATABASE_URL) {
|
if (!process.env.DATABASE_URL) {
|
||||||
@@ -121,7 +109,9 @@ async function main() {
|
|||||||
|
|
||||||
await upsert("courses", courses.map(courseToRow), [
|
await upsert("courses", courses.map(courseToRow), [
|
||||||
"id", "slug", "title", "summary", "duration_hours", "format", "price",
|
"id", "slug", "title", "summary", "duration_hours", "format", "price",
|
||||||
"registration_url", "poster_image_url", "brochure_image_url", "image_url", "seo_description", "published",
|
"registration_url", "poster_image_url", "brochure_image_url", "image_url",
|
||||||
|
"lead_html", "body_html", "seo_description", "published", "featured",
|
||||||
|
"sort_order",
|
||||||
]);
|
]);
|
||||||
const courseIds = courses.map((c) => c.id);
|
const courseIds = courses.map((c) => c.id);
|
||||||
await client.query(
|
await client.query(
|
||||||
@@ -154,29 +144,22 @@ async function main() {
|
|||||||
}
|
}
|
||||||
results.push(["course_category_links", catLinks]);
|
results.push(["course_category_links", catLinks]);
|
||||||
results.push(["course_tag_links", tagLinks]);
|
results.push(["course_tag_links", tagLinks]);
|
||||||
await upsert("programs", programs.map(programToRow), [
|
for (const table of [
|
||||||
"id", "slug", "title", "blurb", "group_key", "href", "tagline", "audience",
|
"programs",
|
||||||
"duration_label", "format_label", "highlights", "body", "published",
|
"events",
|
||||||
]);
|
"articles",
|
||||||
await upsert("events", events.map(eventToRow), [
|
"intersection_topics",
|
||||||
"id", "title", "start_date", "end_date", "location", "href", "summary", "published",
|
"alumni_stories",
|
||||||
]);
|
"testimonials",
|
||||||
await upsert("articles", articles.map(articleToRow), [
|
]) {
|
||||||
"id", "title", "category", "excerpt", "image_url", "href", "featured",
|
const deleted = await client.query(`DELETE FROM ${table}`);
|
||||||
"body", "published_at", "author", "published",
|
results.push([`${table}_cleared`, deleted.rowCount]);
|
||||||
]);
|
}
|
||||||
await client.query(`DELETE FROM intersection_topics`);
|
|
||||||
await upsert("intersection_topics", intersections.map(intersectionTopicToRow), [
|
|
||||||
"id", "slug", "title", "description", "href", "image_url", "body", "highlights", "published",
|
|
||||||
]);
|
|
||||||
await upsert("faculty_members", faculty.map(facultyMemberToRow), [
|
await upsert("faculty_members", faculty.map(facultyMemberToRow), [
|
||||||
"id", "name", "title", "focus", "bio", "image_url",
|
"id", "name", "title", "focus", "bio", "image_url",
|
||||||
"email", "office", "phone", "department", "linkedin_url", "scholar_url",
|
"email", "office", "phone", "department", "linkedin_url", "scholar_url",
|
||||||
"published",
|
"published",
|
||||||
]);
|
]);
|
||||||
await upsert("alumni_stories", alumniStories.map(alumniStoryToRow), [
|
|
||||||
"id", "title", "excerpt", "name", "program", "image_url", "href", "published",
|
|
||||||
]);
|
|
||||||
await upsert("campaign_banners", campaignBanners.map(campaignBannerToRow), [
|
await upsert("campaign_banners", campaignBanners.map(campaignBannerToRow), [
|
||||||
"id", "version", "text", "href", "cta", "published",
|
"id", "version", "text", "href", "cta", "published",
|
||||||
]);
|
]);
|
||||||
@@ -186,9 +169,6 @@ async function main() {
|
|||||||
await upsert("site_stats", stats.map(siteStatToRow), [
|
await upsert("site_stats", stats.map(siteStatToRow), [
|
||||||
"id", "value", "label", "published",
|
"id", "value", "label", "published",
|
||||||
]);
|
]);
|
||||||
await upsert("testimonials", testimonials.map(testimonialToRow), [
|
|
||||||
"id", "quote", "name", "role", "course_title", "published",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const counts = await client.query(`
|
const counts = await client.query(`
|
||||||
SELECT (SELECT count(*) FROM courses) AS courses,
|
SELECT (SELECT count(*) FROM courses) AS courses,
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ services:
|
|||||||
- HOSTNAME=0.0.0.0
|
- HOSTNAME=0.0.0.0
|
||||||
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://edu.mstaut.ir}
|
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-https://edu.mstaut.ir}
|
||||||
- DATABASE_URL=${DATABASE_URL:?Set DATABASE_URL in a protected environment file}
|
- DATABASE_URL=${DATABASE_URL:?Set DATABASE_URL in a protected environment file}
|
||||||
- UPLOAD_DIR=/app/public/uploads
|
- UPLOAD_DIR=/app/uploads
|
||||||
# Nginx Proxy Manager: edu.mstaut.ir → http://aut-management-faculty:3000
|
# Nginx Proxy Manager: edu.mstaut.ir → http://aut-management-faculty:3000
|
||||||
# DB: same Docker network as container `insaight-postgres` (not the public IP).
|
# DB: same Docker network as container `insaight-postgres` (not the public IP).
|
||||||
volumes:
|
volumes:
|
||||||
- uploads_data:/app/public/uploads
|
- uploads_data:/app/uploads
|
||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
networks:
|
networks:
|
||||||
@@ -32,3 +32,5 @@ networks:
|
|||||||
shared_web_network:
|
shared_web_network:
|
||||||
external: true
|
external: true
|
||||||
name: shared_web_network
|
name: shared_web_network
|
||||||
|
|
||||||
|
# TEST
|
||||||
@@ -47,6 +47,8 @@
|
|||||||
|---|---|
|
|---|---|
|
||||||
| `course.categories` | many-to-many با `course_categories` (موضوع؛ ادمین) |
|
| `course.categories` | many-to-many با `course_categories` (موضوع؛ ادمین) |
|
||||||
| `course.tags` | many-to-many با `course_tags` (نوع/منو؛ ادمین) |
|
| `course.tags` | many-to-many با `course_tags` (نوع/منو؛ ادمین) |
|
||||||
|
| `course.featured` | تیک ویژه؛ چند دورهٔ جاری میتوانند ویژه باشند (محدودیت تکویژهٔ مقاله اینجا نیست) |
|
||||||
|
| `course.sortOrder` | عدد ترتیب؛ کوچکتر جلوتر (مثل دسته/تگ) |
|
||||||
| `program.group` | `standard` یا `executive` برای selector هوم |
|
| `program.group` | `standard` یا `executive` برای selector هوم |
|
||||||
| `event.endDate` | اگر null باشد رویداد تکروزه است |
|
| `event.endDate` | اگر null باشد رویداد تکروزه است |
|
||||||
| `article.featured` | حداکثر یک مقاله featured در هوم |
|
| `article.featured` | حداکثر یک مقاله featured در هوم |
|
||||||
@@ -58,6 +60,8 @@
|
|||||||
- هیچ مبلغ/ظرفیت واقعی محاسبه نمیشود تا DB وصل شود.
|
- هیچ مبلغ/ظرفیت واقعی محاسبه نمیشود تا DB وصل شود.
|
||||||
- منوی صفحهٔ اصلی فقط **یک** دراپداون دوره دارد؛ لیبل ریشه = `courseNavParentTag`؛ فرزندان = تگهای `show_in_nav`. فیلتر پایدار با **slug**: `/professional?tag=` و `/professional?category=` (مستند: `docs/LINKS.md`).
|
- منوی صفحهٔ اصلی فقط **یک** دراپداون دوره دارد؛ لیبل ریشه = `courseNavParentTag`؛ فرزندان = تگهای `show_in_nav`. فیلتر پایدار با **slug**: `/professional?tag=` و `/professional?category=` (مستند: `docs/LINKS.md`).
|
||||||
- دسته و تگ فقط از ادمین تعریف میشوند (`/admin/course-categories`، `/admin/course-tags`)؛ هر دوره میتواند چند دسته و چند تگ داشته باشد.
|
- دسته و تگ فقط از ادمین تعریف میشوند (`/admin/course-categories`، `/admin/course-tags`)؛ هر دوره میتواند چند دسته و چند تگ داشته باشد.
|
||||||
|
- ترتیب لیست عمومی دوره: غیرآرشیو، سپس `featured`، سپس `sort_order` صعودی، سپس عنوان. هوم و جستجو همین ترتیب را میگیرند؛ هوم آرشیو را نشان نمیدهد.
|
||||||
|
- تگ `archive` (گزیدهٔ برگزارشده) در کتالوگ بلوک جدا و ظاهر ملایمتر است؛ `featured` دورهٔ آرشیو را به بلوک جاری بالا نمیآورد.
|
||||||
|
|
||||||
## Locale / Format Rules
|
## Locale / Format Rules
|
||||||
- زبان UI: فارسی؛ `dir="rtl"`؛ اعداد نمایشی میتوانند فارسیسازی شوند در لایهٔ UI.
|
- زبان UI: فارسی؛ `dir="rtl"`؛ اعداد نمایشی میتوانند فارسیسازی شوند در لایهٔ UI.
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ node scripts/test-db-connection.mjs
|
|||||||
|
|
||||||
| جدول | نکته |
|
| جدول | نکته |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `courses` | `category`/`format` با CHECK؛ `slug` UNIQUE؛ `price` اختیاری (تومان، NULL = مخفی در UI) |
|
| `courses` | `format` با CHECK؛ `slug` UNIQUE؛ `price` اختیاری؛ `featured` + `sort_order` (migration 011) |
|
||||||
| `programs` | `group_key` (بهجای reserve واژهٔ `group`)؛ `highlights` JSONB |
|
| `programs` | `group_key` (بهجای reserve واژهٔ `group`)؛ `highlights` JSONB |
|
||||||
| `events` | `start_date`/`end_date` DATE؛ `end_date` NULL = تکروزه |
|
| `events` | `start_date`/`end_date` DATE؛ `end_date` NULL = تکروزه |
|
||||||
| `articles` | `featured` + ایندکس جزئی `articles_one_featured` (حداکثر یک مقالهٔ published با `featured=true`) |
|
| `articles` | `featured` + ایندکس جزئی `articles_one_featured` (حداکثر یک مقالهٔ published با `featured=true`) |
|
||||||
@@ -98,6 +98,12 @@ node scripts/test-db-connection.mjs
|
|||||||
- `idx_programs_title` / `idx_courses_title` روی `(published, title)`.
|
- `idx_programs_title` / `idx_courses_title` روی `(published, title)`.
|
||||||
- `courses.slug`, `programs.slug`, `intersection_topics.slug` از 001 UNIQUE هستند و ایندکس جزئی `articles_one_featured` از 001 موجود است — تکرار نشدهاند.
|
- `courses.slug`, `programs.slug`, `intersection_topics.slug` از 001 UNIQUE هستند و ایندکس جزئی `articles_one_featured` از 001 موجود است — تکرار نشدهاند.
|
||||||
|
|
||||||
|
## اولویت کاتالوگ (011)
|
||||||
|
|
||||||
|
- Migration: `db/migrations/011_course_priority.sql`.
|
||||||
|
- `courses.featured BOOLEAN NOT NULL DEFAULT false` و `courses.sort_order INT NOT NULL DEFAULT 0`.
|
||||||
|
- لیست عمومی: غیرآرشیو (`tag-archive`) سپس ویژه سپس `sort_order` سپس عنوان. آرشیو با تگ جدا میشود، نه با ستون جدید.
|
||||||
|
|
||||||
## Admin (فاز E — 2026-09-22)
|
## Admin (فاز E — 2026-09-22)
|
||||||
|
|
||||||
- مکانیزم: `admin_users` (رمز با scrypt در `password_hash`، هرگز plaintext) + `admin_sessions` (توکن تصادفی؛ `token_hash` در DB ذخیره میشود؛ cookie فقط `admin_session` HttpOnly/SameSite=Lax).
|
- مکانیزم: `admin_users` (رمز با scrypt در `password_hash`، هرگز plaintext) + `admin_sessions` (توکن تصادفی؛ `token_hash` در DB ذخیره میشود؛ cookie فقط `admin_session` HttpOnly/SameSite=Lax).
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
| فیلتر با تگ | `/professional?tag=<slug>` |
|
| فیلتر با تگ | `/professional?tag=<slug>` |
|
||||||
| فیلتر با دسته | `/professional?category=<slug>` |
|
| فیلتر با دسته | `/professional?category=<slug>` |
|
||||||
| هر دو فیلتر | `/professional?tag=<slug>&category=<slug>` |
|
| هر دو فیلتر | `/professional?tag=<slug>&category=<slug>` |
|
||||||
|
| گزیدهٔ برگزارشده | `/professional?tag=archive` (در لیست کامل، بلوک جدا زیر دورههای جاری) |
|
||||||
|
|
||||||
### تگ پدر (لیبل منو)
|
### تگ پدر (لیبل منو)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
# Production deployment
|
# Production deployment
|
||||||
|
|
||||||
The production site is https://edu.mstaut.ir. Gitea runs on the same VPS.
|
The production site is https://edu.mstaut.ir. Gitea runs on the same VPS.
|
||||||
Pushes to `master` run `.gitea/workflows/deploy.yml` on the existing
|
|
||||||
`local-host` runner. The checkout lives at `/opt/prod/Aut.ManagementFaculty`.
|
|
||||||
|
|
||||||
`scripts/deploy-production.sh` builds a Next.js standalone Docker image,
|
**Normal releases are fully automatic:** a push to `master` (or
|
||||||
|
*workflow_dispatch* in Gitea) runs `.gitea/workflows/deploy.yml` on the
|
||||||
|
`local-host` runner — checkout, `npm ci` + `next build` on the runner host
|
||||||
|
(with npm cache), then `scripts/deploy-production.sh` with a prebuilt tree
|
||||||
|
(`Dockerfile.prebuilt`: no second `npm ci` / compile inside Docker). Backup,
|
||||||
|
migrations, smoke checks, and container swap need no manual steps.
|
||||||
|
|
||||||
|
`scripts/deploy-production.sh` builds the Docker image from `PREBUILT_DIR` in CI
|
||||||
|
(or from the full root `Dockerfile` only for emergency/local use without CI),
|
||||||
backs up the database to `/opt/backups/edu`, applies versioned migrations
|
backs up the database to `/opt/backups/edu`, applies versioned migrations
|
||||||
(`node db/migrate.mjs` — idempotent via `schema_migrations`), checks a
|
(`node db/migrate.mjs` — idempotent via `schema_migrations`), checks a
|
||||||
candidate container, and replaces `aut-management-faculty`. It retains the
|
candidate container, and replaces `aut-management-faculty`. It retains the
|
||||||
@@ -30,15 +36,6 @@ port 443, with `edu.mstaut.ir` as the origin host name. Leave the ACME
|
|||||||
challenge path accessible for certificate renewal and bypass caching for
|
challenge path accessible for certificate renewal and bypass caching for
|
||||||
admin pages, API requests, and authenticated traffic.
|
admin pages, API requests, and authenticated traffic.
|
||||||
|
|
||||||
To deploy manually on the VPS:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd /opt/prod/Aut.ManagementFaculty
|
|
||||||
git fetch origin master
|
|
||||||
git checkout --detach origin/master
|
|
||||||
bash scripts/deploy-production.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
To inspect a deployment:
|
To inspect a deployment:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -47,4 +44,4 @@ curl --resolve edu.mstaut.ir:443:127.0.0.1 https://edu.mstaut.ir/
|
|||||||
certbot renew --cert-name edu.mstaut.ir --dry-run
|
certbot renew --cert-name edu.mstaut.ir --dry-run
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- workflow probe: no runtime impact -->
|
|
||||||
@@ -30,3 +30,4 @@
|
|||||||
| 2026-09-24 | D23 — پایان H: حذف کامل وابستگی runtime به mock برای محتوای با تیبل: `intersections`، `stats`، `testimonials` از DB میآیند (`getTopics`، `getSiteStats`، `getTestimonials` در `lib/data/site.ts`؛ `HomeRest` با prop `stats`)؛ هویت/ناو استاتیکِ بدونتیبل به ماژول مستقل `src/lib/site-config.ts` منتقل شد؛ `src/lib/mock/site.ts` فقط برای seed باقی ماند (کامنت هدر دارد)؛ ایندکسها با `db/migrations/002_indexes.sql` (leads/articles/events/programs/courses)؛ اسکریپت `scripts/smoke.mjs` (۴ API عمومی + login + create/delete stat) | معیار پذیرش C/H: runtime هیچ import مستقیمی از mock ندارد؛ config بدون تیبل نباید «دادهٔ mock» تلقی شود؛ smoke خواندنی + یک write ادمین میسنجد |
|
| 2026-09-24 | D23 — پایان H: حذف کامل وابستگی runtime به mock برای محتوای با تیبل: `intersections`، `stats`، `testimonials` از DB میآیند (`getTopics`، `getSiteStats`، `getTestimonials` در `lib/data/site.ts`؛ `HomeRest` با prop `stats`)؛ هویت/ناو استاتیکِ بدونتیبل به ماژول مستقل `src/lib/site-config.ts` منتقل شد؛ `src/lib/mock/site.ts` فقط برای seed باقی ماند (کامنت هدر دارد)؛ ایندکسها با `db/migrations/002_indexes.sql` (leads/articles/events/programs/courses)؛ اسکریپت `scripts/smoke.mjs` (۴ API عمومی + login + create/delete stat) | معیار پذیرش C/H: runtime هیچ import مستقیمی از mock ندارد؛ config بدون تیبل نباید «دادهٔ mock» تلقی شود؛ smoke خواندنی + یک write ادمین میسنجد |
|
||||||
| 2026-10-12 | D25 — تاکسونومی دوره دو لایهٔ ادمینمحور: `course_categories` (موضوع) + `course_tags` (نوع/منو) با junction many-to-many؛ حذف `courses.category` enum و `courses.tags` text[]؛ لینک پایدار با slug (`?tag=` / `?category=`)؛ CRUD در `/admin/course-categories` و `/admin/course-tags` | دسته و تگ باید پویا و قابل تعریف در ادمین باشند؛ لیبل فارسی جدا از slug است |
|
| 2026-10-12 | D25 — تاکسونومی دوره دو لایهٔ ادمینمحور: `course_categories` (موضوع) + `course_tags` (نوع/منو) با junction many-to-many؛ حذف `courses.category` enum و `courses.tags` text[]؛ لینک پایدار با slug (`?tag=` / `?category=`)؛ CRUD در `/admin/course-categories` و `/admin/course-tags` | دسته و تگ باید پویا و قابل تعریف در ادمین باشند؛ لیبل فارسی جدا از slug است |
|
||||||
| 2026-10-11 | D24 — آپلود تصویر ادمین: `POST /api/admin/upload` (multipart، فقط ادمین) فایل را در `public/uploads/{folder}/` مینویسد و مسیر عمومی `/uploads/...` برمیگرداند؛ UI با `ImageUploadField` در `CourseForm` و فیلد نوع `image` در `GenericForm`/`entities` (articles/topics/faculty/alumni)؛ persistence در Docker با volume `uploads_data` و env `UPLOAD_DIR` | ورود دستی URL اشتباه بود؛ ادمین باید فایل بارگذاری کند؛ ستونهای DB همچنان path/URL میمانند |
|
| 2026-10-11 | D24 — آپلود تصویر ادمین: `POST /api/admin/upload` (multipart، فقط ادمین) فایل را در `public/uploads/{folder}/` مینویسد و مسیر عمومی `/uploads/...` برمیگرداند؛ UI با `ImageUploadField` در `CourseForm` و فیلد نوع `image` در `GenericForm`/`entities` (articles/topics/faculty/alumni)؛ persistence در Docker با volume `uploads_data` و env `UPLOAD_DIR` | ورود دستی URL اشتباه بود؛ ادمین باید فایل بارگذاری کند؛ ستونهای DB همچنان path/URL میمانند |
|
||||||
|
| 2026-10-22 | D26 — اولویت کاتالوگ: `courses.featured` + `courses.sort_order` (migration 011)؛ ترتیب عمومی غیرآرشیو → ویژه → ترتیب → عنوان؛ تگ `archive` در کتالوگ بلوک جدا با کارت ملایمتر است و از هوم حذف میماند | چند دورهٔ جاری باید جلو بیایند و گزیدهٔ برگزارشده از لیست جاری جدا دیده شود |
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
# Active Context
|
# Active Context
|
||||||
|
|
||||||
## Current Goal
|
## Current Goal
|
||||||
چکلیست UI در `docs/Todo.Md` پیاده شد؛ سه آیتم blocked منتظر کاربر.
|
اولویت نمایش دورهها (ویژه + ترتیب) و جداسازی گزیدهٔ برگزارشده در کتالوگ.
|
||||||
|
|
||||||
## Current Work
|
## Current Work
|
||||||
- انجامشده: هدر/ناو/فوتر، فونت Vazirmatn، هوم، سرچ/کارت دورهها، اسکیما اساتید (`profile_url` + `course_faculty_links`)
|
- انجامشده: `featured`/`sort_order` روی `courses`، ادمین، Badge ویژه، بلوک آرشیو جدا در `/professional`
|
||||||
- لوگو دانشکده اعمال شد (`/brand/mst-faculty.png` + favicon)
|
|
||||||
- Blocked: پالت رنگی mst (۱۱)، seed اساتید پس از دسترسی (۱۷c)
|
- Blocked: پالت رنگی mst (۱۱)، seed اساتید پس از دسترسی (۱۷c)
|
||||||
|
|
||||||
## Current Blockers
|
## Current Blockers
|
||||||
@@ -13,5 +12,6 @@
|
|||||||
- دسترسی به شبکه اساتید mst برای کپی داده
|
- دسترسی به شبکه اساتید mst برای کپی داده
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
1. دریافت پالت و بهروزرسانی توکنهای `globals.css`
|
1. در ادمین، دورههای مهم جاری را ویژه/مرتب کنید
|
||||||
2. پس از دسترسی mst: seed اساتید با `profileUrl`
|
2. دریافت پالت و بهروزرسانی توکنهای `globals.css`
|
||||||
|
3. پس از دسترسی mst: seed اساتید با `profileUrl`
|
||||||
@@ -39,10 +39,12 @@
|
|||||||
|
|
||||||
- [x] منوی هوم: یک دراپداون از تگها؛ `courseNavParentTag`؛ لینک پایدار
|
- [x] منوی هوم: یک دراپداون از تگها؛ `courseNavParentTag`؛ لینک پایدار
|
||||||
- [x] D25 تاکسونومی ادمینمحور: دسته + تگ many-to-many؛ migration 007؛ CRUD ادمین؛ فیلتر `?tag=`/`?category=` با slug
|
- [x] D25 تاکسونومی ادمینمحور: دسته + تگ many-to-many؛ migration 007؛ CRUD ادمین؛ فیلتر `?tag=`/`?category=` با slug
|
||||||
|
- [x] D26 اولویت کاتالوگ: `featured` + `sort_order` (migration 011)؛ بلوک جدا برای تگ `archive`
|
||||||
|
|
||||||
## Next
|
## Next
|
||||||
- [x] فاز H باقیمانده — ایندکسها، docs/README نهایی، حذف وابستگی runtime به mock، smoke script
|
- [x] فاز H باقیمانده — ایندکسها، docs/README نهایی، حذف وابستگی runtime به mock، smoke script
|
||||||
- [x] Todo UI سایت (هدر/هوم/دورهها/فونت/اسکیما اساتید) — جزئیات در `docs/Todo.Md`
|
- [x] Todo UI سایت (هدر/هوم/دورهها/فونت/اسکیما اساتید) — جزئیات در `docs/Todo.Md`
|
||||||
|
- [x] D26 اولویت دوره + جداسازی گزیدهٔ برگزارشده
|
||||||
- [ ] محتوای واقعی از پنل ادمین (طبق دستور کاربر بعداً)
|
- [ ] محتوای واقعی از پنل ادمین (طبق دستور کاربر بعداً)
|
||||||
- [x] لوگوی دانشکده (نشان بدون متن کناری + favicon)
|
- [x] لوگوی دانشکده (نشان بدون متن کناری + favicon)
|
||||||
- [ ] Todo blocked: پالت mst، seed اساتید از شبکه دانشکده
|
- [ ] Todo blocked: پالت mst، seed اساتید از شبکه دانشکده
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
"insightsIntro": "نکات کاربردی مدیریت و فناوری برای کار و سازمان.",
|
"insightsIntro": "نکات کاربردی مدیریت و فناوری برای کار و سازمان.",
|
||||||
"eventsTitle": "رویداد ها",
|
"eventsTitle": "رویداد ها",
|
||||||
"eventsIntro": "وبینار ها، بازدیدها و نشست های معرفی برنامه.",
|
"eventsIntro": "وبینار ها، بازدیدها و نشست های معرفی برنامه.",
|
||||||
|
"newsTitle": "اخبار",
|
||||||
|
"newsIntro": "اطلاعیه ها و خبرهای مرکز آموزش های آزاد.",
|
||||||
|
"newsEmpty": "هنوز خبری منتشر نشده است.",
|
||||||
"aboutTitle": "درباره مرکز آموزش های آزاد",
|
"aboutTitle": "درباره مرکز آموزش های آزاد",
|
||||||
"valuesTitle": "ارزش های ما",
|
"valuesTitle": "ارزش های ما",
|
||||||
"alumniTitle": "دانش آموختگان",
|
"alumniTitle": "دانش آموختگان",
|
||||||
@@ -60,6 +63,7 @@
|
|||||||
"courseAboutTitle": "درباره این دوره",
|
"courseAboutTitle": "درباره این دوره",
|
||||||
"courseDetailsTitle": "جزئیات برگزاری",
|
"courseDetailsTitle": "جزئیات برگزاری",
|
||||||
"courseDuration": "مدت",
|
"courseDuration": "مدت",
|
||||||
|
"courseDate": "تاریخ برگزاری",
|
||||||
"courseFormat": "قالب",
|
"courseFormat": "قالب",
|
||||||
"courseCategory": "دسته بندی",
|
"courseCategory": "دسته بندی",
|
||||||
"coursePrice": "شهریه",
|
"coursePrice": "شهریه",
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ const nextConfig: NextConfig = {
|
|||||||
output: "standalone",
|
output: "standalone",
|
||||||
// Babel React Compiler is heavy in Docker/CI; keep it for local `next dev`.
|
// Babel React Compiler is heavy in Docker/CI; keep it for local `next dev`.
|
||||||
reactCompiler: process.env.DISABLE_REACT_COMPILER !== "1",
|
reactCompiler: process.env.DISABLE_REACT_COMPILER !== "1",
|
||||||
|
// VPS deploy sets SKIP_TYPECHECK=1. `npm run build` locally still typechecks.
|
||||||
|
typescript: {
|
||||||
|
ignoreBuildErrors: process.env.SKIP_TYPECHECK === "1",
|
||||||
|
},
|
||||||
experimental: {
|
experimental: {
|
||||||
optimizePackageImports: ["lucide-react"],
|
optimizePackageImports: ["lucide-react"],
|
||||||
},
|
},
|
||||||
@@ -21,8 +25,8 @@ const nextConfig: NextConfig = {
|
|||||||
async redirects() {
|
async redirects() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: "/faculty",
|
source: "/images/faculty/placeholder.png",
|
||||||
destination: "https://mst.aut.ac.ir/content/31094/شبکه-اساتید",
|
destination: "/images/faculty/placeholder.webp",
|
||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,9 +14,18 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@base-ui/react": "^1.8.0",
|
"@base-ui/react": "^1.8.0",
|
||||||
|
"@tiptap/extension-link": "^3.32.0",
|
||||||
|
"@tiptap/extension-placeholder": "^3.32.0",
|
||||||
|
"@tiptap/extension-text-align": "^3.32.0",
|
||||||
|
"@tiptap/extension-underline": "^3.32.0",
|
||||||
|
"@tiptap/pm": "^3.32.0",
|
||||||
|
"@tiptap/react": "^3.32.0",
|
||||||
|
"@tiptap/starter-kit": "^3.32.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"cn": "^0.3.2",
|
"cn": "^0.3.2",
|
||||||
"embla-carousel-react": "^8.6.0",
|
"embla-carousel-react": "^8.6.0",
|
||||||
|
"isomorphic-dompurify": "^4.6.0",
|
||||||
|
"jalaali-js": "^2.0.1",
|
||||||
"lucide-react": "^1.47.0",
|
"lucide-react": "^1.47.0",
|
||||||
"next": "16.3.5",
|
"next": "16.3.5",
|
||||||
"next-intl": "^4.14.6",
|
"next-intl": "^4.14.6",
|
||||||
@@ -30,6 +39,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
|
"@types/dompurify": "^3.0.5",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/pg": "^8.23.1",
|
"@types/pg": "^8.23.1",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 181 KiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 430 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 324 KiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 296 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 232 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 766 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 342 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 184 KiB |
|
After Width: | Height: | Size: 5.9 MiB |
|
Before Width: | Height: | Size: 725 KiB After Width: | Height: | Size: 698 KiB |
|
After Width: | Height: | Size: 6.3 MiB |
|
Before Width: | Height: | Size: 541 KiB After Width: | Height: | Size: 769 KiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 6.3 MiB |
|
Before Width: | Height: | Size: 655 KiB After Width: | Height: | Size: 730 KiB |