15 lines
490 B
TypeScript
15 lines
490 B
TypeScript
|
|
import { ApiProperty } from '@nestjs/swagger';
|
||
|
|
import { IsIn, IsString } from 'class-validator';
|
||
|
|
|
||
|
|
export const SUPPORTED_USER_LANGUAGES = ['en', 'fa', 'nl'] as const;
|
||
|
|
export type SupportedUserLanguage = (typeof SUPPORTED_USER_LANGUAGES)[number];
|
||
|
|
|
||
|
|
export class UpdateLanguageDto {
|
||
|
|
@ApiProperty({ enum: SUPPORTED_USER_LANGUAGES, example: 'en' })
|
||
|
|
@IsString()
|
||
|
|
@IsIn(SUPPORTED_USER_LANGUAGES, {
|
||
|
|
message: 'Language must be one of: en, fa, nl',
|
||
|
|
})
|
||
|
|
language: SupportedUserLanguage;
|
||
|
|
}
|