Phase 2 scaffold: mitra online status & pairing logic
Add mitra online/offline status with heartbeat-based auto-offline, customer-mitra pairing via Valkey pub/sub blast, session management, and control center dashboard with real-time stats. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,3 +15,17 @@ export const setAnonymityConfig = async (enabled) => {
|
||||
`
|
||||
return { anonymity_enabled: enabled }
|
||||
}
|
||||
|
||||
export const getMaxCustomersPerMitra = async () => {
|
||||
const [row] = await sql`SELECT value FROM app_config WHERE key = 'max_customers_per_mitra'`
|
||||
return { max_customers_per_mitra: row?.value?.value ?? 3 }
|
||||
}
|
||||
|
||||
export const setMaxCustomersPerMitra = async (value) => {
|
||||
await sql`
|
||||
INSERT INTO app_config (key, value, updated_at)
|
||||
VALUES ('max_customers_per_mitra', ${sql.json({ value })}, NOW())
|
||||
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = NOW()
|
||||
`
|
||||
return { max_customers_per_mitra: value }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user