Skip to content

Commit cff72ef

Browse files
docs(@nestjs) update examples
1 parent 827593c commit cff72ef

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

examples/01-cats-app/src/modules/common/pipes/parse-int.pipe.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { PipeTransform, Pipe, ArgumentMetadata, HttpStatus } from '@nestjs/commo
33

44
@Pipe()
55
export class ParseIntPipe implements PipeTransform<string> {
6-
async transform(value: string, metadata: ArgumentMetadata) {
7-
const val = parseInt(value, 10);
8-
if (isNaN(val)) {
9-
throw new HttpException('Validation failed', HttpStatus.BAD_REQUEST);
10-
}
11-
return val;
6+
async transform(value: string, metadata: ArgumentMetadata) {
7+
const val = parseInt(value, 10);
8+
if (isNaN(val)) {
9+
throw new HttpException('Validation failed', HttpStatus.BAD_REQUEST);
1210
}
11+
return val;
12+
}
1313
}

examples/05-sql-typeorm/src/modules/photo/photo.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ import { Photo } from './photo.entity';
66
export class PhotoService {
77
constructor(
88
@Inject('PhotoRepositoryToken') private readonly photoRepository: Repository<Photo>) {}
9+
10+
async findAll(): Promise<Photo[]> {
11+
return await this.photoRepository.find();
12+
}
913
}

0 commit comments

Comments
 (0)