From 5cf2e74eab455c0baa9d98027946c8542ea61a3e Mon Sep 17 00:00:00 2001 From: CSantosM <4a.santos@gmail.com> Date: Mon, 16 Feb 2026 09:36:48 +0100 Subject: [PATCH] backend: implement partial update for room repository and adjust service calls accordingly --- meet-ce/backend/src/repositories/room.repository.ts | 12 ++++++++++++ meet-ce/backend/src/services/room.service.ts | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/meet-ce/backend/src/repositories/room.repository.ts b/meet-ce/backend/src/repositories/room.repository.ts index 60c00d7b..ec5f7a82 100644 --- a/meet-ce/backend/src/repositories/room.repository.ts +++ b/meet-ce/backend/src/repositories/room.repository.ts @@ -49,6 +49,8 @@ export class RoomRepository extends BaseRepos * @param room - The complete updated room data * @returns The updated room with enriched URLs * @throws Error if room not found + * + * TODO: This method should be renamed to replace or updateFull to better reflect that it replaces the entire document */ async update(room: TRoom): Promise { const normalizedRoom = this.normalizeRoomForStorage(room); @@ -56,6 +58,16 @@ export class RoomRepository extends BaseRepos return this.enrichRoomWithBaseUrls(document); } + /** + * TODO: This method should be updated when updatePartial is implemented in the base repository. + * Updates specific fields of a room without replacing the entire document. + * @param roomId + * @param fieldsToUpdate + */ + async updatePartial(roomId: string, fieldsToUpdate: Partial): Promise { + await this.updateOne({ roomId }, fieldsToUpdate); + } + /** * Finds a room by its roomId. * Returns the room with enriched URLs (including base URL). diff --git a/meet-ce/backend/src/services/room.service.ts b/meet-ce/backend/src/services/room.service.ts index bbc32aa7..20d7ce16 100644 --- a/meet-ce/backend/src/services/room.service.ts +++ b/meet-ce/backend/src/services/room.service.ts @@ -528,7 +528,7 @@ export class RoomService { if (hasActiveMeeting) { // Set meeting end action (DELETE or CLOSE) depending on recording policy room.meetingEndAction = shouldCloseRoom ? MeetingEndAction.CLOSE : MeetingEndAction.DELETE; - await this.roomRepository.update(room); + await this.roomRepository.updatePartial(room.roomId, { meetingEndAction: room.meetingEndAction }); if (shouldForceEndMeeting) { // Force end meeting by deleting the LiveKit room @@ -541,7 +541,7 @@ export class RoomService { if (shouldCloseRoom) { // Close room instead of deleting if recordings exist and policy is CLOSE room.status = MeetRoomStatus.CLOSED; - await this.roomRepository.update(room); + await this.roomRepository.updatePartial(room.roomId, { status: room.status }); return room; }