diff --git a/backend/src/routes/housekeeping.ts b/backend/src/routes/housekeeping.ts index aa1c511..45327f3 100644 --- a/backend/src/routes/housekeeping.ts +++ b/backend/src/routes/housekeeping.ts @@ -123,6 +123,15 @@ const housekeeping: FastifyPluginAsync = async (fastify) => { if (!rows[0]) return reply.code(404).send({ error: 'Task not found' }) const task = rows[0] + // When task is marked in_progress → room becomes 'cleaning' + if (request.body.status === 'in_progress' && task.room_id) { + await db.query( + `UPDATE rooms SET housekeeping_status = 'cleaning' WHERE id = $1`, + [task.room_id], + ) + broadcast(slug, { type: 'housekeeping_done', taskId: task.id, roomId: task.room_id, roomStatus: 'cleaning' }) + } + // When task is marked done → update room housekeeping status if (request.body.status === 'done' && task.room_id) { const settings = await getHkSettings(hotelId).catch(() => null)