|
@ -21,6 +21,7 @@ import type User from 'src/users/entity/user.entity' |
|
|
import type Channel from './entity/channel.entity' |
|
|
import type Channel from './entity/channel.entity' |
|
|
import { Profile42 } from 'src/auth/42.decorator' |
|
|
import { Profile42 } from 'src/auth/42.decorator' |
|
|
import { Profile } from 'passport-42' |
|
|
import { Profile } from 'passport-42' |
|
|
|
|
|
import { IsNumberString, IsPositive } from 'class-validator' |
|
|
|
|
|
|
|
|
@Controller('channels') |
|
|
@Controller('channels') |
|
|
@UseGuards(AuthenticatedGuard) |
|
|
@UseGuards(AuthenticatedGuard) |
|
@ -140,7 +141,9 @@ export class ChatController { |
|
|
): Promise<void> { |
|
|
): Promise<void> { |
|
|
const channel = await this.channelService.getFullChannel(id) |
|
|
const channel = await this.channelService.getFullChannel(id) |
|
|
const user: User | null = await this.usersService.findUser(target.data[0]) |
|
|
const user: User | null = await this.usersService.findUser(target.data[0]) |
|
|
console.log(target) |
|
|
if (isNaN(+target.data[1])) { |
|
|
|
|
|
throw new BadRequestException(`Invalid duration ${target.data[1]}`) |
|
|
|
|
|
} |
|
|
if (user == null) { |
|
|
if (user == null) { |
|
|
throw new NotFoundException(`User #${target.data[0]} not found`) |
|
|
throw new NotFoundException(`User #${target.data[0]} not found`) |
|
|
} |
|
|
} |
|
@ -167,6 +170,9 @@ export class ChatController { |
|
|
): Promise<void> { |
|
|
): Promise<void> { |
|
|
const channel = await this.channelService.getFullChannel(id) |
|
|
const channel = await this.channelService.getFullChannel(id) |
|
|
const user: User | null = await this.usersService.findUser(mute.data[0]) |
|
|
const user: User | null = await this.usersService.findUser(mute.data[0]) |
|
|
|
|
|
if (isNaN(+mute.data[1])) { |
|
|
|
|
|
throw new BadRequestException(`Invalid duration ${mute.data[1]}`) |
|
|
|
|
|
} |
|
|
if (user == null) { |
|
|
if (user == null) { |
|
|
throw new NotFoundException(`User #${mute.data[0]} not found`) |
|
|
throw new NotFoundException(`User #${mute.data[0]} not found`) |
|
|
} |
|
|
} |
|
|