111 lines
2.2 KiB
TypeScript
111 lines
2.2 KiB
TypeScript
import { IsString, IsNumber, IsDate, IsNotEmpty, IsEmail, IsOptional } from 'class-validator';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
|
|
export class TicketDTO {
|
|
|
|
@ApiProperty({ type: Number })
|
|
@IsNumber()
|
|
@IsNotEmpty()
|
|
eventId: number;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
ticketType: string;
|
|
|
|
@ApiProperty({ type: Number })
|
|
@IsNumber()
|
|
@IsNotEmpty()
|
|
price: number;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
seatNumber: string;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
qrCode: string;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsEmail()
|
|
@IsNotEmpty()
|
|
buyerEmail: string;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@IsNotEmpty()
|
|
@Transform(({ value }) => new Date(value))
|
|
bookingDate: Date;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
paymentStatus: string;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@Transform(({ value }) => new Date(value))
|
|
rescheduledAt: Date;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@Transform(({ value }) => new Date(value))
|
|
scanned: Date;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
status: string;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@IsNotEmpty()
|
|
@Transform(({ value }) => new Date(value))
|
|
validFrom: Date;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@IsNotEmpty()
|
|
@Transform(({ value }) => new Date(value))
|
|
validTill: Date;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@Transform(({ value }) => new Date(value))
|
|
createdAt: Date;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsDate()
|
|
@Transform(({ value }) => new Date(value))
|
|
updatedAt: Date;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
createdBy: string;
|
|
|
|
@ApiProperty({ type: String })
|
|
@IsString()
|
|
modifiedBy: string;
|
|
|
|
@ApiProperty({ type: Date })
|
|
@IsOptional()
|
|
@IsDate()
|
|
@Transform(({ value }) => value ? new Date(value) : null)
|
|
deletedAt: Date;
|
|
|
|
@ApiProperty({ type: Number })
|
|
@IsNumber()
|
|
@IsNotEmpty()
|
|
version: number;
|
|
}
|
|
|
|
export class TicketUpdateDTO extends TicketDTO {
|
|
@ApiProperty({ type: Number })
|
|
@IsNumber()
|
|
@IsNotEmpty()
|
|
id: number
|
|
}
|