74 lines
1.2 KiB
TypeScript
74 lines
1.2 KiB
TypeScript
import { IsOptional, IsString, IsInt, IsNumber, IsISO8601, Matches, Min } from 'class-validator';
|
|
|
|
export class CreateRentalDto {
|
|
@IsInt()
|
|
classroomId: number;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
lessorOrganizationId?: number;
|
|
|
|
@IsInt()
|
|
lesseeOrganizationId: number;
|
|
|
|
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
|
@IsISO8601({ strict: true })
|
|
startDate: string;
|
|
|
|
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
|
@IsISO8601({ strict: true })
|
|
endDate: string;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
dailyRate?: number;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
totalAmount?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
notes?: string;
|
|
}
|
|
|
|
export class UpdateRentalDto {
|
|
@IsOptional()
|
|
@IsInt()
|
|
classroomId?: number;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
lessorOrganizationId?: number;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
lesseeOrganizationId?: number;
|
|
|
|
@IsOptional()
|
|
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
|
@IsISO8601({ strict: true })
|
|
startDate?: string;
|
|
|
|
@IsOptional()
|
|
@Matches(/^\d{4}-\d{2}-\d{2}$/)
|
|
@IsISO8601({ strict: true })
|
|
endDate?: string;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
dailyRate?: number;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
totalAmount?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
notes?: string;
|
|
}
|