Enable calendar and notification apps by default

Add a new script to enable the calendar and notification applications by default, along with documentation updates.
This commit is contained in:
Riyadh
2026-05-17 15:19:51 +00:00
parent cb894f7baa
commit 61701b422c
3 changed files with 40 additions and 0 deletions
+10
View File
@@ -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`.
+1
View File
@@ -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'"
},
+29
View File
@@ -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));