From 61701b422cd1950d56768d3b6e7f2192b70a67d6 Mon Sep 17 00:00:00 2001 From: Riyadh Date: Sun, 17 May 2026 15:19:51 +0000 Subject: [PATCH] Enable calendar and notification apps by default Add a new script to enable the calendar and notification applications by default, along with documentation updates. --- DOCKER.md | 10 ++++++++++ scripts/package.json | 1 + scripts/src/enable-default-apps.ts | 29 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 scripts/src/enable-default-apps.ts diff --git a/DOCKER.md b/DOCKER.md index ae79166d..03bfc161 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -114,3 +114,13 @@ git pull عند كل إصدار جديد: حدّث `latest.json` في الريبو وادفع. عملاء Tx OS سيرون شارة "Update available" عند ضغطهم على Check Now. > رقم البناء (`build`) يُولَّد تلقائياً من git قبل كل `pnpm run build` (انظر `scripts/update-version.mjs`)، فلا تحتاج تعديله يدوياً في `version.json`. + +## تفعيل تطبيقي التقويم والإشعارات + +افتراضياً يصلان مُعطَّلَين في البيئات الجديدة. لتفعيلهما على بيئة موجودة (مرة واحدة): + +```bash +docker compose exec api pnpm --filter @workspace/scripts run enable-default-apps +``` + +السكربت idempotent (آمن لإعادة التشغيل) ويعيد فقط `is_active=true` لـ `calendar` و `notifications`. diff --git a/scripts/package.json b/scripts/package.json index cdaaeef1..191b53eb 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -7,6 +7,7 @@ "hello": "tsx ./src/hello.ts", "seed": "tsx ./src/seed.ts", "remove-chat": "tsx ./src/remove-chat.ts", + "enable-default-apps": "tsx ./src/enable-default-apps.ts", "typecheck": "tsc -p tsconfig.json --noEmit", "test": "node --test 'tests/**/*.test.mjs'" }, diff --git a/scripts/src/enable-default-apps.ts b/scripts/src/enable-default-apps.ts new file mode 100644 index 00000000..c2318497 --- /dev/null +++ b/scripts/src/enable-default-apps.ts @@ -0,0 +1,29 @@ +import { db, appsTable } from "@workspace/db"; +import { inArray } from "drizzle-orm"; + +const SLUGS = ["calendar", "notifications"]; + +async function main() { + console.log(`Enabling apps: ${SLUGS.join(", ")}...`); + const updated = await db + .update(appsTable) + .set({ isActive: true }) + .where(inArray(appsTable.slug, SLUGS)) + .returning({ slug: appsTable.slug, isActive: appsTable.isActive }); + + if (updated.length === 0) { + console.warn("No matching apps found — did seed run yet?"); + } else { + for (const row of updated) { + console.log(` ✓ ${row.slug} (isActive=${row.isActive})`); + } + } + console.log("Done."); +} + +main() + .catch((err) => { + console.error(err); + process.exit(1); + }) + .finally(() => process.exit(0));