mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
refactor(server): guards, decorators, and utils (#3060)
This commit is contained in:
@@ -15,12 +15,29 @@ import {
|
||||
} from '@nestjs/swagger';
|
||||
import { writeFileSync } from 'fs';
|
||||
import path from 'path';
|
||||
import { Metadata } from './decorators/authenticated.decorator';
|
||||
|
||||
import { applyDecorators, UsePipes, ValidationPipe } from '@nestjs/common';
|
||||
import { Metadata } from './app.guard';
|
||||
|
||||
export function UseValidation() {
|
||||
return applyDecorators(
|
||||
UsePipes(
|
||||
new ValidationPipe({
|
||||
transform: true,
|
||||
whitelist: true,
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export const asStreamableFile = ({ stream, type, length }: ImmichReadStream) => {
|
||||
return new StreamableFile(stream, { type, length });
|
||||
};
|
||||
|
||||
export function patchFormData(latin1: string) {
|
||||
return Buffer.from(latin1, 'latin1').toString('utf8');
|
||||
}
|
||||
|
||||
function sortKeys<T extends object>(obj: T): T {
|
||||
if (!obj) {
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user