1
0
mirror of https://github.com/immich-app/immich.git synced 2025-01-02 12:48:35 +02:00

chore: move controllers and middleware (#8119)

This commit is contained in:
Jason Rasmussen 2024-03-20 15:15:01 -05:00 committed by GitHub
parent 81f0265095
commit 40e079a247
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 55 additions and 60 deletions

View File

@ -1,7 +1,7 @@
import { api } from 'e2e/client'; import { api } from 'e2e/client';
import fs from 'node:fs'; import fs from 'node:fs';
import { LibraryController } from 'src/controllers/library.controller';
import { LoginResponseDto } from 'src/domain/auth/auth.dto'; import { LoginResponseDto } from 'src/domain/auth/auth.dto';
import { LibraryController } from 'src/immich/controllers/library.controller';
import { LibraryType } from 'src/infra/entities/library.entity'; import { LibraryType } from 'src/infra/entities/library.entity';
import { IMMICH_TEST_ASSET_PATH, IMMICH_TEST_ASSET_TEMP_PATH, restoreTempFolder, testApp } from 'src/test-utils/utils'; import { IMMICH_TEST_ASSET_PATH, IMMICH_TEST_ASSET_TEMP_PATH, restoreTempFolder, testApp } from 'src/test-utils/utils';
import request from 'supertest'; import request from 'supertest';

View File

@ -10,7 +10,7 @@ import {
} from 'src/domain/activity/activity.dto'; } from 'src/domain/activity/activity.dto';
import { ActivityService } from 'src/domain/activity/activity.service'; import { ActivityService } from 'src/domain/activity/activity.service';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Activity') @ApiTags('Activity')

View File

@ -9,7 +9,7 @@ import { AlbumInfoDto } from 'src/domain/album/dto/album.dto';
import { GetAlbumsDto } from 'src/domain/album/dto/get-albums.dto'; import { GetAlbumsDto } from 'src/domain/album/dto/get-albums.dto';
import { BulkIdResponseDto, BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; import { BulkIdResponseDto, BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { Auth, Authenticated, SharedLinkRoute } from 'src/immich/app.guard'; import { Auth, Authenticated, SharedLinkRoute } from 'src/middleware/auth.guard';
import { ParseMeUUIDPipe, UUIDParamDto } from 'src/validation'; import { ParseMeUUIDPipe, UUIDParamDto } from 'src/validation';
@ApiTags('Album') @ApiTags('Album')

View File

@ -8,7 +8,7 @@ import {
} from 'src/domain/api-key/api-key.dto'; } from 'src/domain/api-key/api-key.dto';
import { APIKeyService } from 'src/domain/api-key/api-key.service'; import { APIKeyService } from 'src/domain/api-key/api-key.service';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('API Key') @ApiTags('API Key')

View File

@ -1,7 +1,7 @@
import { Controller, Get, Header } from '@nestjs/common'; import { Controller, Get, Header } from '@nestjs/common';
import { ApiExcludeEndpoint } from '@nestjs/swagger'; import { ApiExcludeEndpoint } from '@nestjs/swagger';
import { SystemConfigService } from 'src/domain/system-config/system-config.service'; import { SystemConfigService } from 'src/domain/system-config/system-config.service';
import { PublicRoute } from 'src/immich/app.guard'; import { PublicRoute } from 'src/middleware/auth.guard';
@Controller() @Controller()
export class AppController { export class AppController {

View File

@ -20,8 +20,8 @@ import { TimeBucketResponseDto } from 'src/domain/asset/response-dto/time-bucket
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { MetadataSearchDto } from 'src/domain/search/dto/search.dto'; import { MetadataSearchDto } from 'src/domain/search/dto/search.dto';
import { SearchService } from 'src/domain/search/search.service'; import { SearchService } from 'src/domain/search/search.service';
import { Auth, Authenticated, SharedLinkRoute } from 'src/immich/app.guard'; import { Auth, Authenticated, SharedLinkRoute } from 'src/middleware/auth.guard';
import { Route } from 'src/immich/interceptors/file-upload.interceptor'; import { Route } from 'src/middleware/file-upload.interceptor';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Asset') @ApiTags('Asset')

View File

@ -10,7 +10,7 @@ import {
} from 'src/domain/audit/audit.dto'; } from 'src/domain/audit/audit.dto';
import { AuditService } from 'src/domain/audit/audit.service'; import { AuditService } from 'src/domain/audit/audit.service';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { AdminRoute, Auth, Authenticated } from 'src/immich/app.guard'; import { AdminRoute, Auth, Authenticated } from 'src/middleware/auth.guard';
@ApiTags('Audit') @ApiTags('Audit')
@Controller('audit') @Controller('audit')

View File

@ -14,7 +14,7 @@ import {
} from 'src/domain/auth/auth.dto'; } from 'src/domain/auth/auth.dto';
import { AuthService, LoginDetails } from 'src/domain/auth/auth.service'; import { AuthService, LoginDetails } from 'src/domain/auth/auth.service';
import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto'; import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto';
import { Auth, Authenticated, GetLoginDetails, PublicRoute } from 'src/immich/app.guard'; import { Auth, Authenticated, GetLoginDetails, PublicRoute } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Authentication') @ApiTags('Authentication')

View File

@ -5,8 +5,8 @@ import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { DownloadInfoDto, DownloadResponseDto } from 'src/domain/download/download.dto'; import { DownloadInfoDto, DownloadResponseDto } from 'src/domain/download/download.dto';
import { DownloadService } from 'src/domain/download/download.service'; import { DownloadService } from 'src/domain/download/download.service';
import { Auth, Authenticated, FileResponse, SharedLinkRoute } from 'src/immich/app.guard';
import { asStreamableFile, sendFile } from 'src/immich/app.utils'; import { asStreamableFile, sendFile } from 'src/immich/app.utils';
import { Auth, Authenticated, FileResponse, SharedLinkRoute } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Download') @ApiTags('Download')

View File

@ -3,7 +3,7 @@ import { ApiTags } from '@nestjs/swagger';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { AssetFaceResponseDto, FaceDto, PersonResponseDto } from 'src/domain/person/person.dto'; import { AssetFaceResponseDto, FaceDto, PersonResponseDto } from 'src/domain/person/person.dto';
import { PersonService } from 'src/domain/person/person.service'; import { PersonService } from 'src/domain/person/person.service';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Face') @ApiTags('Face')

View File

@ -2,7 +2,7 @@ import { Body, Controller, Get, Param, Put } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AllJobStatusResponseDto, JobCommandDto, JobIdParamDto, JobStatusDto } from 'src/domain/job/job.dto'; import { AllJobStatusResponseDto, JobCommandDto, JobIdParamDto, JobStatusDto } from 'src/domain/job/job.dto';
import { JobService } from 'src/domain/job/job.service'; import { JobService } from 'src/domain/job/job.service';
import { Authenticated } from 'src/immich/app.guard'; import { Authenticated } from 'src/middleware/auth.guard';
@ApiTags('Job') @ApiTags('Job')
@Controller('jobs') @Controller('jobs')

View File

@ -11,7 +11,7 @@ import {
ValidateLibraryResponseDto, ValidateLibraryResponseDto,
} from 'src/domain/library/library.dto'; } from 'src/domain/library/library.dto';
import { LibraryService } from 'src/domain/library/library.service'; import { LibraryService } from 'src/domain/library/library.service';
import { AdminRoute, Authenticated } from 'src/immich/app.guard'; import { AdminRoute, Authenticated } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Library') @ApiTags('Library')

View File

@ -10,7 +10,7 @@ import {
} from 'src/domain/auth/auth.dto'; } from 'src/domain/auth/auth.dto';
import { AuthService, LoginDetails } from 'src/domain/auth/auth.service'; import { AuthService, LoginDetails } from 'src/domain/auth/auth.service';
import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto';
import { Auth, Authenticated, GetLoginDetails, PublicRoute } from 'src/immich/app.guard'; import { Auth, Authenticated, GetLoginDetails, PublicRoute } from 'src/middleware/auth.guard';
@ApiTags('OAuth') @ApiTags('OAuth')
@Controller('oauth') @Controller('oauth')

View File

@ -4,7 +4,7 @@ import { AuthDto } from 'src/domain/auth/auth.dto';
import { PartnerResponseDto, UpdatePartnerDto } from 'src/domain/partner/partner.dto'; import { PartnerResponseDto, UpdatePartnerDto } from 'src/domain/partner/partner.dto';
import { PartnerService } from 'src/domain/partner/partner.service'; import { PartnerService } from 'src/domain/partner/partner.service';
import { PartnerDirection } from 'src/domain/repositories/partner.repository'; import { PartnerDirection } from 'src/domain/repositories/partner.repository';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Partner') @ApiTags('Partner')

View File

@ -16,8 +16,8 @@ import {
PersonUpdateDto, PersonUpdateDto,
} from 'src/domain/person/person.dto'; } from 'src/domain/person/person.dto';
import { PersonService } from 'src/domain/person/person.service'; import { PersonService } from 'src/domain/person/person.service';
import { Auth, Authenticated, FileResponse } from 'src/immich/app.guard';
import { sendFile } from 'src/immich/app.utils'; import { sendFile } from 'src/immich/app.utils';
import { Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Person') @ApiTags('Person')

View File

@ -15,7 +15,7 @@ import {
import { SearchExploreResponseDto } from 'src/domain/search/response-dto/search-explore.response.dto'; import { SearchExploreResponseDto } from 'src/domain/search/response-dto/search-explore.response.dto';
import { SearchResponseDto } from 'src/domain/search/response-dto/search-response.dto'; import { SearchResponseDto } from 'src/domain/search/response-dto/search-response.dto';
import { SearchService } from 'src/domain/search/search.service'; import { SearchService } from 'src/domain/search/search.service';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
@ApiTags('Search') @ApiTags('Search')
@Controller('search') @Controller('search')

View File

@ -11,7 +11,7 @@ import {
ServerVersionResponseDto, ServerVersionResponseDto,
} from 'src/domain/server-info/server-info.dto'; } from 'src/domain/server-info/server-info.dto';
import { ServerInfoService } from 'src/domain/server-info/server-info.service'; import { ServerInfoService } from 'src/domain/server-info/server-info.service';
import { AdminRoute, Authenticated, PublicRoute } from 'src/immich/app.guard'; import { AdminRoute, Authenticated, PublicRoute } from 'src/middleware/auth.guard';
@ApiTags('Server Info') @ApiTags('Server Info')
@Controller('server-info') @Controller('server-info')

View File

@ -8,7 +8,7 @@ import { AuthDto } from 'src/domain/auth/auth.dto';
import { SharedLinkResponseDto } from 'src/domain/shared-link/shared-link-response.dto'; import { SharedLinkResponseDto } from 'src/domain/shared-link/shared-link-response.dto';
import { SharedLinkCreateDto, SharedLinkEditDto, SharedLinkPasswordDto } from 'src/domain/shared-link/shared-link.dto'; import { SharedLinkCreateDto, SharedLinkEditDto, SharedLinkPasswordDto } from 'src/domain/shared-link/shared-link.dto';
import { SharedLinkService } from 'src/domain/shared-link/shared-link.service'; import { SharedLinkService } from 'src/domain/shared-link/shared-link.service';
import { Auth, Authenticated, SharedLinkRoute } from 'src/immich/app.guard'; import { Auth, Authenticated, SharedLinkRoute } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Shared Link') @ApiTags('Shared Link')

View File

@ -4,7 +4,7 @@ import { SystemConfigDto } from 'src/domain/system-config/dto/system-config.dto'
import { SystemConfigTemplateStorageOptionDto } from 'src/domain/system-config/response-dto/system-config-template-storage-option.dto'; import { SystemConfigTemplateStorageOptionDto } from 'src/domain/system-config/response-dto/system-config-template-storage-option.dto';
import { MapThemeDto } from 'src/domain/system-config/system-config-map-theme.dto'; import { MapThemeDto } from 'src/domain/system-config/system-config-map-theme.dto';
import { SystemConfigService } from 'src/domain/system-config/system-config.service'; import { SystemConfigService } from 'src/domain/system-config/system-config.service';
import { AdminRoute, Authenticated } from 'src/immich/app.guard'; import { AdminRoute, Authenticated } from 'src/middleware/auth.guard';
@ApiTags('System Config') @ApiTags('System Config')
@Controller('system-config') @Controller('system-config')

View File

@ -7,7 +7,7 @@ import { AuthDto } from 'src/domain/auth/auth.dto';
import { TagResponseDto } from 'src/domain/tag/tag-response.dto'; import { TagResponseDto } from 'src/domain/tag/tag-response.dto';
import { CreateTagDto, UpdateTagDto } from 'src/domain/tag/tag.dto'; import { CreateTagDto, UpdateTagDto } from 'src/domain/tag/tag.dto';
import { TagService } from 'src/domain/tag/tag.service'; import { TagService } from 'src/domain/tag/tag.service';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('Tag') @ApiTags('Tag')

View File

@ -3,7 +3,7 @@ import { ApiTags } from '@nestjs/swagger';
import { BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; import { BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto';
import { AuthDto } from 'src/domain/auth/auth.dto'; import { AuthDto } from 'src/domain/auth/auth.dto';
import { TrashService } from 'src/domain/trash/trash.service'; import { TrashService } from 'src/domain/trash/trash.service';
import { Auth, Authenticated } from 'src/immich/app.guard'; import { Auth, Authenticated } from 'src/middleware/auth.guard';
@ApiTags('Trash') @ApiTags('Trash')
@Controller('trash') @Controller('trash')

View File

@ -24,9 +24,9 @@ import { UpdateUserDto } from 'src/domain/user/dto/update-user.dto';
import { CreateProfileImageResponseDto } from 'src/domain/user/response-dto/create-profile-image-response.dto'; import { CreateProfileImageResponseDto } from 'src/domain/user/response-dto/create-profile-image-response.dto';
import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto';
import { UserService } from 'src/domain/user/user.service'; import { UserService } from 'src/domain/user/user.service';
import { AdminRoute, Auth, Authenticated, FileResponse } from 'src/immich/app.guard';
import { sendFile } from 'src/immich/app.utils'; import { sendFile } from 'src/immich/app.utils';
import { FileUploadInterceptor, Route } from 'src/immich/interceptors/file-upload.interceptor'; import { AdminRoute, Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard';
import { FileUploadInterceptor, Route } from 'src/middleware/file-upload.interceptor';
import { UUIDParamDto } from 'src/validation'; import { UUIDParamDto } from 'src/validation';
@ApiTags('User') @ApiTags('User')

View File

@ -29,14 +29,9 @@ import { AssetFileUploadResponseDto } from 'src/immich/api-v1/asset/response-dto
import { CheckExistingAssetsResponseDto } from 'src/immich/api-v1/asset/response-dto/check-existing-assets-response.dto'; import { CheckExistingAssetsResponseDto } from 'src/immich/api-v1/asset/response-dto/check-existing-assets-response.dto';
import { CuratedLocationsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-locations-response.dto'; import { CuratedLocationsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-locations-response.dto';
import { CuratedObjectsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-objects-response.dto'; import { CuratedObjectsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-objects-response.dto';
import { Auth, Authenticated, FileResponse, SharedLinkRoute } from 'src/immich/app.guard';
import { sendFile } from 'src/immich/app.utils'; import { sendFile } from 'src/immich/app.utils';
import { import { Auth, Authenticated, FileResponse, SharedLinkRoute } from 'src/middleware/auth.guard';
FileUploadInterceptor, import { FileUploadInterceptor, ImmichFile, Route, mapToUploadFile } from 'src/middleware/file-upload.interceptor';
ImmichFile,
Route,
mapToUploadFile,
} from 'src/immich/interceptors/file-upload.interceptor';
import { FileNotEmptyValidator, UUIDParamDto } from 'src/validation'; import { FileNotEmptyValidator, UUIDParamDto } from 'src/validation';
interface UploadFiles { interface UploadFiles {

View File

@ -2,38 +2,38 @@ import { Module, OnModuleInit, ValidationPipe } from '@nestjs/common';
import { APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core'; import { APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
import { ScheduleModule } from '@nestjs/schedule'; import { ScheduleModule } from '@nestjs/schedule';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { ActivityController } from 'src/controllers/activity.controller';
import { AlbumController } from 'src/controllers/album.controller';
import { APIKeyController } from 'src/controllers/api-key.controller';
import { AppController } from 'src/controllers/app.controller';
import { AssetController, AssetsController } from 'src/controllers/asset.controller';
import { AuditController } from 'src/controllers/audit.controller';
import { AuthController } from 'src/controllers/auth.controller';
import { DownloadController } from 'src/controllers/download.controller';
import { FaceController } from 'src/controllers/face.controller';
import { JobController } from 'src/controllers/job.controller';
import { LibraryController } from 'src/controllers/library.controller';
import { OAuthController } from 'src/controllers/oauth.controller';
import { PartnerController } from 'src/controllers/partner.controller';
import { PersonController } from 'src/controllers/person.controller';
import { SearchController } from 'src/controllers/search.controller';
import { ServerInfoController } from 'src/controllers/server-info.controller';
import { SharedLinkController } from 'src/controllers/shared-link.controller';
import { SystemConfigController } from 'src/controllers/system-config.controller';
import { TagController } from 'src/controllers/tag.controller';
import { TrashController } from 'src/controllers/trash.controller';
import { UserController } from 'src/controllers/user.controller';
import { DomainModule } from 'src/domain/domain.module'; import { DomainModule } from 'src/domain/domain.module';
import { AssetRepositoryV1, IAssetRepositoryV1 } from 'src/immich/api-v1/asset/asset-repository'; import { AssetRepositoryV1, IAssetRepositoryV1 } from 'src/immich/api-v1/asset/asset-repository';
import { AssetController as AssetControllerV1 } from 'src/immich/api-v1/asset/asset.controller'; import { AssetController as AssetControllerV1 } from 'src/immich/api-v1/asset/asset.controller';
import { AssetService as AssetServiceV1 } from 'src/immich/api-v1/asset/asset.service'; import { AssetService as AssetServiceV1 } from 'src/immich/api-v1/asset/asset.service';
import { AppGuard } from 'src/immich/app.guard';
import { AppService } from 'src/immich/app.service'; import { AppService } from 'src/immich/app.service';
import { ActivityController } from 'src/immich/controllers/activity.controller';
import { AlbumController } from 'src/immich/controllers/album.controller';
import { APIKeyController } from 'src/immich/controllers/api-key.controller';
import { AppController } from 'src/immich/controllers/app.controller';
import { AssetController, AssetsController } from 'src/immich/controllers/asset.controller';
import { AuditController } from 'src/immich/controllers/audit.controller';
import { AuthController } from 'src/immich/controllers/auth.controller';
import { DownloadController } from 'src/immich/controllers/download.controller';
import { FaceController } from 'src/immich/controllers/face.controller';
import { JobController } from 'src/immich/controllers/job.controller';
import { LibraryController } from 'src/immich/controllers/library.controller';
import { OAuthController } from 'src/immich/controllers/oauth.controller';
import { PartnerController } from 'src/immich/controllers/partner.controller';
import { PersonController } from 'src/immich/controllers/person.controller';
import { SearchController } from 'src/immich/controllers/search.controller';
import { ServerInfoController } from 'src/immich/controllers/server-info.controller';
import { SharedLinkController } from 'src/immich/controllers/shared-link.controller';
import { SystemConfigController } from 'src/immich/controllers/system-config.controller';
import { TagController } from 'src/immich/controllers/tag.controller';
import { TrashController } from 'src/immich/controllers/trash.controller';
import { UserController } from 'src/immich/controllers/user.controller';
import { ErrorInterceptor } from 'src/immich/interceptors/error.interceptor';
import { FileUploadInterceptor } from 'src/immich/interceptors/file-upload.interceptor';
import { AssetEntity } from 'src/infra/entities/asset.entity'; import { AssetEntity } from 'src/infra/entities/asset.entity';
import { ExifEntity } from 'src/infra/entities/exif.entity'; import { ExifEntity } from 'src/infra/entities/exif.entity';
import { InfraModule } from 'src/infra/infra.module'; import { InfraModule } from 'src/infra/infra.module';
import { AuthGuard } from 'src/middleware/auth.guard';
import { ErrorInterceptor } from 'src/middleware/error.interceptor';
import { FileUploadInterceptor } from 'src/middleware/file-upload.interceptor';
@Module({ @Module({
imports: [ imports: [
@ -71,7 +71,7 @@ import { InfraModule } from 'src/infra/infra.module';
providers: [ providers: [
{ provide: APP_PIPE, useValue: new ValidationPipe({ transform: true, whitelist: true }) }, { provide: APP_PIPE, useValue: new ValidationPipe({ transform: true, whitelist: true }) },
{ provide: APP_INTERCEPTOR, useClass: ErrorInterceptor }, { provide: APP_INTERCEPTOR, useClass: ErrorInterceptor },
{ provide: APP_GUARD, useClass: AppGuard }, { provide: APP_GUARD, useClass: AuthGuard },
{ provide: IAssetRepositoryV1, useClass: AssetRepositoryV1 }, { provide: IAssetRepositoryV1, useClass: AssetRepositoryV1 },
AppService, AppService,
AssetServiceV1, AssetServiceV1,

View File

@ -16,8 +16,8 @@ import { promisify } from 'node:util';
import { IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER, IMMICH_API_KEY_NAME } from 'src/domain/auth/auth.constant'; import { IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER, IMMICH_API_KEY_NAME } from 'src/domain/auth/auth.constant';
import { serverVersion } from 'src/domain/domain.constant'; import { serverVersion } from 'src/domain/domain.constant';
import { ImmichReadStream } from 'src/domain/repositories/storage.repository'; import { ImmichReadStream } from 'src/domain/repositories/storage.repository';
import { Metadata } from 'src/immich/app.guard';
import { ImmichLogger } from 'src/infra/logger'; import { ImmichLogger } from 'src/infra/logger';
import { Metadata } from 'src/middleware/auth.guard';
import { CacheControl, ImmichFileResponse, isConnectionAborted } from 'src/utils'; import { CacheControl, ImmichFileResponse, isConnectionAborted } from 'src/utils';
type SendFile = Parameters<Response['sendFile']>; type SendFile = Parameters<Response['sendFile']>;

View File

@ -78,8 +78,8 @@ export interface AuthRequest extends Request {
} }
@Injectable() @Injectable()
export class AppGuard implements CanActivate { export class AuthGuard implements CanActivate {
private logger = new ImmichLogger(AppGuard.name); private logger = new ImmichLogger(AuthGuard.name);
constructor( constructor(
private reflector: Reflector, private reflector: Reflector,

View File

@ -7,8 +7,8 @@ import multer, { StorageEngine, diskStorage } from 'multer';
import { createHash, randomUUID } from 'node:crypto'; import { createHash, randomUUID } from 'node:crypto';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { AssetService, UploadFieldName, UploadFile } from 'src/domain/asset/asset.service'; import { AssetService, UploadFieldName, UploadFile } from 'src/domain/asset/asset.service';
import { AuthRequest } from 'src/immich/app.guard';
import { ImmichLogger } from 'src/infra/logger'; import { ImmichLogger } from 'src/infra/logger';
import { AuthRequest } from 'src/middleware/auth.guard';
export enum Route { export enum Route {
ASSET = 'asset', ASSET = 'asset',