mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-10 07:29:08 +00:00
157 lines
2.9 KiB
TypeScript
157 lines
2.9 KiB
TypeScript
import { Link } from '@dadosfera/protospack-v2/dist/lib/Duc/interfaces/entities';
|
|
import {
|
|
AuthSignInRequest,
|
|
AuthSignInResponse,
|
|
} from '@dadosfera/protospack-v2/dist/lib/Duc/interfaces/messages';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
export class LoginDto {
|
|
@ApiProperty()
|
|
username: string;
|
|
|
|
@ApiProperty()
|
|
password: string;
|
|
|
|
@ApiProperty({ required: false })
|
|
totp: string;
|
|
}
|
|
export class AuthTokens {
|
|
@ApiProperty()
|
|
accessToken: string;
|
|
@ApiProperty()
|
|
refreshToken: string;
|
|
@ApiPropertyOptional()
|
|
termsOfUseToken: string;
|
|
@ApiProperty({ deprecated: true })
|
|
idToken: string;
|
|
}
|
|
export enum MfaStatuses {
|
|
PENDING = 'pending',
|
|
NONE = 'none',
|
|
TOTP = 'totp',
|
|
}
|
|
|
|
export enum TouStatuses {
|
|
PENDING = 'pending',
|
|
REQUIRED = 'required',
|
|
OK = 'ok',
|
|
}
|
|
export class TermsOfUse {
|
|
@ApiProperty()
|
|
version: number;
|
|
@ApiProperty()
|
|
publicUrl: string;
|
|
@ApiProperty()
|
|
enforceDate: string;
|
|
@ApiProperty()
|
|
createdAt: string;
|
|
}
|
|
export class TermsOfUseStatus {
|
|
@ApiProperty({ enum: TouStatuses })
|
|
status: string;
|
|
@ApiPropertyOptional()
|
|
lastSigned?: TermsOfUse;
|
|
@ApiPropertyOptional()
|
|
next?: TermsOfUse;
|
|
}
|
|
export class AuthUser {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
username: string;
|
|
@ApiProperty()
|
|
createdAt: string;
|
|
}
|
|
export class AuthCustomer {
|
|
@ApiProperty()
|
|
modules: string[];
|
|
|
|
@ApiProperty()
|
|
id: string;
|
|
|
|
@ApiProperty()
|
|
name: string;
|
|
|
|
@ApiProperty()
|
|
displayName: string;
|
|
@ApiProperty()
|
|
tier: string;
|
|
|
|
@ApiProperty()
|
|
scheduleLimit: string;
|
|
|
|
@ApiProperty()
|
|
links: Link[];
|
|
|
|
@ApiProperty()
|
|
themeEnabled: boolean;
|
|
@ApiProperty()
|
|
enforceMfa: boolean;
|
|
}
|
|
|
|
export class AuthSignInReq implements AuthSignInRequest {
|
|
@ApiProperty()
|
|
username: string;
|
|
@ApiProperty()
|
|
password: string;
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'TOTP code used to login when Multi-Factor Authentication is enabled',
|
|
})
|
|
totp: string;
|
|
}
|
|
|
|
export class AuthSignInRes implements AuthSignInResponse {
|
|
@ApiProperty()
|
|
permissions: string[];
|
|
@ApiProperty({ enum: MfaStatuses })
|
|
mfaStatus: string;
|
|
@ApiPropertyOptional()
|
|
customer?: AuthCustomer;
|
|
@ApiPropertyOptional()
|
|
user?: AuthUser;
|
|
@ApiPropertyOptional()
|
|
tokens?: AuthTokens;
|
|
@ApiPropertyOptional()
|
|
termsOfUse?: TermsOfUseStatus;
|
|
}
|
|
|
|
export class AuthRefreshAccessTokenReq {
|
|
@ApiProperty()
|
|
refreshToken: string;
|
|
@ApiProperty()
|
|
userId: string;
|
|
}
|
|
export class AuthRefreshAccessTokenRes {
|
|
@ApiProperty()
|
|
permissions: string[];
|
|
@ApiProperty()
|
|
accessToken: string;
|
|
}
|
|
|
|
export interface BulkEditRequest {
|
|
users: string[];
|
|
}
|
|
|
|
export interface BulkEditResponse {
|
|
message: string;
|
|
successfulUsers: string[];
|
|
failedUsers: string[];
|
|
}
|
|
|
|
export type UserDTO = {
|
|
id: string,
|
|
name: string,
|
|
email: string,
|
|
jobTitle?: string,
|
|
department?: string,
|
|
hierarchy?: string,
|
|
customer: {
|
|
id: string,
|
|
name: string,
|
|
tier: string,
|
|
}
|
|
}
|