Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…bApp into DEV-Chat
  • Loading branch information
Ouadia Essendoubi committed Oct 20, 2023
2 parents 09926a6 + a59f10b commit cb30cb0
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 cb30cb0

Please sign in to comment.