feat: share patients across all users

Removed per-user patient filtering so all staff accounts see the same
patient pool. Previously each user only saw patients they created.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-05-17 23:04:26 -04:00
parent b148c0de30
commit 8cab823d60
219 changed files with 14090 additions and 718 deletions

View File

@@ -167,7 +167,7 @@ router.get("/status", async (req: Request, res: Response): Promise<any> => {
SELECT pg_size_pretty(pg_database_size(current_database())) as size
`;
const patientsCount = await storage.getTotalPatientCount(userId);
const patientsCount = await storage.getTotalPatientCount();
const lastBackup = await storage.getLastBackup(userId);
res.json({

View File

@@ -11,7 +11,7 @@ const router = Router();
// Get all patients for the logged-in user
router.get("/", async (req, res) => {
try {
const patients = await storage.getPatientsByUserId(req.user!.id);
const patients = await storage.getAllPatients();
res.json(patients);
} catch (error) {
res.status(500).json({ message: "Failed to retrieve patients" });
@@ -24,10 +24,9 @@ router.get("/recent", async (req: Request, res: Response) => {
const limit = parseInt(req.query.limit as string) || 10;
const offset = parseInt(req.query.offset as string) || 0;
const userId = req.user!.id;
const [patients, totalCount] = await Promise.all([
storage.getRecentPatients(limit, offset, userId),
storage.getTotalPatientCount(userId),
storage.getRecentPatients(limit, offset),
storage.getTotalPatientCount(),
]);
res.json({ patients, totalCount });