mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
chore: add permission metadata to open-api document (#20373)
This commit is contained in:
parent
34974b036c
commit
7d759edfcc
2 changed files with 339 additions and 168 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -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 }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue