-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(api): Add swagger docs of API key controller (#167)
- Loading branch information
Showing
5 changed files
with
172 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
import { ApiProperty } from '@nestjs/swagger' | ||
import { ApiKey, Authority } from '@prisma/client' | ||
import { IsArray, IsOptional, IsString } from 'class-validator' | ||
|
||
export class CreateApiKey { | ||
@IsString() | ||
@ApiProperty({ | ||
name: 'name', | ||
description: 'Name of the API key', | ||
required: true, | ||
type: String, | ||
example: 'My API Key' | ||
}) | ||
name: ApiKey['name'] | ||
|
||
@IsString() | ||
@IsOptional() | ||
@ApiProperty({ | ||
name: 'expiresAfter', | ||
description: 'API key expiration time in hours', | ||
required: false, | ||
type: String, | ||
example: '24', | ||
default: 'never' | ||
}) | ||
expiresAfter?: '24' | '168' | '720' | '8760' | 'never' = 'never' | ||
|
||
@IsArray() | ||
@IsOptional() | ||
@ApiProperty({ | ||
name: 'authorities', | ||
description: 'API key authorities', | ||
required: false, | ||
type: [String], | ||
example: ['READ_SELF', 'UPDATE_SELF'], | ||
default: [] | ||
}) | ||
authorities?: Authority[] = [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.