Files
dmenu-api/src/modules/restaurants/dto/create-restaurant.dto.ts
T
2025-12-26 22:34:40 +03:30

39 lines
1.2 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsString, IsOptional, IsNumber, IsDate } from 'class-validator';
import { Type } from 'class-transformer';
export class CreateRestaurantDto {
@ApiProperty({ example: 'کافه ژیوان', description: 'نام رستوران' })
@IsString()
name!: string;
@ApiProperty({ example: 'zhivan', description: 'شناسه (slug) رستوران، لاتین و بدون فاصله' })
@IsString()
slug!: string;
@ApiPropertyOptional({ example: 2020, description: 'سال تأسیس' })
@IsOptional()
@IsNumber()
establishedYear: number;
@ApiPropertyOptional({ example: '09123456789', description: 'شماره تلفن' })
@IsOptional()
@IsString()
phone: string;
@ApiProperty({ example: 'sub_1234567890', description: 'شناسه اشتراک' })
@IsString()
subscriptionId!: string;
@ApiProperty({ example: '2025-12-26', description: 'تاریخ انقضای اشتراک' })
@Type(() => Date)
@IsDate()
subscriptionEndDate!: Date;
@ApiProperty({ example: '2025-12-26', description: 'تاریخ شروع اشتراک' })
@Type(() => Date)
@IsDate()
subscriptionStartDate!: Date;
}