Skip to content

Commit

Permalink
fix: list rooms (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
automerge-pingpong[bot] committed Oct 20, 2023
2 parents 91b531f + 9384d1b commit a59f10b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions backend/code/src/rooms/dto/list-rooms.dto.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { Transform } from 'class-transformer';
import { IsBoolean, IsOptional } from 'class-validator';
import { QueryOffsetDto } from 'src/friends/dto/query-ofsset-dto';

export class ListRoomsDto extends QueryOffsetDto {
@ApiProperty({ required: false })
@IsOptional()
@IsBoolean()
@Type(() => Boolean)
joined: boolean;
@Transform(({ value }) => value === 'true')
joined: boolean = false;
}
17 changes: 16 additions & 1 deletion backend/code/src/rooms/rooms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,23 @@ export class RoomsService {
async muteMember(roomData: ChangeOwnerDto, userId: string) {
const room = await this.prisma.room.findUnique({
where: { id: roomData.roomId },
select: { ownerId: true },
select: {
ownerId: true,
members: {
where: {
OR: [
{
userId: roomData.memberId,
},
{
userId: userId,
},
],
},
},
},
});
//NOTE: check members content
const user = await this.prisma.roomMember.findUnique({
where: { unique_user_room: { userId: userId, roomId: roomData.roomId } },
});
Expand Down

0 comments on commit a59f10b

Please sign in to comment.