backend: implement partial update for room repository and adjust service calls accordingly
This commit is contained in:
parent
6d3d19ccd0
commit
5cf2e74eab
@ -49,6 +49,8 @@ export class RoomRepository<TRoom extends MeetRoom = MeetRoom> 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<TRoom> {
|
||||
const normalizedRoom = this.normalizeRoomForStorage(room);
|
||||
@ -56,6 +58,16 @@ export class RoomRepository<TRoom extends MeetRoom = MeetRoom> 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<TRoom>): Promise<void> {
|
||||
await this.updateOne({ roomId }, fieldsToUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a room by its roomId.
|
||||
* Returns the room with enriched URLs (including base URL).
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user