forked from immich-app/immich
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): apply ValidationPipe on controllers (immich-app#2137)
- Loading branch information
1 parent
49f66be
commit 51785a1
Showing
11 changed files
with
39 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import { AlbumService, AuthUserDto } from '@app/domain'; | ||
import { GetAlbumsDto } from '@app/domain/album/dto/get-albums.dto'; | ||
import { Controller, Get, Query, ValidationPipe } from '@nestjs/common'; | ||
import { Controller, Get, Query, UsePipes, ValidationPipe } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { GetAuthUser } from '../decorators/auth-user.decorator'; | ||
import { Authenticated } from '../decorators/authenticated.decorator'; | ||
|
||
@ApiTags('Album') | ||
@Controller('album') | ||
@Authenticated() | ||
@UsePipes(new ValidationPipe({ transform: true })) | ||
export class AlbumController { | ||
constructor(private service: AlbumService) {} | ||
|
||
@Get() | ||
async getAllAlbums( | ||
@GetAuthUser() authUser: AuthUserDto, | ||
@Query(new ValidationPipe({ transform: true })) query: GetAlbumsDto, | ||
) { | ||
async getAllAlbums(@GetAuthUser() authUser: AuthUserDto, @Query() query: GetAlbumsDto) { | ||
return this.service.getAllAlbums(authUser, query); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters