accounts page

This commit is contained in:
Joseph J Helfenbein
2025-01-25 06:13:43 -05:00
parent 1db24c5ceb
commit 1f4c828b30
12 changed files with 388 additions and 38 deletions

View File

@@ -0,0 +1,21 @@
import User from '../../../models/User';
import connectDB from '../../../lib/utils';
export default async (req, res) => {
await connectDB();
const { email } = req.query;
const { medications, medicalConditions } = req.body;
const patient = await User.findOne({ email });
if (!patient) {
return res.status(404).json({ message: 'Patient not found' });
}
patient.medications = medications;
patient.medicalConditions = medicalConditions;
await patient.save();
res.json(patient);
};