Fix bed management: preserve camaId from frontend to backend

- Use camaId generated in frontend instead of generating new one in backend API
- Remove patientId and internacionId from cama table (use internaciones table instead)
- Fix discharge: delete cama if fuera de area, mark available otherwise
- Fix MapaCamas to find patient via internaciones table
This commit is contained in:
2026-04-24 11:46:01 -03:00
parent 705c200f1b
commit 96058f5275
4 changed files with 37 additions and 30 deletions
+4 -1
View File
@@ -239,7 +239,10 @@ app.put('/api/camas/:id', async (req, res) => {
app.post('/api/camas', async (req, res) => {
try {
const cama = { ...req.body, id: generateUUID() };
const cama = req.body;
if (!cama.id) {
cama.id = generateUUID();
}
await createCama(cama);
res.json(cama);
} catch (err) {