c0a6b3d5a3
* refactor(server): system config * fix: jest circular import * chore: ignore migrations in coverage report * chore: tests * chore: tests * chore: todo note * chore: remove vite config backup * chore: fix redis hostname
44 lines
835 B
TypeScript
44 lines
835 B
TypeScript
import { IsBoolean, IsNotEmpty, IsString, IsUrl, ValidateIf } from 'class-validator';
|
|
|
|
const isEnabled = (config: SystemConfigOAuthDto) => config.enabled;
|
|
const isOverrideEnabled = (config: SystemConfigOAuthDto) => config.mobileOverrideEnabled;
|
|
|
|
export class SystemConfigOAuthDto {
|
|
@IsBoolean()
|
|
enabled!: boolean;
|
|
|
|
@ValidateIf(isEnabled)
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
issuerUrl!: string;
|
|
|
|
@ValidateIf(isEnabled)
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
clientId!: string;
|
|
|
|
@ValidateIf(isEnabled)
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
clientSecret!: string;
|
|
|
|
@IsString()
|
|
scope!: string;
|
|
|
|
@IsString()
|
|
buttonText!: string;
|
|
|
|
@IsBoolean()
|
|
autoRegister!: boolean;
|
|
|
|
@IsBoolean()
|
|
autoLaunch!: boolean;
|
|
|
|
@IsBoolean()
|
|
mobileOverrideEnabled!: boolean;
|
|
|
|
@ValidateIf(isOverrideEnabled)
|
|
@IsUrl()
|
|
mobileRedirectUri!: string;
|
|
}
|