34 lines
553 B
TypeScript
34 lines
553 B
TypeScript
import { IsString, IsOptional, IsInt, Min } from 'class-validator';
|
|
|
|
export class CreateTokenDto {
|
|
@IsString()
|
|
label!: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
scope?: string;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
expiresInDays?: number;
|
|
}
|
|
|
|
export interface TokenDto {
|
|
id: string;
|
|
label: string;
|
|
scope: string;
|
|
expiresAt: string | null;
|
|
lastUsedAt: string | null;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface TokenCreatedDto extends TokenDto {
|
|
plaintext: string;
|
|
}
|
|
|
|
export interface TokenListDto {
|
|
tokens: TokenDto[];
|
|
total: number;
|
|
}
|