|
|
|
@ -7,7 +7,7 @@ import {
|
|
|
|
createParamDecorator,
|
|
|
|
createParamDecorator,
|
|
|
|
} from '@nestjs/common';
|
|
|
|
} from '@nestjs/common';
|
|
|
|
import { Reflector } from '@nestjs/core';
|
|
|
|
import { Reflector } from '@nestjs/core';
|
|
|
|
import { ApiBearerAuth, ApiCookieAuth, ApiOkResponse, ApiQuery, ApiSecurity } from '@nestjs/swagger';
|
|
|
|
import { ApiBearerAuth, ApiCookieAuth, ApiExtension, ApiOkResponse, ApiQuery, ApiSecurity } from '@nestjs/swagger';
|
|
|
|
import { Request } from 'express';
|
|
|
|
import { Request } from 'express';
|
|
|
|
import { AuthDto } from 'src/dtos/auth.dto';
|
|
|
|
import { AuthDto } from 'src/dtos/auth.dto';
|
|
|
|
import { ImmichQuery, MetadataKey, Permission } from 'src/enum';
|
|
|
|
import { ImmichQuery, MetadataKey, Permission } from 'src/enum';
|
|
|
|
@ -27,6 +27,10 @@ export const Authenticated = (options?: AuthenticatedOptions): MethodDecorator =
|
|
|
|
SetMetadata(MetadataKey.AuthRoute, options || {}),
|
|
|
|
SetMetadata(MetadataKey.AuthRoute, options || {}),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (options?.permission) {
|
|
|
|
|
|
|
|
decorators.push(ApiExtension('x-immich-permission', options.permission));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((options as SharedLinkRoute)?.sharedLink) {
|
|
|
|
if ((options as SharedLinkRoute)?.sharedLink) {
|
|
|
|
decorators.push(
|
|
|
|
decorators.push(
|
|
|
|
ApiQuery({ name: ImmichQuery.SharedLinkKey, type: String, required: false }),
|
|
|
|
ApiQuery({ name: ImmichQuery.SharedLinkKey, type: String, required: false }),
|
|
|
|
|