Files
DentalManagementMH06/apps/Backend/src/routes/office-contact.ts
Gitead 16429320fa feat: chat window, preferred language, insurance contact, and AI call eligibility
- Schedule: right-click Chat option opens floating SMS chat window
- Chat window: SMS template selector with appointment date/time pre-filled
- Chat window: office name and phone pulled from Settings > Office Contact
- Chat window: Preferred Language selector (English, Spanish, Portuguese,
  Mandarin, Cantonese, Arabic, Haitian Creole) with fully translated templates
  and locale-aware date/time formatting
- Patient form: Preferred Language field (add/edit), default English
- Settings > Office Contact: added Dental Office Name field
- Settings > Advanced: Insurance Contact page (CRUD — company name + phone)
- Prisma schema: preferredLanguage on Patient, officeName on OfficeContact,
  new InsuranceContact model
- Patient management: Upload Patient Document moved below Patient Records
- Insurance Eligibility: AI Call Insurance collapsible section; insurance
  company and phone auto-populated from saved Insurance Contacts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 16:42:37 -04:00

41 lines
1.4 KiB
TypeScript

import express, { Request, Response } from "express";
import { storage } from "../storage";
const router = express.Router();
// GET /api/office-contact
router.get("/", async (req: Request, res: Response): Promise<any> => {
try {
const userId = req.user?.id;
if (!userId) return res.status(401).json({ message: "Unauthorized" });
const record = await storage.getOfficeContact(userId);
return res.status(200).json(record ?? null);
} catch (err) {
return res.status(500).json({ error: "Failed to fetch office contact", details: String(err) });
}
});
// PUT /api/office-contact
router.put("/", async (req: Request, res: Response): Promise<any> => {
try {
const userId = req.user?.id;
if (!userId) return res.status(401).json({ message: "Unauthorized" });
const { officeName, receptionistName, dentistName, phoneNumber, email, fax } = req.body;
const record = await storage.upsertOfficeContact(userId, {
officeName: officeName ?? undefined,
receptionistName: receptionistName ?? undefined,
dentistName: dentistName ?? undefined,
phoneNumber: phoneNumber ?? undefined,
email: email ?? undefined,
fax: fax ?? undefined,
});
return res.status(200).json(record);
} catch (err) {
return res.status(500).json({ error: "Failed to save office contact", details: String(err) });
}
});
export default router;