mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
chore: add permission metadata to open-api document (#20373)
This commit is contained in:
parent
34974b036c
commit
7d759edfcc
File diff suppressed because it is too large
Load Diff
@ -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 }),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user