chore: add permission metadata to open-api document (#20373)

This commit is contained in:
Jason Rasmussen 2025-07-28 18:40:34 -04:00 committed by GitHub
parent 34974b036c
commit 7d759edfcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 339 additions and 168 deletions

File diff suppressed because it is too large Load Diff

View File

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