Skip to content

Commit

Permalink
fix: 방 정보 조회할 때 투표한 유저들의 username 도 같이 내려가도록
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaemy committed Aug 24, 2023
1 parent 591a766 commit 3cdfb35
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/api/rooms/rooms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class RoomsService {
include: {
users: {
select: {
username: true,
enableTimes: true,
},
},
Expand All @@ -80,6 +81,8 @@ export class RoomsService {
throw new NotFoundException(`Room with code ${code} not found`);
}

const { dateOnly, startTime, endTime, createdAt, updatedAt, dates } = room;

let enableTimesList: string[];

if (room.dateOnly) {
Expand All @@ -105,10 +108,15 @@ export class RoomsService {
});
const enableTimes = Object.fromEntries(timeMap.entries());

delete room.users;

return {
...room,
code,
dateOnly,
startTime,
endTime,
createdAt,
updatedAt,
dates,
votingUsers: room.users.map(user => user.username),
enableTimes,
};
}
Expand Down

0 comments on commit 3cdfb35

Please sign in to comment.