Enable calendar and notification apps by default
Add a new script to enable the calendar and notification applications by default, along with documentation updates. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 77cfe984-2c65-4152-bb7a-0df28274fe66 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 1fea5b6b-097a-4339-854f-f1a5d338a14c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/c3c252e4-c83d-40ca-9fff-99a3ea60701e/77cfe984-2c65-4152-bb7a-0df28274fe66/1WKAcHk Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -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`.
|
||||
|
||||
@@ -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'"
|
||||
},
|
||||
|
||||
@@ -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));
|
||||
Reference in New Issue
Block a user