Files
dyolink/backend/src/modules/auth/dto/update-language.dto.ts

15 lines
490 B
TypeScript
Raw Normal View History

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;
}