Template
Initial commit
This commit is contained in:
@@ -11,10 +11,12 @@ import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class GamePipe implements PipeTransform {
|
||||
constructor(@InjectRepository(Game) private gameRepository: Repository<Game>) {}
|
||||
constructor(
|
||||
@InjectRepository(Game) private gameRepository: Repository<Game>,
|
||||
) {}
|
||||
|
||||
async transform(value: any) {
|
||||
const game = await this.gameRepository.findBy({id: value});
|
||||
const game = await this.gameRepository.findBy({ id: value });
|
||||
if (!game) {
|
||||
throw new HttpException('Game not found', HttpStatus.NOT_FOUND);
|
||||
}
|
||||
@@ -24,10 +26,12 @@ export class GamePipe implements PipeTransform {
|
||||
|
||||
@Injectable()
|
||||
export class GameStartedPipe implements PipeTransform {
|
||||
constructor(@InjectRepository(Game) private gameRepository: Repository<Game>) {}
|
||||
constructor(
|
||||
@InjectRepository(Game) private gameRepository: Repository<Game>,
|
||||
) {}
|
||||
|
||||
async transform(value: any) {
|
||||
const game = await this.gameRepository.findBy({id: value});
|
||||
const game = await this.gameRepository.findOne(value);
|
||||
if (!game) {
|
||||
throw new HttpException('Game not found', HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user