-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-certificate.dto.ts
69 lines (57 loc) · 1.65 KB
/
create-certificate.dto.ts
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { CertificateDto } from './certificate.dto';
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
import {
IsInt,
IsISO8601,
IsNumberString,
IsOptional,
IsString,
IsUUID,
} from 'class-validator';
import { IsDatetimePrismaCompatible } from '../../validators'
export class CreateCertificateDto extends OmitType(CertificateDto, ['txHash']) {
@ApiPropertyOptional({ example: '973d48bb-15da-4eaf-8040-b6cb66e22023' })
@IsUUID()
@IsOptional()
id: string;
@ApiPropertyOptional({ example: 'Solar 1 - Non Bua Lampon' })
@IsOptional()
@IsString()
generatorName: string;
@ApiPropertyOptional({ example: 'NA' })
@IsOptional()
@IsString()
generatorId: string;
@ApiProperty({ example: '00000000-0000-0000-0000-000000000000' })
@IsUUID()
initialSellerId: string;
@ApiPropertyOptional({ example: 'NE' })
@IsString()
@IsOptional()
region: string;
@ApiProperty({ example: 'China' })
@IsString()
country: string;
@ApiProperty({ example: 'Wind' })
@IsString()
energySource: string;
@ApiProperty({ example: new Date('2020-11-01T00:00:00.000Z') })
@IsISO8601({ strict: true })
@IsDatetimePrismaCompatible()
generationStart: string;
@ApiPropertyOptional({ example: 180 })
@IsInt()
@IsOptional()
generationStartTimezoneOffset: number;
@ApiProperty({ example: new Date('2021-06-01T23:59:59.999Z') })
@IsISO8601({ strict: true })
@IsDatetimePrismaCompatible()
generationEnd: string;
@ApiPropertyOptional({ example: 180 })
@IsInt()
@IsOptional()
generationEndTimezoneOffset: number;
@ApiProperty({ type: 'string', example: '10000' })
@IsNumberString()
energy: string
}