parent
34af85c04e
commit
02fe538af4
@ -0,0 +1,15 @@
|
||||
import { IsBoolean, IsOptional } from "class-validator";
|
||||
|
||||
export class UserSelectDto {
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
public uuid?: boolean | null;
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
public isBlocked?: boolean | null;
|
||||
|
||||
constructor(uuid: boolean, isBlocked: boolean) {
|
||||
this.uuid = uuid;
|
||||
this.isBlocked = isBlocked;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import { IsHexadecimal, Length } from "class-validator";
|
||||
|
||||
export class FingerprintDto {
|
||||
@IsHexadecimal()
|
||||
@Length(64, 64)
|
||||
public fingerprint: string;
|
||||
|
||||
constructor(fingerprint: string) {
|
||||
this.fingerprint = fingerprint;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
import { IsHexadecimal, IsString, IsUUID, Length } from "class-validator";
|
||||
|
||||
export class RegisterDto {
|
||||
@IsHexadecimal()
|
||||
@Length(64, 64)
|
||||
public fingerprint: string;
|
||||
@IsString()
|
||||
@Length(0, 100)
|
||||
public name: string;
|
||||
@IsUUID(4)
|
||||
public userUuid: string;
|
||||
|
||||
constructor(fingerprint: string, name: string, userUuid: string) {
|
||||
this.fingerprint = fingerprint;
|
||||
this.name = name;
|
||||
this.userUuid = userUuid;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
import { IsHexadecimal, IsOptional, Length, ValidateNested } from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
import { UserSelectDto } from "./elements/user-select.dto";
|
||||
|
||||
export class UserDto {
|
||||
@IsHexadecimal()
|
||||
@Length(64, 64)
|
||||
public fingerprint: string;
|
||||
@IsOptional()
|
||||
@ValidateNested({ each: false })
|
||||
@Type(() => UserSelectDto)
|
||||
public select?: UserSelectDto | null;
|
||||
|
||||
constructor(fingerprint: string, select?: UserSelectDto | null) {
|
||||
this.fingerprint = fingerprint;
|
||||
this.select = select;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import { IsHexadecimal, IsOptional, IsString, IsUUID, Length } from "class-validator";
|
||||
|
||||
export class GenerateRefreshDto {
|
||||
@IsUUID(4)
|
||||
public user_uuid: string;
|
||||
@IsHexadecimal()
|
||||
@Length(64, 64)
|
||||
public device_fingerprint: string;
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@Length(0, 100)
|
||||
public device_name?: string | null;
|
||||
|
||||
constructor(user_uuid: string, device_fingerprint: string, device_name?: string) {
|
||||
this.user_uuid = user_uuid;
|
||||
this.device_fingerprint = device_fingerprint;
|
||||
this.device_name = device_name;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { IsString } from "class-validator";
|
||||
|
||||
export class RefreshTokenDto {
|
||||
@IsString()
|
||||
public refresh_token: string;
|
||||
|
||||
constructor(refresh_token: string) {
|
||||
this.refresh_token = refresh_token;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
import { IsOptional, IsUUID, ValidateNested } from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { DeviceSelectDto } from "./elements/device-select.dto";
|
||||
|
||||
export class DevicesDto {
|
||||
@IsUUID(4)
|
||||
public uuid: string;
|
||||
@IsOptional()
|
||||
@ValidateNested({ each: false })
|
||||
@Type(() => DeviceSelectDto)
|
||||
public select?: DeviceSelectDto | null;
|
||||
|
||||
constructor(uuid: string, select: DeviceSelectDto) {
|
||||
this.uuid = uuid;
|
||||
this.select = select;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import { IsBoolean, IsOptional } from "class-validator";
|
||||
|
||||
export class DeviceSelectDto {
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
public name?: boolean | null;
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
public fingerprint?: boolean | null;
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
public isBlocked?: boolean | null;
|
||||
|
||||
constructor(name: boolean, fingerprint: boolean, isBlocked: boolean) {
|
||||
this.name = name;
|
||||
this.fingerprint = fingerprint;
|
||||
this.isBlocked = isBlocked;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { IsUUID } from "class-validator";
|
||||
|
||||
export class UuidDto {
|
||||
@IsUUID(4)
|
||||
public uuid: string;
|
||||
|
||||
constructor(uuid: string) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue