-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathupdate-proposal.dto.ts
132 lines (119 loc) · 2.98 KB
/
update-proposal.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import { ApiProperty, ApiTags, PartialType } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsArray,
IsDateString,
IsEmail,
IsObject,
IsOptional,
IsString,
Validate,
ValidateNested,
} from "class-validator";
import { OwnableDto } from "../../common/dto/ownable.dto";
import { CreateMeasurementPeriodDto } from "./create-measurement-period.dto";
import { UniqueMeasurementPeriodIdConstraint } from "./validators/unique-measurement-period-id";
@ApiTags("proposals")
export class UpdateProposalDto extends OwnableDto {
@ApiProperty({
type: String,
required: false,
description: "Email of principal investigator.",
})
@IsOptional()
@IsEmail()
readonly pi_email?: string;
@ApiProperty({
type: String,
required: false,
description: "First name of principal investigator.",
})
@IsOptional()
@IsString()
readonly pi_firstname?: string;
@ApiProperty({
type: String,
required: false,
description: "Last name of principal investigator.",
})
@IsOptional()
@IsString()
readonly pi_lastname?: string;
@ApiProperty({
type: String,
required: true,
description: "Email of main proposer.",
})
@IsEmail()
readonly email: string;
@ApiProperty({
type: String,
required: false,
description: "First name of main proposer.",
})
@IsOptional()
@IsString()
readonly firstname?: string;
@ApiProperty({
type: String,
required: false,
description: "Last name of main proposer.",
})
@IsOptional()
@IsString()
readonly lastname?: string;
@ApiProperty({
type: String,
required: true,
description: "The title of the proposal.",
})
@IsString()
readonly title: string;
@ApiProperty({
type: String,
required: false,
description: "The proposal abstract.",
})
@IsOptional()
@IsString()
readonly abstract?: string;
@ApiProperty({
type: Date,
required: false,
description: "The date when the data collection starts.",
})
@IsOptional()
@IsDateString()
readonly startTime?: Date;
@ApiProperty({
type: Date,
required: false,
description: "The date when data collection finishes.",
})
@IsOptional()
@IsDateString()
readonly endTime?: Date;
@ApiProperty({
type: CreateMeasurementPeriodDto,
isArray: true,
required: false,
description:
"Embedded information used inside proposals to define which type of experiment has to be pursued, where (at which instrument) and when.",
})
@IsArray()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => CreateMeasurementPeriodDto)
@Validate(UniqueMeasurementPeriodIdConstraint)
readonly MeasurementPeriodList?: CreateMeasurementPeriodDto[];
@ApiProperty({
type: Object,
required: false,
default: {},
description: "JSON object containing the proposal metadata.",
})
@IsOptional()
@IsObject()
readonly metadata?: Record<string, unknown>;
}
export class PartialUpdateProposalDto extends PartialType(UpdateProposalDto) {}