mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: infra folder (#8138)
This commit is contained in:
parent
9fd5d2ad9c
commit
16d0df796c
139 changed files with 968 additions and 1164 deletions
|
|
@ -9,10 +9,10 @@ import {
|
|||
import { Reflector } from '@nestjs/core';
|
||||
import { ApiBearerAuth, ApiCookieAuth, ApiOkResponse, ApiQuery, ApiSecurity } from '@nestjs/swagger';
|
||||
import { Request } from 'express';
|
||||
import { IMMICH_API_KEY_NAME } from 'src/domain/auth/auth.constant';
|
||||
import { IMMICH_API_KEY_NAME } from 'src/constants';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
import { ImmichLogger } from 'src/infra/logger';
|
||||
import { AuthService, LoginDetails } from 'src/services/auth.service';
|
||||
import { ImmichLogger } from 'src/utils/logger';
|
||||
import { UAParser } from 'ua-parser-js';
|
||||
|
||||
export enum Metadata {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import {
|
|||
} from '@nestjs/common';
|
||||
import { Observable, catchError, throwError } from 'rxjs';
|
||||
import { routeToErrorMessage } from 'src/immich/app.utils';
|
||||
import { ImmichLogger } from 'src/infra/logger';
|
||||
import { isConnectionAborted } from 'src/utils';
|
||||
import { ImmichLogger } from 'src/utils/logger';
|
||||
import { isConnectionAborted } from 'src/utils/misc';
|
||||
|
||||
@Injectable()
|
||||
export class ErrorInterceptor implements NestInterceptor {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import multer, { StorageEngine, diskStorage } from 'multer';
|
|||
import { createHash, randomUUID } from 'node:crypto';
|
||||
import { Observable } from 'rxjs';
|
||||
import { UploadFieldName } from 'src/dtos/asset.dto';
|
||||
import { ImmichLogger } from 'src/infra/logger';
|
||||
import { AuthRequest } from 'src/middleware/auth.guard';
|
||||
import { AssetService, UploadFile } from 'src/services/asset.service';
|
||||
import { ImmichLogger } from 'src/utils/logger';
|
||||
|
||||
export enum Route {
|
||||
ASSET = 'asset',
|
||||
|
|
|
|||
19
server/src/middleware/websocket.adapter.ts
Normal file
19
server/src/middleware/websocket.adapter.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { INestApplicationContext } from '@nestjs/common';
|
||||
import { IoAdapter } from '@nestjs/platform-socket.io';
|
||||
import { createAdapter } from '@socket.io/postgres-adapter';
|
||||
import { ServerOptions } from 'socket.io';
|
||||
import { DataSource } from 'typeorm';
|
||||
import { PostgresDriver } from 'typeorm/driver/postgres/PostgresDriver.js';
|
||||
|
||||
export class WebSocketAdapter extends IoAdapter {
|
||||
constructor(private app: INestApplicationContext) {
|
||||
super(app);
|
||||
}
|
||||
|
||||
createIOServer(port: number, options?: ServerOptions): any {
|
||||
const server = super.createIOServer(port, options);
|
||||
const pool = (this.app.get(DataSource).driver as PostgresDriver).master;
|
||||
server.adapter(createAdapter(pool));
|
||||
return server;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue