feat: add simple login logic

This commit is contained in:
2026-02-18 09:13:23 +03:30
parent b9779f7cb6
commit e657264807
16 changed files with 259 additions and 13 deletions
+41
View File
@@ -0,0 +1,41 @@
import Utils from '@/common/utils';
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsNotEmpty, IsOptional, IsString, Matches } from 'class-validator';
import { i18nValidationMessage as t } from 'nestjs-i18n';
export class LoginDTO {
@ApiProperty({
type: 'string',
description: `User's Phone Number`,
example: '09121111111',
required: true,
})
@IsString()
@IsNotEmpty({
message: t('validation.requiredField', {
field: '$t(auth.fields.phone)',
}),
})
@Matches(/^(?:09|9)[0-9]{9}$/, {
message: t('validation.wrongField', {
field: '$t(auth.fields.phone)',
}),
})
@Transform(({ value }) => Utils.StringUtils.normalizePhone(value as string))
phone: string;
@ApiProperty({
type: 'string',
description: 'Password for User Account',
example: 'Password1@',
required: false,
})
@IsOptional()
@IsString({
message: t('validation.wrongFieldFormat', {
field: '$t(auth.fields.password)',
}),
})
password?: string;
}