mirror of
https://github.com/immich-app/immich.git
synced 2025-06-01 04:36:19 -04:00
refactor: rename get auth user decorator (#2778)
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
fde410e2ac
commit
652add635f
@ -1,18 +1,18 @@
|
|||||||
import { Controller, Get, Post, Body, Param, Delete, Put, Query, Response } from '@nestjs/common';
|
|
||||||
import { AlbumService } from './album.service';
|
|
||||||
import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator';
|
|
||||||
import { AuthUserDto, GetAuthUser } from '../../decorators/auth-user.decorator';
|
|
||||||
import { AddAssetsDto } from './dto/add-assets.dto';
|
|
||||||
import { RemoveAssetsDto } from './dto/remove-assets.dto';
|
|
||||||
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
|
||||||
import { AlbumResponseDto } from '@app/domain';
|
import { AlbumResponseDto } from '@app/domain';
|
||||||
import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
|
import { Body, Controller, Delete, Get, Param, Post, Put, Query, Response } from '@nestjs/common';
|
||||||
|
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
||||||
import { Response as Res } from 'express';
|
import { Response as Res } from 'express';
|
||||||
import { DownloadDto } from '../asset/dto/download-library.dto';
|
|
||||||
import { CreateAlbumShareLinkDto as CreateAlbumSharedLinkDto } from './dto/create-album-shared-link.dto';
|
|
||||||
import { UseValidation } from '../../decorators/use-validation.decorator';
|
|
||||||
import { UUIDParamDto } from '../../controllers/dto/uuid-param.dto';
|
|
||||||
import { handleDownload } from '../../app.utils';
|
import { handleDownload } from '../../app.utils';
|
||||||
|
import { UUIDParamDto } from '../../controllers/dto/uuid-param.dto';
|
||||||
|
import { AuthUser, AuthUserDto } from '../../decorators/auth-user.decorator';
|
||||||
|
import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator';
|
||||||
|
import { UseValidation } from '../../decorators/use-validation.decorator';
|
||||||
|
import { DownloadDto } from '../asset/dto/download-library.dto';
|
||||||
|
import { AlbumService } from './album.service';
|
||||||
|
import { AddAssetsDto } from './dto/add-assets.dto';
|
||||||
|
import { CreateAlbumShareLinkDto as CreateAlbumSharedLinkDto } from './dto/create-album-shared-link.dto';
|
||||||
|
import { RemoveAssetsDto } from './dto/remove-assets.dto';
|
||||||
|
import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
|
||||||
|
|
||||||
@ApiTags('Album')
|
@ApiTags('Album')
|
||||||
@Controller('album')
|
@Controller('album')
|
||||||
@ -24,7 +24,7 @@ export class AlbumController {
|
|||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Put(':id/assets')
|
@Put(':id/assets')
|
||||||
addAssetsToAlbum(
|
addAssetsToAlbum(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body() dto: AddAssetsDto,
|
@Body() dto: AddAssetsDto,
|
||||||
): Promise<AddAssetsResponseDto> {
|
): Promise<AddAssetsResponseDto> {
|
||||||
@ -35,13 +35,13 @@ export class AlbumController {
|
|||||||
|
|
||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
getAlbumInfo(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
getAlbumInfo(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
||||||
return this.service.get(authUser, id);
|
return this.service.get(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id/assets')
|
@Delete(':id/assets')
|
||||||
removeAssetFromAlbum(
|
removeAssetFromAlbum(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body() dto: RemoveAssetsDto,
|
@Body() dto: RemoveAssetsDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
): Promise<AlbumResponseDto> {
|
): Promise<AlbumResponseDto> {
|
||||||
@ -52,7 +52,7 @@ export class AlbumController {
|
|||||||
@Get(':id/download')
|
@Get(':id/download')
|
||||||
@ApiOkResponse({ content: { 'application/zip': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/zip': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
downloadArchive(
|
downloadArchive(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Query() dto: DownloadDto,
|
@Query() dto: DownloadDto,
|
||||||
@Response({ passthrough: true }) res: Res,
|
@Response({ passthrough: true }) res: Res,
|
||||||
@ -61,7 +61,7 @@ export class AlbumController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('create-shared-link')
|
@Post('create-shared-link')
|
||||||
createAlbumSharedLink(@GetAuthUser() authUser: AuthUserDto, @Body() dto: CreateAlbumSharedLinkDto) {
|
createAlbumSharedLink(@AuthUser() authUser: AuthUserDto, @Body() dto: CreateAlbumSharedLinkDto) {
|
||||||
return this.service.createSharedLink(authUser, dto);
|
return this.service.createSharedLink(authUser, dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator';
|
import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator';
|
||||||
import { AssetService } from './asset.service';
|
import { AssetService } from './asset.service';
|
||||||
import { FileFieldsInterceptor } from '@nestjs/platform-express';
|
import { FileFieldsInterceptor } from '@nestjs/platform-express';
|
||||||
import { AuthUserDto, GetAuthUser } from '../../decorators/auth-user.decorator';
|
import { AuthUserDto, AuthUser } from '../../decorators/auth-user.decorator';
|
||||||
import { ServeFileDto } from './dto/serve-file.dto';
|
import { ServeFileDto } from './dto/serve-file.dto';
|
||||||
import { Response as Res } from 'express';
|
import { Response as Res } from 'express';
|
||||||
import { DeleteAssetDto } from './dto/delete-asset.dto';
|
import { DeleteAssetDto } from './dto/delete-asset.dto';
|
||||||
@ -92,7 +92,7 @@ export class AssetController {
|
|||||||
type: CreateAssetDto,
|
type: CreateAssetDto,
|
||||||
})
|
})
|
||||||
async uploadFile(
|
async uploadFile(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@UploadedFiles(new ParseFilePipe({ validators: [new FileNotEmptyValidator(['assetData'])] })) files: UploadFiles,
|
@UploadedFiles(new ParseFilePipe({ validators: [new FileNotEmptyValidator(['assetData'])] })) files: UploadFiles,
|
||||||
@Body(new ValidationPipe()) dto: CreateAssetDto,
|
@Body(new ValidationPipe()) dto: CreateAssetDto,
|
||||||
@Response({ passthrough: true }) res: Res,
|
@Response({ passthrough: true }) res: Res,
|
||||||
@ -121,7 +121,7 @@ export class AssetController {
|
|||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Get('/download/:id')
|
@Get('/download/:id')
|
||||||
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
downloadFile(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
downloadFile(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
||||||
return this.assetService.downloadFile(authUser, id).then(asStreamableFile);
|
return this.assetService.downloadFile(authUser, id).then(asStreamableFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ export class AssetController {
|
|||||||
@Post('/download-files')
|
@Post('/download-files')
|
||||||
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
downloadFiles(
|
downloadFiles(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Response({ passthrough: true }) res: Res,
|
@Response({ passthrough: true }) res: Res,
|
||||||
@Body(new ValidationPipe()) dto: DownloadFilesDto,
|
@Body(new ValidationPipe()) dto: DownloadFilesDto,
|
||||||
) {
|
) {
|
||||||
@ -143,7 +143,7 @@ export class AssetController {
|
|||||||
@Get('/download-library')
|
@Get('/download-library')
|
||||||
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
downloadLibrary(
|
downloadLibrary(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Query(new ValidationPipe({ transform: true })) dto: DownloadDto,
|
@Query(new ValidationPipe({ transform: true })) dto: DownloadDto,
|
||||||
@Response({ passthrough: true }) res: Res,
|
@Response({ passthrough: true }) res: Res,
|
||||||
) {
|
) {
|
||||||
@ -155,7 +155,7 @@ export class AssetController {
|
|||||||
@Header('Cache-Control', 'max-age=31536000')
|
@Header('Cache-Control', 'max-age=31536000')
|
||||||
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
serveFile(
|
serveFile(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Headers() headers: Record<string, string>,
|
@Headers() headers: Record<string, string>,
|
||||||
@Response({ passthrough: true }) res: Res,
|
@Response({ passthrough: true }) res: Res,
|
||||||
@Query(new ValidationPipe({ transform: true })) query: ServeFileDto,
|
@Query(new ValidationPipe({ transform: true })) query: ServeFileDto,
|
||||||
@ -169,7 +169,7 @@ export class AssetController {
|
|||||||
@Header('Cache-Control', 'max-age=31536000')
|
@Header('Cache-Control', 'max-age=31536000')
|
||||||
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
getAssetThumbnail(
|
getAssetThumbnail(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Headers() headers: Record<string, string>,
|
@Headers() headers: Record<string, string>,
|
||||||
@Response({ passthrough: true }) res: Res,
|
@Response({ passthrough: true }) res: Res,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@ -179,23 +179,23 @@ export class AssetController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('/curated-objects')
|
@Get('/curated-objects')
|
||||||
getCuratedObjects(@GetAuthUser() authUser: AuthUserDto): Promise<CuratedObjectsResponseDto[]> {
|
getCuratedObjects(@AuthUser() authUser: AuthUserDto): Promise<CuratedObjectsResponseDto[]> {
|
||||||
return this.assetService.getCuratedObject(authUser);
|
return this.assetService.getCuratedObject(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('/curated-locations')
|
@Get('/curated-locations')
|
||||||
getCuratedLocations(@GetAuthUser() authUser: AuthUserDto): Promise<CuratedLocationsResponseDto[]> {
|
getCuratedLocations(@AuthUser() authUser: AuthUserDto): Promise<CuratedLocationsResponseDto[]> {
|
||||||
return this.assetService.getCuratedLocation(authUser);
|
return this.assetService.getCuratedLocation(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('/search-terms')
|
@Get('/search-terms')
|
||||||
getAssetSearchTerms(@GetAuthUser() authUser: AuthUserDto): Promise<string[]> {
|
getAssetSearchTerms(@AuthUser() authUser: AuthUserDto): Promise<string[]> {
|
||||||
return this.assetService.getAssetSearchTerm(authUser);
|
return this.assetService.getAssetSearchTerm(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('/search')
|
@Post('/search')
|
||||||
searchAsset(
|
searchAsset(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: SearchAssetDto,
|
@Body(ValidationPipe) dto: SearchAssetDto,
|
||||||
): Promise<AssetResponseDto[]> {
|
): Promise<AssetResponseDto[]> {
|
||||||
return this.assetService.searchAsset(authUser, dto);
|
return this.assetService.searchAsset(authUser, dto);
|
||||||
@ -203,19 +203,19 @@ export class AssetController {
|
|||||||
|
|
||||||
@Post('/count-by-time-bucket')
|
@Post('/count-by-time-bucket')
|
||||||
getAssetCountByTimeBucket(
|
getAssetCountByTimeBucket(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: GetAssetCountByTimeBucketDto,
|
@Body(ValidationPipe) dto: GetAssetCountByTimeBucketDto,
|
||||||
): Promise<AssetCountByTimeBucketResponseDto> {
|
): Promise<AssetCountByTimeBucketResponseDto> {
|
||||||
return this.assetService.getAssetCountByTimeBucket(authUser, dto);
|
return this.assetService.getAssetCountByTimeBucket(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('/count-by-user-id')
|
@Get('/count-by-user-id')
|
||||||
getAssetCountByUserId(@GetAuthUser() authUser: AuthUserDto): Promise<AssetCountByUserIdResponseDto> {
|
getAssetCountByUserId(@AuthUser() authUser: AuthUserDto): Promise<AssetCountByUserIdResponseDto> {
|
||||||
return this.assetService.getAssetCountByUserId(authUser);
|
return this.assetService.getAssetCountByUserId(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('/stat/archive')
|
@Get('/stat/archive')
|
||||||
getArchivedAssetCountByUserId(@GetAuthUser() authUser: AuthUserDto): Promise<AssetCountByUserIdResponseDto> {
|
getArchivedAssetCountByUserId(@AuthUser() authUser: AuthUserDto): Promise<AssetCountByUserIdResponseDto> {
|
||||||
return this.assetService.getArchivedAssetCountByUserId(authUser);
|
return this.assetService.getArchivedAssetCountByUserId(authUser);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -229,7 +229,7 @@ export class AssetController {
|
|||||||
schema: { type: 'string' },
|
schema: { type: 'string' },
|
||||||
})
|
})
|
||||||
getAllAssets(
|
getAllAssets(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Query(new ValidationPipe({ transform: true })) dto: AssetSearchDto,
|
@Query(new ValidationPipe({ transform: true })) dto: AssetSearchDto,
|
||||||
): Promise<AssetResponseDto[]> {
|
): Promise<AssetResponseDto[]> {
|
||||||
return this.assetService.getAllAssets(authUser, dto);
|
return this.assetService.getAllAssets(authUser, dto);
|
||||||
@ -237,7 +237,7 @@ export class AssetController {
|
|||||||
|
|
||||||
@Post('/time-bucket')
|
@Post('/time-bucket')
|
||||||
getAssetByTimeBucket(
|
getAssetByTimeBucket(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: GetAssetByTimeBucketDto,
|
@Body(ValidationPipe) dto: GetAssetByTimeBucketDto,
|
||||||
): Promise<AssetResponseDto[]> {
|
): Promise<AssetResponseDto[]> {
|
||||||
return this.assetService.getAssetByTimeBucket(authUser, dto);
|
return this.assetService.getAssetByTimeBucket(authUser, dto);
|
||||||
@ -247,7 +247,7 @@ export class AssetController {
|
|||||||
* Get all asset of a device that are in the database, ID only.
|
* Get all asset of a device that are in the database, ID only.
|
||||||
*/
|
*/
|
||||||
@Get('/:deviceId')
|
@Get('/:deviceId')
|
||||||
getUserAssetsByDeviceId(@GetAuthUser() authUser: AuthUserDto, @Param() { deviceId }: DeviceIdDto) {
|
getUserAssetsByDeviceId(@AuthUser() authUser: AuthUserDto, @Param() { deviceId }: DeviceIdDto) {
|
||||||
return this.assetService.getUserAssetsByDeviceId(authUser, deviceId);
|
return this.assetService.getUserAssetsByDeviceId(authUser, deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ export class AssetController {
|
|||||||
*/
|
*/
|
||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Get('/assetById/:id')
|
@Get('/assetById/:id')
|
||||||
getAssetById(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto> {
|
getAssetById(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto> {
|
||||||
return this.assetService.getAssetById(authUser, id);
|
return this.assetService.getAssetById(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ export class AssetController {
|
|||||||
*/
|
*/
|
||||||
@Put('/:id')
|
@Put('/:id')
|
||||||
updateAsset(
|
updateAsset(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body(ValidationPipe) dto: UpdateAssetDto,
|
@Body(ValidationPipe) dto: UpdateAssetDto,
|
||||||
): Promise<AssetResponseDto> {
|
): Promise<AssetResponseDto> {
|
||||||
@ -274,7 +274,7 @@ export class AssetController {
|
|||||||
|
|
||||||
@Delete('/')
|
@Delete('/')
|
||||||
deleteAsset(
|
deleteAsset(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: DeleteAssetDto,
|
@Body(ValidationPipe) dto: DeleteAssetDto,
|
||||||
): Promise<DeleteAssetResponseDto[]> {
|
): Promise<DeleteAssetResponseDto[]> {
|
||||||
return this.assetService.deleteAll(authUser, dto);
|
return this.assetService.deleteAll(authUser, dto);
|
||||||
@ -287,7 +287,7 @@ export class AssetController {
|
|||||||
@Post('/check')
|
@Post('/check')
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
checkDuplicateAsset(
|
checkDuplicateAsset(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: CheckDuplicateAssetDto,
|
@Body(ValidationPipe) dto: CheckDuplicateAssetDto,
|
||||||
): Promise<CheckDuplicateAssetResponseDto> {
|
): Promise<CheckDuplicateAssetResponseDto> {
|
||||||
return this.assetService.checkDuplicatedAsset(authUser, dto);
|
return this.assetService.checkDuplicatedAsset(authUser, dto);
|
||||||
@ -299,7 +299,7 @@ export class AssetController {
|
|||||||
@Post('/exist')
|
@Post('/exist')
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
checkExistingAssets(
|
checkExistingAssets(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: CheckExistingAssetsDto,
|
@Body(ValidationPipe) dto: CheckExistingAssetsDto,
|
||||||
): Promise<CheckExistingAssetsResponseDto> {
|
): Promise<CheckExistingAssetsResponseDto> {
|
||||||
return this.assetService.checkExistingAssets(authUser, dto);
|
return this.assetService.checkExistingAssets(authUser, dto);
|
||||||
@ -311,7 +311,7 @@ export class AssetController {
|
|||||||
@Post('/bulk-upload-check')
|
@Post('/bulk-upload-check')
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
bulkUploadCheck(
|
bulkUploadCheck(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: AssetBulkUploadCheckDto,
|
@Body(ValidationPipe) dto: AssetBulkUploadCheckDto,
|
||||||
): Promise<AssetBulkUploadCheckResponseDto> {
|
): Promise<AssetBulkUploadCheckResponseDto> {
|
||||||
return this.assetService.bulkUploadCheck(authUser, dto);
|
return this.assetService.bulkUploadCheck(authUser, dto);
|
||||||
@ -319,7 +319,7 @@ export class AssetController {
|
|||||||
|
|
||||||
@Post('/shared-link')
|
@Post('/shared-link')
|
||||||
createAssetsSharedLink(
|
createAssetsSharedLink(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: CreateAssetsShareLinkDto,
|
@Body(ValidationPipe) dto: CreateAssetsShareLinkDto,
|
||||||
): Promise<SharedLinkResponseDto> {
|
): Promise<SharedLinkResponseDto> {
|
||||||
return this.assetService.createAssetsSharedLink(authUser, dto);
|
return this.assetService.createAssetsSharedLink(authUser, dto);
|
||||||
@ -328,7 +328,7 @@ export class AssetController {
|
|||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Patch('/shared-link/add')
|
@Patch('/shared-link/add')
|
||||||
addAssetsToSharedLink(
|
addAssetsToSharedLink(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: AddAssetsDto,
|
@Body(ValidationPipe) dto: AddAssetsDto,
|
||||||
): Promise<SharedLinkResponseDto> {
|
): Promise<SharedLinkResponseDto> {
|
||||||
return this.assetService.addAssetsToSharedLink(authUser, dto);
|
return this.assetService.addAssetsToSharedLink(authUser, dto);
|
||||||
@ -337,7 +337,7 @@ export class AssetController {
|
|||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Patch('/shared-link/remove')
|
@Patch('/shared-link/remove')
|
||||||
removeAssetsFromSharedLink(
|
removeAssetsFromSharedLink(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body(ValidationPipe) dto: RemoveAssetsDto,
|
@Body(ValidationPipe) dto: RemoveAssetsDto,
|
||||||
): Promise<SharedLinkResponseDto> {
|
): Promise<SharedLinkResponseDto> {
|
||||||
return this.assetService.removeAssetsFromSharedLink(authUser, dto);
|
return this.assetService.removeAssetsFromSharedLink(authUser, dto);
|
||||||
|
@ -10,7 +10,7 @@ import { GetAlbumsDto } from '@app/domain/album/dto/get-albums.dto';
|
|||||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { ParseMeUUIDPipe } from '../api-v1/validation/parse-me-uuid-pipe';
|
import { ParseMeUUIDPipe } from '../api-v1/validation/parse-me-uuid-pipe';
|
||||||
import { GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -23,38 +23,38 @@ export class AlbumController {
|
|||||||
constructor(private service: AlbumService) {}
|
constructor(private service: AlbumService) {}
|
||||||
|
|
||||||
@Get('count')
|
@Get('count')
|
||||||
getAlbumCount(@GetAuthUser() authUser: AuthUserDto): Promise<AlbumCountResponseDto> {
|
getAlbumCount(@AuthUser() authUser: AuthUserDto): Promise<AlbumCountResponseDto> {
|
||||||
return this.service.getCount(authUser);
|
return this.service.getCount(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getAllAlbums(@GetAuthUser() authUser: AuthUserDto, @Query() query: GetAlbumsDto) {
|
getAllAlbums(@AuthUser() authUser: AuthUserDto, @Query() query: GetAlbumsDto) {
|
||||||
return this.service.getAll(authUser, query);
|
return this.service.getAll(authUser, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
createAlbum(@GetAuthUser() authUser: AuthUserDto, @Body() dto: CreateAlbumDto) {
|
createAlbum(@AuthUser() authUser: AuthUserDto, @Body() dto: CreateAlbumDto) {
|
||||||
return this.service.create(authUser, dto);
|
return this.service.create(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id')
|
@Patch(':id')
|
||||||
updateAlbumInfo(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto, @Body() dto: UpdateAlbumDto) {
|
updateAlbumInfo(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto, @Body() dto: UpdateAlbumDto) {
|
||||||
return this.service.update(authUser, id, dto);
|
return this.service.update(authUser, id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
deleteAlbum(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
deleteAlbum(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
||||||
return this.service.delete(authUser, id);
|
return this.service.delete(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/users')
|
@Put(':id/users')
|
||||||
addUsersToAlbum(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto, @Body() dto: AddUsersDto) {
|
addUsersToAlbum(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto, @Body() dto: AddUsersDto) {
|
||||||
return this.service.addUsers(authUser, id, dto);
|
return this.service.addUsers(authUser, id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id/user/:userId')
|
@Delete(':id/user/:userId')
|
||||||
removeUserFromAlbum(
|
removeUserFromAlbum(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Param('userId', new ParseMeUUIDPipe({ version: '4' })) userId: string,
|
@Param('userId', new ParseMeUUIDPipe({ version: '4' })) userId: string,
|
||||||
) {
|
) {
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from '@app/domain';
|
} from '@app/domain';
|
||||||
import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -21,23 +21,23 @@ export class APIKeyController {
|
|||||||
constructor(private service: APIKeyService) {}
|
constructor(private service: APIKeyService) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
createKey(@GetAuthUser() authUser: AuthUserDto, @Body() dto: APIKeyCreateDto): Promise<APIKeyCreateResponseDto> {
|
createKey(@AuthUser() authUser: AuthUserDto, @Body() dto: APIKeyCreateDto): Promise<APIKeyCreateResponseDto> {
|
||||||
return this.service.create(authUser, dto);
|
return this.service.create(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getKeys(@GetAuthUser() authUser: AuthUserDto): Promise<APIKeyResponseDto[]> {
|
getKeys(@AuthUser() authUser: AuthUserDto): Promise<APIKeyResponseDto[]> {
|
||||||
return this.service.getAll(authUser);
|
return this.service.getAll(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
getKey(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<APIKeyResponseDto> {
|
getKey(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<APIKeyResponseDto> {
|
||||||
return this.service.getById(authUser, id);
|
return this.service.getById(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
updateKey(
|
updateKey(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body() dto: APIKeyUpdateDto,
|
@Body() dto: APIKeyUpdateDto,
|
||||||
): Promise<APIKeyResponseDto> {
|
): Promise<APIKeyResponseDto> {
|
||||||
@ -45,7 +45,7 @@ export class APIKeyController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
deleteKey(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
deleteKey(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||||
return this.service.delete(authUser, id);
|
return this.service.delete(authUser, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { AssetService, AuthUserDto, MapMarkerResponseDto, MemoryLaneDto } from '
|
|||||||
import { MapMarkerDto } from '@app/domain/asset/dto/map-marker.dto';
|
import { MapMarkerDto } from '@app/domain/asset/dto/map-marker.dto';
|
||||||
import { Controller, Get, Query } from '@nestjs/common';
|
import { Controller, Get, Query } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { MemoryLaneResponseDto } from '@app/domain/asset/response-dto/memory-lane-response.dto';
|
import { MemoryLaneResponseDto } from '@app/domain/asset/response-dto/memory-lane-response.dto';
|
||||||
@ -15,12 +15,12 @@ export class AssetController {
|
|||||||
constructor(private service: AssetService) {}
|
constructor(private service: AssetService) {}
|
||||||
|
|
||||||
@Get('map-marker')
|
@Get('map-marker')
|
||||||
getMapMarkers(@GetAuthUser() authUser: AuthUserDto, @Query() options: MapMarkerDto): Promise<MapMarkerResponseDto[]> {
|
getMapMarkers(@AuthUser() authUser: AuthUserDto, @Query() options: MapMarkerDto): Promise<MapMarkerResponseDto[]> {
|
||||||
return this.service.getMapMarkers(authUser, options);
|
return this.service.getMapMarkers(authUser, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('memory-lane')
|
@Get('memory-lane')
|
||||||
getMemoryLane(@GetAuthUser() authUser: AuthUserDto, @Query() dto: MemoryLaneDto): Promise<MemoryLaneResponseDto[]> {
|
getMemoryLane(@AuthUser() authUser: AuthUserDto, @Query() dto: MemoryLaneDto): Promise<MemoryLaneResponseDto[]> {
|
||||||
return this.service.getMemoryLane(authUser, dto);
|
return this.service.getMemoryLane(authUser, dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
import { Body, Controller, Delete, Get, Param, Post, Req, Res } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Post, Req, Res } from '@nestjs/common';
|
||||||
import { ApiBadRequestResponse, ApiTags } from '@nestjs/swagger';
|
import { ApiBadRequestResponse, ApiTags } from '@nestjs/swagger';
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { GetAuthUser, GetLoginDetails } from '../decorators/auth-user.decorator';
|
import { AuthUser, GetLoginDetails } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
|
import { Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -50,17 +50,17 @@ export class AuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('devices')
|
@Get('devices')
|
||||||
getAuthDevices(@GetAuthUser() authUser: AuthUserDto): Promise<AuthDeviceResponseDto[]> {
|
getAuthDevices(@AuthUser() authUser: AuthUserDto): Promise<AuthDeviceResponseDto[]> {
|
||||||
return this.service.getDevices(authUser);
|
return this.service.getDevices(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete('devices')
|
@Delete('devices')
|
||||||
logoutAuthDevices(@GetAuthUser() authUser: AuthUserDto): Promise<void> {
|
logoutAuthDevices(@AuthUser() authUser: AuthUserDto): Promise<void> {
|
||||||
return this.service.logoutDevices(authUser);
|
return this.service.logoutDevices(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete('devices/:id')
|
@Delete('devices/:id')
|
||||||
logoutAuthDevice(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
logoutAuthDevice(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||||
return this.service.logoutDevice(authUser, id);
|
return this.service.logoutDevice(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ export class AuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('change-password')
|
@Post('change-password')
|
||||||
changePassword(@GetAuthUser() authUser: AuthUserDto, @Body() dto: ChangePasswordDto): Promise<UserResponseDto> {
|
changePassword(@AuthUser() authUser: AuthUserDto, @Body() dto: ChangePasswordDto): Promise<UserResponseDto> {
|
||||||
return this.service.changePassword(authUser, dto);
|
return this.service.changePassword(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ export class AuthController {
|
|||||||
logout(
|
logout(
|
||||||
@Req() req: Request,
|
@Req() req: Request,
|
||||||
@Res({ passthrough: true }) res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
): Promise<LogoutResponseDto> {
|
): Promise<LogoutResponseDto> {
|
||||||
const authType: AuthType = req.cookies[IMMICH_AUTH_TYPE_COOKIE];
|
const authType: AuthType = req.cookies[IMMICH_AUTH_TYPE_COOKIE];
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
import { Body, Controller, Get, HttpStatus, Post, Redirect, Req, Res } from '@nestjs/common';
|
import { Body, Controller, Get, HttpStatus, Post, Redirect, Req, Res } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { GetAuthUser, GetLoginDetails } from '../decorators/auth-user.decorator';
|
import { AuthUser, GetLoginDetails } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
|
import { Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
|
|
||||||
@ -51,12 +51,12 @@ export class OAuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('link')
|
@Post('link')
|
||||||
link(@GetAuthUser() authUser: AuthUserDto, @Body() dto: OAuthCallbackDto): Promise<UserResponseDto> {
|
link(@AuthUser() authUser: AuthUserDto, @Body() dto: OAuthCallbackDto): Promise<UserResponseDto> {
|
||||||
return this.service.link(authUser, dto);
|
return this.service.link(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('unlink')
|
@Post('unlink')
|
||||||
unlink(@GetAuthUser() authUser: AuthUserDto): Promise<UserResponseDto> {
|
unlink(@AuthUser() authUser: AuthUserDto): Promise<UserResponseDto> {
|
||||||
return this.service.unlink(authUser);
|
return this.service.unlink(authUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { PartnerDirection, PartnerService, UserResponseDto } from '@app/domain';
|
import { PartnerDirection, PartnerService, UserResponseDto } from '@app/domain';
|
||||||
import { Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
|
import { Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
|
||||||
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
import { AuthUserDto, GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUserDto, AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -16,19 +16,19 @@ export class PartnerController {
|
|||||||
@Get()
|
@Get()
|
||||||
@ApiQuery({ name: 'direction', type: 'string', enum: PartnerDirection, required: true })
|
@ApiQuery({ name: 'direction', type: 'string', enum: PartnerDirection, required: true })
|
||||||
getPartners(
|
getPartners(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Query('direction') direction: PartnerDirection,
|
@Query('direction') direction: PartnerDirection,
|
||||||
): Promise<UserResponseDto[]> {
|
): Promise<UserResponseDto[]> {
|
||||||
return this.service.getAll(authUser, direction);
|
return this.service.getAll(authUser, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(':id')
|
@Post(':id')
|
||||||
createPartner(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<UserResponseDto> {
|
createPartner(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<UserResponseDto> {
|
||||||
return this.service.create(authUser, id);
|
return this.service.create(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
removePartner(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
removePartner(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||||
return this.service.remove(authUser, id);
|
return this.service.remove(authUser, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,7 @@ import {
|
|||||||
} from '@app/domain';
|
} from '@app/domain';
|
||||||
import { Body, Controller, Get, Param, Put, StreamableFile } from '@nestjs/common';
|
import { Body, Controller, Get, Param, Put, StreamableFile } from '@nestjs/common';
|
||||||
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
||||||
import { GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
||||||
|
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -26,18 +25,18 @@ export class PersonController {
|
|||||||
constructor(private service: PersonService) {}
|
constructor(private service: PersonService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getAllPeople(@GetAuthUser() authUser: AuthUserDto): Promise<PersonResponseDto[]> {
|
getAllPeople(@AuthUser() authUser: AuthUserDto): Promise<PersonResponseDto[]> {
|
||||||
return this.service.getAll(authUser);
|
return this.service.getAll(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
getPerson(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<PersonResponseDto> {
|
getPerson(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<PersonResponseDto> {
|
||||||
return this.service.getById(authUser, id);
|
return this.service.getById(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
updatePerson(
|
updatePerson(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body() dto: PersonUpdateDto,
|
@Body() dto: PersonUpdateDto,
|
||||||
): Promise<PersonResponseDto> {
|
): Promise<PersonResponseDto> {
|
||||||
@ -46,12 +45,12 @@ export class PersonController {
|
|||||||
|
|
||||||
@Get(':id/thumbnail')
|
@Get(':id/thumbnail')
|
||||||
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
@ApiOkResponse({ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } } })
|
||||||
getPersonThumbnail(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
getPersonThumbnail(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) {
|
||||||
return this.service.getThumbnail(authUser, id).then(asStreamableFile);
|
return this.service.getThumbnail(authUser, id).then(asStreamableFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/assets')
|
@Get(':id/assets')
|
||||||
getPersonAssets(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto[]> {
|
getPersonAssets(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto[]> {
|
||||||
return this.service.getAssets(authUser, id);
|
return this.service.getAssets(authUser, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from '@app/domain';
|
} from '@app/domain';
|
||||||
import { Controller, Get, Query } from '@nestjs/common';
|
import { Controller, Get, Query } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ export class SearchController {
|
|||||||
constructor(private service: SearchService) {}
|
constructor(private service: SearchService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
search(@GetAuthUser() authUser: AuthUserDto, @Query() dto: SearchDto): Promise<SearchResponseDto> {
|
search(@AuthUser() authUser: AuthUserDto, @Query() dto: SearchDto): Promise<SearchResponseDto> {
|
||||||
return this.service.search(authUser, dto);
|
return this.service.search(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ export class SearchController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('explore')
|
@Get('explore')
|
||||||
getExploreData(@GetAuthUser() authUser: AuthUserDto): Promise<SearchExploreResponseDto[]> {
|
getExploreData(@AuthUser() authUser: AuthUserDto): Promise<SearchExploreResponseDto[]> {
|
||||||
return this.service.getExploreData(authUser) as Promise<SearchExploreResponseDto[]>;
|
return this.service.getExploreData(authUser) as Promise<SearchExploreResponseDto[]>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { AuthUserDto, EditSharedLinkDto, SharedLinkResponseDto, SharedLinkService } from '@app/domain';
|
import { AuthUserDto, EditSharedLinkDto, SharedLinkResponseDto, SharedLinkService } from '@app/domain';
|
||||||
import { Body, Controller, Delete, Get, Param, Patch } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Patch } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated, SharedLinkRoute } from '../decorators/authenticated.decorator';
|
import { Authenticated, SharedLinkRoute } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -14,27 +14,24 @@ export class SharedLinkController {
|
|||||||
constructor(private readonly service: SharedLinkService) {}
|
constructor(private readonly service: SharedLinkService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getAllSharedLinks(@GetAuthUser() authUser: AuthUserDto): Promise<SharedLinkResponseDto[]> {
|
getAllSharedLinks(@AuthUser() authUser: AuthUserDto): Promise<SharedLinkResponseDto[]> {
|
||||||
return this.service.getAll(authUser);
|
return this.service.getAll(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SharedLinkRoute()
|
@SharedLinkRoute()
|
||||||
@Get('me')
|
@Get('me')
|
||||||
getMySharedLink(@GetAuthUser() authUser: AuthUserDto): Promise<SharedLinkResponseDto> {
|
getMySharedLink(@AuthUser() authUser: AuthUserDto): Promise<SharedLinkResponseDto> {
|
||||||
return this.service.getMine(authUser);
|
return this.service.getMine(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
getSharedLinkById(
|
getSharedLinkById(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<SharedLinkResponseDto> {
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
|
||||||
@Param() { id }: UUIDParamDto,
|
|
||||||
): Promise<SharedLinkResponseDto> {
|
|
||||||
return this.service.get(authUser, id);
|
return this.service.get(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id')
|
@Patch(':id')
|
||||||
updateSharedLink(
|
updateSharedLink(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body() dto: EditSharedLinkDto,
|
@Body() dto: EditSharedLinkDto,
|
||||||
): Promise<SharedLinkResponseDto> {
|
): Promise<SharedLinkResponseDto> {
|
||||||
@ -42,7 +39,7 @@ export class SharedLinkController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
removeSharedLink(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
removeSharedLink(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||||
return this.service.remove(authUser, id);
|
return this.service.remove(authUser, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
} from '@app/domain';
|
} from '@app/domain';
|
||||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { AuthUserDto, GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUserDto, AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { Authenticated } from '../decorators/authenticated.decorator';
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
||||||
import { UseValidation } from '../decorators/use-validation.decorator';
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
||||||
import { UUIDParamDto } from './dto/uuid-param.dto';
|
import { UUIDParamDto } from './dto/uuid-param.dto';
|
||||||
@ -22,23 +22,23 @@ export class TagController {
|
|||||||
constructor(private service: TagService) {}
|
constructor(private service: TagService) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
createTag(@GetAuthUser() authUser: AuthUserDto, @Body() dto: CreateTagDto): Promise<TagResponseDto> {
|
createTag(@AuthUser() authUser: AuthUserDto, @Body() dto: CreateTagDto): Promise<TagResponseDto> {
|
||||||
return this.service.create(authUser, dto);
|
return this.service.create(authUser, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getAllTags(@GetAuthUser() authUser: AuthUserDto): Promise<TagResponseDto[]> {
|
getAllTags(@AuthUser() authUser: AuthUserDto): Promise<TagResponseDto[]> {
|
||||||
return this.service.getAll(authUser);
|
return this.service.getAll(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
getTagById(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<TagResponseDto> {
|
getTagById(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<TagResponseDto> {
|
||||||
return this.service.getById(authUser, id);
|
return this.service.getById(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id')
|
@Patch(':id')
|
||||||
updateTag(
|
updateTag(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body() dto: UpdateTagDto,
|
@Body() dto: UpdateTagDto,
|
||||||
): Promise<TagResponseDto> {
|
): Promise<TagResponseDto> {
|
||||||
@ -46,18 +46,18 @@ export class TagController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
deleteTag(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
deleteTag(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||||
return this.service.remove(authUser, id);
|
return this.service.remove(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/assets')
|
@Get(':id/assets')
|
||||||
getTagAssets(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto[]> {
|
getTagAssets(@AuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto[]> {
|
||||||
return this.service.getAssets(authUser, id);
|
return this.service.getAssets(authUser, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/assets')
|
@Put(':id/assets')
|
||||||
tagAssets(
|
tagAssets(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
@Body() dto: AssetIdsDto,
|
@Body() dto: AssetIdsDto,
|
||||||
): Promise<AssetIdsResponseDto[]> {
|
): Promise<AssetIdsResponseDto[]> {
|
||||||
@ -66,7 +66,7 @@ export class TagController {
|
|||||||
|
|
||||||
@Delete(':id/assets')
|
@Delete(':id/assets')
|
||||||
untagAssets(
|
untagAssets(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@Body() dto: AssetIdsDto,
|
@Body() dto: AssetIdsDto,
|
||||||
@Param() { id }: UUIDParamDto,
|
@Param() { id }: UUIDParamDto,
|
||||||
): Promise<AssetIdsResponseDto[]> {
|
): Promise<AssetIdsResponseDto[]> {
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { UserService } from '@app/domain';
|
import { UserService } from '@app/domain';
|
||||||
import { AdminRoute, Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
|
import { AdminRoute, Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
|
||||||
import { AuthUserDto, GetAuthUser } from '../decorators/auth-user.decorator';
|
import { AuthUserDto, AuthUser } from '../decorators/auth-user.decorator';
|
||||||
import { CreateUserDto } from '@app/domain';
|
import { CreateUserDto } from '@app/domain';
|
||||||
import { UpdateUserDto } from '@app/domain';
|
import { UpdateUserDto } from '@app/domain';
|
||||||
import { FileInterceptor } from '@nestjs/platform-express';
|
import { FileInterceptor } from '@nestjs/platform-express';
|
||||||
@ -38,7 +38,7 @@ export class UserController {
|
|||||||
constructor(private service: UserService) {}
|
constructor(private service: UserService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getAllUsers(@GetAuthUser() authUser: AuthUserDto, @Query('isAll') isAll: boolean): Promise<UserResponseDto[]> {
|
getAllUsers(@AuthUser() authUser: AuthUserDto, @Query('isAll') isAll: boolean): Promise<UserResponseDto[]> {
|
||||||
return this.service.getAllUsers(authUser, isAll);
|
return this.service.getAllUsers(authUser, isAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ export class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('me')
|
@Get('me')
|
||||||
getMyUserInfo(@GetAuthUser() authUser: AuthUserDto): Promise<UserResponseDto> {
|
getMyUserInfo(@AuthUser() authUser: AuthUserDto): Promise<UserResponseDto> {
|
||||||
return this.service.getUserInfo(authUser);
|
return this.service.getUserInfo(authUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,18 +66,18 @@ export class UserController {
|
|||||||
|
|
||||||
@AdminRoute()
|
@AdminRoute()
|
||||||
@Delete('/:userId')
|
@Delete('/:userId')
|
||||||
deleteUser(@GetAuthUser() authUser: AuthUserDto, @Param() { userId }: UserIdDto): Promise<UserResponseDto> {
|
deleteUser(@AuthUser() authUser: AuthUserDto, @Param() { userId }: UserIdDto): Promise<UserResponseDto> {
|
||||||
return this.service.deleteUser(authUser, userId);
|
return this.service.deleteUser(authUser, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AdminRoute()
|
@AdminRoute()
|
||||||
@Post('/:userId/restore')
|
@Post('/:userId/restore')
|
||||||
restoreUser(@GetAuthUser() authUser: AuthUserDto, @Param() { userId }: UserIdDto): Promise<UserResponseDto> {
|
restoreUser(@AuthUser() authUser: AuthUserDto, @Param() { userId }: UserIdDto): Promise<UserResponseDto> {
|
||||||
return this.service.restoreUser(authUser, userId);
|
return this.service.restoreUser(authUser, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put()
|
@Put()
|
||||||
updateUser(@GetAuthUser() authUser: AuthUserDto, @Body() updateUserDto: UpdateUserDto): Promise<UserResponseDto> {
|
updateUser(@AuthUser() authUser: AuthUserDto, @Body() updateUserDto: UpdateUserDto): Promise<UserResponseDto> {
|
||||||
return this.service.updateUser(authUser, updateUserDto);
|
return this.service.updateUser(authUser, updateUserDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ export class UserController {
|
|||||||
})
|
})
|
||||||
@Post('/profile-image')
|
@Post('/profile-image')
|
||||||
createProfileImage(
|
createProfileImage(
|
||||||
@GetAuthUser() authUser: AuthUserDto,
|
@AuthUser() authUser: AuthUserDto,
|
||||||
@UploadedFile() fileInfo: Express.Multer.File,
|
@UploadedFile() fileInfo: Express.Multer.File,
|
||||||
): Promise<CreateProfileImageResponseDto> {
|
): Promise<CreateProfileImageResponseDto> {
|
||||||
return this.service.createProfileImage(authUser, fileInfo);
|
return this.service.createProfileImage(authUser, fileInfo);
|
||||||
|
@ -8,7 +8,7 @@ export interface AuthRequest extends Request {
|
|||||||
user?: AuthUserDto;
|
user?: AuthUserDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GetAuthUser = createParamDecorator((data, ctx: ExecutionContext): AuthUserDto => {
|
export const AuthUser = createParamDecorator((data, ctx: ExecutionContext): AuthUserDto => {
|
||||||
return ctx.switchToHttp().getRequest<{ user: AuthUserDto }>().user;
|
return ctx.switchToHttp().getRequest<{ user: AuthUserDto }>().user;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user