CognxSafeTrack
Claude Sonnet 4.6
refactor(worker): Sprint 2 β dead code removal and queue consolidation
37fb9ce Download scripts/db-ops/restore_prod_token.ts from safetrack/edtech: direct link, hf CLI and curl.
- Browser
- Download file 889 Bytes
-
https://huggingface.co/spaces/safetrack/edtech/resolve/main/scripts/db-ops/restore_prod_token.ts
- Command line
-
hf download hf://spaces/safetrack/edtech/scripts/db-ops/restore_prod_token.ts
-
curl -L -o restore_prod_token.ts https://huggingface.co/spaces/safetrack/edtech/resolve/main/scripts/db-ops/restore_prod_token.ts
889 Bytes
| import 'dotenv/config'; | |
| import path from 'path'; | |
| import dotenv from 'dotenv'; | |
| dotenv.config({ path: path.join(__dirname, '../../../../.env') }); | |
| import { PrismaClient } from '@prisma/client'; | |
| const prisma = new PrismaClient(); | |
| async function fixProdToken() { | |
| const orgId = 'default-org-id'; | |
| const globalToken = process.env.WHATSAPP_ACCESS_TOKEN; | |
| if (!globalToken) { | |
| console.error('β Missing WHATSAPP_ACCESS_TOKEN in .env'); | |
| return; | |
| } | |
| // We set the token to RAW unencrypted text. | |
| // In production, the decrypt function will safely return it as-is. | |
| await prisma.organization.update({ | |
| where: { id: orgId }, | |
| data: { | |
| systemUserToken: globalToken | |
| } | |
| }); | |
| console.log(`β Restored systemUserToken for ${orgId} to RAW string.`); | |
| await prisma.$disconnect(); | |
| } | |
| fixProdToken().catch(console.error); | |