Spaces:
Runtime error
Runtime error
File size: 1,515 Bytes
97dab2a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import { IsString, IsOptional, MaxLength, IsPhoneNumber } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { Transform } from 'class-transformer';
export class BaseDto {
@ApiProperty({
description: 'Timestamp when the customer was created',
example: '1992-08-14',
required: false,
})
// @Transform(({ value }) => {
// if (!(value instanceof Date)) return value;
// const pad = (n: number) => n.toString().padStart(2, '0');
// const yyyy = value.getFullYear();
// const mm = pad(value.getMonth() + 1);
// const dd = pad(value.getDate());
// const hh = pad(value.getHours());
// const min = pad(value.getMinutes());
// const ss = pad(value.getSeconds());
// return `${yyyy}-${mm}-${dd} ${hh}:${min}:${ss}`;
// }, { toPlainOnly: true })
@IsOptional()
createdAt: Date;
@ApiProperty({
description: 'Timestamp when the customer was created',
example: '1992-08-14',
required: false,
})
// @Transform(({ value }) => {
// if (!(value instanceof Date)) return value;
// const pad = (n: number) => n.toString().padStart(2, '0');
// const yyyy = value.getFullYear();
// const mm = pad(value.getMonth() + 1);
// const dd = pad(value.getDate());
// const hh = pad(value.getHours());
// const min = pad(value.getMinutes());
// const ss = pad(value.getSeconds());
// return `${yyyy}-${mm}-${dd} ${hh}:${min}:${ss}`;
// }, { toPlainOnly: true })
@IsOptional()
updatedAt: Date;
}
|