@alba-cars/common-modules 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/network/endpoint-config.d.ts +1 -0
- package/dist/core/network/endpoint-config.js +1 -0
- package/dist/features/google-review/data/dto/google_review_dto.d.ts +28 -0
- package/dist/features/google-review/data/dto/google_review_dto.js +124 -22
- package/dist/features/models/Vehicle.d.ts +3 -3
- package/dist/features/test-drive-request/data/dto/TestDriveRequestDTO.d.ts +1 -1
- package/dist/features/test-drive-request/data/dto/TestDriveRequestDTO.js +2 -2
- package/dist/features/vehicle/data/dto/VehicleDTO.d.ts +9 -4
- package/dist/features/vehicle/data/dto/VehicleDTO.js +56 -27
- package/dist/features/vehicle/data/dto/VehicleModelDTO.d.ts +1 -1
- package/dist/features/vehicle/data/dto/VehicleModelDTO.js +2 -2
- package/dist/features/vehicle/data/dto/VehicleTypeDTO.d.ts +1 -1
- package/dist/features/vehicle/data/dto/VehicleTypeDTO.js +2 -2
- package/dist/features/vehicle/data/dto/VehicleWarrantyDTO.d.ts +9 -0
- package/dist/features/vehicle/data/dto/VehicleWarrantyDTO.js +47 -0
- package/dist/features/vehicle/data/dto/index.d.ts +1 -0
- package/dist/features/vehicle/data/dto/index.js +1 -0
- package/dist/features/vehicle/data/enums/index.d.ts +24 -12
- package/dist/features/vehicle/data/enums/index.js +37 -24
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ interface VehicleEndpoints extends BaseEndpoint {
|
|
|
10
10
|
getSimilar: EndpointFunction;
|
|
11
11
|
getOneBySlug: EndpointFunction;
|
|
12
12
|
publishVehicle: EndpointFunction;
|
|
13
|
+
unpublishVehicle: EndpointFunction;
|
|
13
14
|
reserveVehicle: EndpointFunction;
|
|
14
15
|
selfReserveVehicle: EndpointFunction;
|
|
15
16
|
markVehicleSold: EndpointFunction;
|
|
@@ -11,6 +11,7 @@ exports.API_ENDPOINTS = {
|
|
|
11
11
|
deleteOne: (id) => `/vehicle/${id}`,
|
|
12
12
|
updateOne: (id) => `/vehicle/${id}`,
|
|
13
13
|
publishVehicle: (id) => `/vehicle/publish/${id}`,
|
|
14
|
+
unpublishVehicle: (id) => `/vehicle/unpublish/${id}`,
|
|
14
15
|
reserveVehicle: (id) => `/vehicle/reserve/${id}`,
|
|
15
16
|
selfReserveVehicle: (id) => `/vehicle/self-reserve/${id}`,
|
|
16
17
|
markVehicleSold: (id) => `/vehicle/mark-vehicle-sold/${id}`,
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { ReviewPlatform } from '../enums';
|
|
2
|
+
export declare class ReviewDTO {
|
|
3
|
+
id: string;
|
|
4
|
+
username: string;
|
|
5
|
+
platform: ReviewPlatform;
|
|
6
|
+
comment: string;
|
|
7
|
+
minRating: number;
|
|
8
|
+
showPublic: boolean;
|
|
9
|
+
placeId?: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt?: Date;
|
|
12
|
+
authorUrl?: string;
|
|
13
|
+
profilePhotoUrl?: string;
|
|
14
|
+
}
|
|
2
15
|
export declare class GoogleReviewDTO {
|
|
3
16
|
authorName: string;
|
|
4
17
|
authorUrl?: string;
|
|
@@ -26,16 +39,31 @@ export declare class GoogleReviewResponseDTO {
|
|
|
26
39
|
data: GoogleReviewDTO[];
|
|
27
40
|
}
|
|
28
41
|
export declare class ReviewGetDTO {
|
|
42
|
+
id: string;
|
|
43
|
+
filters?: ReviewFilter;
|
|
44
|
+
options?: ReviewOptions;
|
|
45
|
+
validate(): string[];
|
|
46
|
+
static fromPlain(plain: Record<string, unknown>): ReviewGetDTO;
|
|
47
|
+
static toPlain(entity: any): Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export declare class ReviewFilter {
|
|
29
50
|
id?: string;
|
|
30
51
|
placeId?: string;
|
|
31
52
|
platform?: ReviewPlatform;
|
|
32
53
|
comment?: string;
|
|
33
54
|
username?: string;
|
|
34
55
|
showPublic?: boolean;
|
|
56
|
+
search?: string;
|
|
35
57
|
minRating?: number;
|
|
36
58
|
maxRating?: number;
|
|
59
|
+
}
|
|
60
|
+
export declare class ReviewOptions {
|
|
37
61
|
skip?: number;
|
|
38
62
|
take?: number;
|
|
63
|
+
orderBy?: string;
|
|
64
|
+
orderDirection?: 'ASC' | 'DESC';
|
|
65
|
+
page?: number;
|
|
66
|
+
limit?: number;
|
|
39
67
|
}
|
|
40
68
|
export declare class UpdateReviewShowPublicDTO {
|
|
41
69
|
id: string;
|
|
@@ -9,10 +9,68 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UpdateReviewShowPublicDTO = exports.ReviewGetDTO = exports.GoogleReviewResponseDTO = exports.SaveGoogleReviewDTO = exports.FetchGoogleReviewsDTO = exports.GoogleReviewDTO = void 0;
|
|
12
|
+
exports.UpdateReviewShowPublicDTO = exports.ReviewOptions = exports.ReviewFilter = exports.ReviewGetDTO = exports.GoogleReviewResponseDTO = exports.SaveGoogleReviewDTO = exports.FetchGoogleReviewsDTO = exports.GoogleReviewDTO = exports.ReviewDTO = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
14
|
const class_transformer_1 = require("class-transformer");
|
|
15
15
|
const enums_1 = require("../enums");
|
|
16
|
+
class ReviewDTO {
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], ReviewDTO.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.Length)(1, 100),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], ReviewDTO.prototype, "username", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsEnum)(enums_1.ReviewPlatform),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], ReviewDTO.prototype, "platform", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.Length)(1, 1000),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], ReviewDTO.prototype, "comment", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsNumber)(),
|
|
39
|
+
(0, class_validator_1.Min)(1),
|
|
40
|
+
(0, class_validator_1.Max)(5),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], ReviewDTO.prototype, "minRating", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsBoolean)(),
|
|
45
|
+
__metadata("design:type", Boolean)
|
|
46
|
+
], ReviewDTO.prototype, "showPublic", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, class_validator_1.IsString)(),
|
|
49
|
+
(0, class_validator_1.IsOptional)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], ReviewDTO.prototype, "placeId", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
54
|
+
(0, class_validator_1.IsDate)(),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], ReviewDTO.prototype, "createdAt", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
59
|
+
(0, class_validator_1.IsDate)(),
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
__metadata("design:type", Date)
|
|
62
|
+
], ReviewDTO.prototype, "updatedAt", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsString)(),
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], ReviewDTO.prototype, "authorUrl", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsString)(),
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], ReviewDTO.prototype, "profilePhotoUrl", void 0);
|
|
73
|
+
exports.ReviewDTO = ReviewDTO;
|
|
16
74
|
class GoogleReviewDTO {
|
|
17
75
|
}
|
|
18
76
|
__decorate([
|
|
@@ -107,75 +165,119 @@ class GoogleReviewResponseDTO {
|
|
|
107
165
|
}
|
|
108
166
|
exports.GoogleReviewResponseDTO = GoogleReviewResponseDTO;
|
|
109
167
|
class ReviewGetDTO {
|
|
168
|
+
validate() {
|
|
169
|
+
const errors = (0, class_validator_1.validateSync)(this);
|
|
170
|
+
return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
|
|
171
|
+
}
|
|
172
|
+
static fromPlain(plain) {
|
|
173
|
+
return (0, class_transformer_1.plainToClass)(ReviewGetDTO, plain);
|
|
174
|
+
}
|
|
175
|
+
static toPlain(entity) {
|
|
176
|
+
return (0, class_transformer_1.instanceToPlain)(entity);
|
|
177
|
+
}
|
|
110
178
|
}
|
|
111
179
|
__decorate([
|
|
112
180
|
(0, class_validator_1.IsString)(),
|
|
113
181
|
(0, class_validator_1.IsOptional)(),
|
|
114
182
|
__metadata("design:type", String)
|
|
115
183
|
], ReviewGetDTO.prototype, "id", void 0);
|
|
184
|
+
exports.ReviewGetDTO = ReviewGetDTO;
|
|
185
|
+
class ReviewFilter {
|
|
186
|
+
}
|
|
187
|
+
__decorate([
|
|
188
|
+
(0, class_validator_1.IsString)(),
|
|
189
|
+
(0, class_validator_1.IsOptional)(),
|
|
190
|
+
__metadata("design:type", String)
|
|
191
|
+
], ReviewFilter.prototype, "id", void 0);
|
|
116
192
|
__decorate([
|
|
117
193
|
(0, class_validator_1.IsString)(),
|
|
118
194
|
(0, class_validator_1.IsOptional)(),
|
|
119
195
|
__metadata("design:type", String)
|
|
120
|
-
],
|
|
196
|
+
], ReviewFilter.prototype, "placeId", void 0);
|
|
121
197
|
__decorate([
|
|
122
198
|
(0, class_validator_1.IsEnum)(enums_1.ReviewPlatform),
|
|
123
199
|
(0, class_validator_1.IsOptional)(),
|
|
124
200
|
__metadata("design:type", String)
|
|
125
|
-
],
|
|
201
|
+
], ReviewFilter.prototype, "platform", void 0);
|
|
126
202
|
__decorate([
|
|
127
203
|
(0, class_validator_1.IsString)(),
|
|
128
204
|
(0, class_validator_1.IsOptional)(),
|
|
129
205
|
__metadata("design:type", String)
|
|
130
|
-
],
|
|
206
|
+
], ReviewFilter.prototype, "comment", void 0);
|
|
131
207
|
__decorate([
|
|
132
208
|
(0, class_validator_1.IsString)(),
|
|
133
209
|
(0, class_validator_1.IsOptional)(),
|
|
134
210
|
__metadata("design:type", String)
|
|
135
|
-
],
|
|
211
|
+
], ReviewFilter.prototype, "username", void 0);
|
|
136
212
|
__decorate([
|
|
137
213
|
(0, class_validator_1.IsBoolean)(),
|
|
138
214
|
(0, class_validator_1.IsOptional)(),
|
|
139
|
-
(0, class_transformer_1.Transform)(({ value }) =>
|
|
140
|
-
if (value === 'true')
|
|
141
|
-
return true;
|
|
142
|
-
if (value === 'false')
|
|
143
|
-
return false;
|
|
144
|
-
return value;
|
|
145
|
-
}),
|
|
215
|
+
(0, class_transformer_1.Transform)(({ value }) => (value === 'true' ? true : value === 'false' ? false : value)),
|
|
146
216
|
__metadata("design:type", Boolean)
|
|
147
|
-
],
|
|
217
|
+
], ReviewFilter.prototype, "showPublic", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
(0, class_validator_1.IsString)(),
|
|
220
|
+
(0, class_validator_1.IsOptional)(),
|
|
221
|
+
__metadata("design:type", String)
|
|
222
|
+
], ReviewFilter.prototype, "search", void 0);
|
|
148
223
|
__decorate([
|
|
149
224
|
(0, class_validator_1.IsNumber)(),
|
|
150
225
|
(0, class_validator_1.IsOptional)(),
|
|
151
226
|
(0, class_validator_1.Min)(1),
|
|
152
227
|
(0, class_validator_1.Max)(5),
|
|
153
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
|
|
228
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : undefined)),
|
|
154
229
|
__metadata("design:type", Number)
|
|
155
|
-
],
|
|
230
|
+
], ReviewFilter.prototype, "minRating", void 0);
|
|
156
231
|
__decorate([
|
|
157
232
|
(0, class_validator_1.IsNumber)(),
|
|
158
233
|
(0, class_validator_1.IsOptional)(),
|
|
159
234
|
(0, class_validator_1.Min)(1),
|
|
160
235
|
(0, class_validator_1.Max)(5),
|
|
161
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
|
|
236
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : undefined)),
|
|
162
237
|
__metadata("design:type", Number)
|
|
163
|
-
],
|
|
238
|
+
], ReviewFilter.prototype, "maxRating", void 0);
|
|
239
|
+
exports.ReviewFilter = ReviewFilter;
|
|
240
|
+
class ReviewOptions {
|
|
241
|
+
}
|
|
164
242
|
__decorate([
|
|
165
243
|
(0, class_validator_1.IsNumber)(),
|
|
166
244
|
(0, class_validator_1.IsOptional)(),
|
|
167
245
|
(0, class_validator_1.Min)(0),
|
|
168
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
|
|
246
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : undefined)),
|
|
169
247
|
__metadata("design:type", Number)
|
|
170
|
-
],
|
|
248
|
+
], ReviewOptions.prototype, "skip", void 0);
|
|
171
249
|
__decorate([
|
|
172
250
|
(0, class_validator_1.IsNumber)(),
|
|
173
251
|
(0, class_validator_1.IsOptional)(),
|
|
174
252
|
(0, class_validator_1.Min)(1),
|
|
175
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
|
|
253
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : undefined)),
|
|
176
254
|
__metadata("design:type", Number)
|
|
177
|
-
],
|
|
178
|
-
|
|
255
|
+
], ReviewOptions.prototype, "take", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
(0, class_validator_1.IsString)(),
|
|
258
|
+
(0, class_validator_1.IsOptional)(),
|
|
259
|
+
__metadata("design:type", String)
|
|
260
|
+
], ReviewOptions.prototype, "orderBy", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
(0, class_validator_1.IsString)(),
|
|
263
|
+
(0, class_validator_1.IsOptional)(),
|
|
264
|
+
__metadata("design:type", String)
|
|
265
|
+
], ReviewOptions.prototype, "orderDirection", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
(0, class_validator_1.IsNumber)(),
|
|
268
|
+
(0, class_validator_1.IsOptional)(),
|
|
269
|
+
(0, class_validator_1.Min)(1),
|
|
270
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : undefined)),
|
|
271
|
+
__metadata("design:type", Number)
|
|
272
|
+
], ReviewOptions.prototype, "page", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
(0, class_validator_1.IsNumber)(),
|
|
275
|
+
(0, class_validator_1.IsOptional)(),
|
|
276
|
+
(0, class_validator_1.Min)(1),
|
|
277
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : undefined)),
|
|
278
|
+
__metadata("design:type", Number)
|
|
279
|
+
], ReviewOptions.prototype, "limit", void 0);
|
|
280
|
+
exports.ReviewOptions = ReviewOptions;
|
|
179
281
|
class UpdateReviewShowPublicDTO {
|
|
180
282
|
}
|
|
181
283
|
__decorate([
|
|
@@ -10,7 +10,7 @@ import { VehicleOrder } from "./VehicleOrder";
|
|
|
10
10
|
import { UserFavoriteVehicle } from "./UserFavoriteVehicle";
|
|
11
11
|
import { User } from "./User";
|
|
12
12
|
import { Deposit } from "./Deposit";
|
|
13
|
-
import {
|
|
13
|
+
import { VehicleWarrantyDTO } from "../vehicle/data/dto/VehicleWarrantyDTO";
|
|
14
14
|
export declare class Vehicle extends BaseModel {
|
|
15
15
|
referenceNumber?: string;
|
|
16
16
|
slug: string;
|
|
@@ -45,8 +45,8 @@ export declare class Vehicle extends BaseModel {
|
|
|
45
45
|
features?: VehicleFeature[];
|
|
46
46
|
metaData?: VehicleMetaData;
|
|
47
47
|
finance?: VehicleFinance;
|
|
48
|
-
serviceContract?:
|
|
49
|
-
warranty:
|
|
48
|
+
serviceContract?: VehicleWarrantyDTO;
|
|
49
|
+
warranty: VehicleWarrantyDTO;
|
|
50
50
|
orders?: VehicleOrder[];
|
|
51
51
|
draft?: VehicleDraft;
|
|
52
52
|
vehicleFavorites?: UserFavoriteVehicle[];
|
|
@@ -15,7 +15,7 @@ export declare class TestDriveRequestGetDTO {
|
|
|
15
15
|
options?: TestDriveRequestGetDTOOptions;
|
|
16
16
|
validate(): string[];
|
|
17
17
|
static fromPlain(plain: Record<string, unknown>): TestDriveRequestGetDTO;
|
|
18
|
-
toPlain(): Record<string,
|
|
18
|
+
static toPlain(entity: any): Record<string, unknown>;
|
|
19
19
|
}
|
|
20
20
|
export declare class TestDriveRequestCreateDTO {
|
|
21
21
|
vehicle: DynamicVehicleDTO;
|
|
@@ -27,8 +27,8 @@ class TestDriveRequestGetDTO {
|
|
|
27
27
|
static fromPlain(plain) {
|
|
28
28
|
return (0, class_transformer_1.plainToClass)(TestDriveRequestGetDTO, plain);
|
|
29
29
|
}
|
|
30
|
-
toPlain() {
|
|
31
|
-
return (0, class_transformer_1.instanceToPlain)(
|
|
30
|
+
static toPlain(entity) {
|
|
31
|
+
return (0, class_transformer_1.instanceToPlain)(entity);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
exports.TestDriveRequestGetDTO = TestDriveRequestGetDTO;
|
|
@@ -5,7 +5,7 @@ import { DynamicVehicleBodyTypeDTO } from "./VehicleTypeDTO";
|
|
|
5
5
|
import { VehicleMediaCreateDTO, VehicleMediaUpdateDTO } from "./VehicleMedia";
|
|
6
6
|
import { VehicleFilter, VehicleOptions, VehicleUniqueFilter } from "./VehicleFilterDTO";
|
|
7
7
|
import { VehicleFinanceCreateDTO } from "./VehicleFinanceDTO";
|
|
8
|
-
import {
|
|
8
|
+
import { VehicleWarrantyYearType } from "../enums";
|
|
9
9
|
export declare class VehicleGetDTO {
|
|
10
10
|
filter?: VehicleFilter;
|
|
11
11
|
options?: VehicleOptions;
|
|
@@ -55,7 +55,10 @@ export declare class VehicleCreateDTO extends BaseCreateDTO {
|
|
|
55
55
|
transmission: string;
|
|
56
56
|
driveType: string;
|
|
57
57
|
emissions: string;
|
|
58
|
-
|
|
58
|
+
warrantyYears?: VehicleWarrantyYearType;
|
|
59
|
+
warrantyKm?: number;
|
|
60
|
+
serviceContractYears?: VehicleWarrantyYearType;
|
|
61
|
+
serviceContractKm?: number;
|
|
59
62
|
media?: VehicleMediaCreateDTO[];
|
|
60
63
|
finance?: VehicleFinanceCreateDTO;
|
|
61
64
|
year: number;
|
|
@@ -99,8 +102,10 @@ export declare class VehicleUpdateDTO extends BaseUpdateDTO {
|
|
|
99
102
|
transmission: string;
|
|
100
103
|
driveType: string;
|
|
101
104
|
emissions: string;
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
warrantyYears?: VehicleWarrantyYearType;
|
|
106
|
+
warrantyKm?: number;
|
|
107
|
+
serviceContractYears?: VehicleWarrantyYearType;
|
|
108
|
+
serviceContractKm?: number;
|
|
104
109
|
media: VehicleMediaUpdateDTO;
|
|
105
110
|
year: number;
|
|
106
111
|
price: number;
|
|
@@ -103,7 +103,16 @@ exports.VehicleMetaDataDTO = VehicleMetaDataDTO;
|
|
|
103
103
|
class VehicleCreateDTO extends BaseDTO_1.BaseCreateDTO {
|
|
104
104
|
validate() {
|
|
105
105
|
const errors = (0, class_validator_1.validateSync)(this);
|
|
106
|
-
|
|
106
|
+
const customErrors = [];
|
|
107
|
+
// Validate warranty
|
|
108
|
+
if (!this.warrantyYears && !this.warrantyKm) {
|
|
109
|
+
customErrors.push('Either warranty years or warranty kilometers must be provided');
|
|
110
|
+
}
|
|
111
|
+
// Validate service contract
|
|
112
|
+
if (!this.serviceContractYears && !this.serviceContractKm) {
|
|
113
|
+
customErrors.push('Either service contract years or service contract kilometers must be provided');
|
|
114
|
+
}
|
|
115
|
+
return [...errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat(), ...customErrors];
|
|
107
116
|
}
|
|
108
117
|
static fromPlain(plain) {
|
|
109
118
|
return (0, class_transformer_1.plainToClass)(VehicleCreateDTO, plain);
|
|
@@ -226,16 +235,25 @@ __decorate([
|
|
|
226
235
|
__metadata("design:type", String)
|
|
227
236
|
], VehicleCreateDTO.prototype, "emissions", void 0);
|
|
228
237
|
__decorate([
|
|
229
|
-
(0, class_validator_1.
|
|
230
|
-
(0, class_validator_1.
|
|
231
|
-
(0, class_transformer_1.Transform)(({ value }) => {
|
|
232
|
-
if (Object.values(enums_1.VehicleWarrantyType).includes(value)) {
|
|
233
|
-
return value;
|
|
234
|
-
}
|
|
235
|
-
throw new Error(`Invalid warranty type. Must be one of: ${Object.values(enums_1.VehicleWarrantyType).join(', ')}`);
|
|
236
|
-
}),
|
|
238
|
+
(0, class_validator_1.IsOptional)(),
|
|
239
|
+
(0, class_validator_1.IsEnum)(enums_1.VehicleWarrantyYearType),
|
|
237
240
|
__metadata("design:type", String)
|
|
238
|
-
], VehicleCreateDTO.prototype, "
|
|
241
|
+
], VehicleCreateDTO.prototype, "warrantyYears", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
(0, class_validator_1.IsOptional)(),
|
|
244
|
+
(0, class_validator_1.IsNumber)(),
|
|
245
|
+
__metadata("design:type", Number)
|
|
246
|
+
], VehicleCreateDTO.prototype, "warrantyKm", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
(0, class_validator_1.IsOptional)(),
|
|
249
|
+
(0, class_validator_1.IsEnum)(enums_1.VehicleWarrantyYearType),
|
|
250
|
+
__metadata("design:type", String)
|
|
251
|
+
], VehicleCreateDTO.prototype, "serviceContractYears", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
(0, class_validator_1.IsOptional)(),
|
|
254
|
+
(0, class_validator_1.IsNumber)(),
|
|
255
|
+
__metadata("design:type", Number)
|
|
256
|
+
], VehicleCreateDTO.prototype, "serviceContractKm", void 0);
|
|
239
257
|
__decorate([
|
|
240
258
|
(0, class_validator_1.IsArray)(),
|
|
241
259
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -317,7 +335,20 @@ exports.VehicleFeaturesUpdateDTO = VehicleFeaturesUpdateDTO;
|
|
|
317
335
|
class VehicleUpdateDTO extends BaseDTO_1.BaseUpdateDTO {
|
|
318
336
|
validate() {
|
|
319
337
|
const errors = (0, class_validator_1.validateSync)(this);
|
|
320
|
-
|
|
338
|
+
const customErrors = [];
|
|
339
|
+
// Only validate if at least one warranty field is provided
|
|
340
|
+
if (this.warrantyYears !== undefined || this.warrantyKm !== undefined) {
|
|
341
|
+
if (!this.warrantyYears && !this.warrantyKm) {
|
|
342
|
+
customErrors.push('Either warranty years or warranty kilometers must be provided');
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Only validate if at least one service contract field is provided
|
|
346
|
+
if (this.serviceContractYears !== undefined || this.serviceContractKm !== undefined) {
|
|
347
|
+
if (!this.serviceContractYears && !this.serviceContractKm) {
|
|
348
|
+
customErrors.push('Either service contract years or service contract kilometers must be provided');
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return [...errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat(), ...customErrors];
|
|
321
352
|
}
|
|
322
353
|
static fromPlain(plain) {
|
|
323
354
|
return (0, class_transformer_1.plainToClass)(VehicleUpdateDTO, plain);
|
|
@@ -437,26 +468,24 @@ __decorate([
|
|
|
437
468
|
], VehicleUpdateDTO.prototype, "emissions", void 0);
|
|
438
469
|
__decorate([
|
|
439
470
|
(0, class_validator_1.IsOptional)(),
|
|
440
|
-
(0, class_validator_1.
|
|
441
|
-
(0, class_transformer_1.Transform)(({ value }) => {
|
|
442
|
-
if (!value || Object.values(enums_1.VehicleWarrantyType).includes(value)) {
|
|
443
|
-
return value;
|
|
444
|
-
}
|
|
445
|
-
throw new Error(`Invalid warranty type. Must be one of: ${Object.values(enums_1.VehicleWarrantyType).join(', ')}`);
|
|
446
|
-
}),
|
|
471
|
+
(0, class_validator_1.IsEnum)(enums_1.VehicleWarrantyYearType),
|
|
447
472
|
__metadata("design:type", String)
|
|
448
|
-
], VehicleUpdateDTO.prototype, "
|
|
473
|
+
], VehicleUpdateDTO.prototype, "warrantyYears", void 0);
|
|
449
474
|
__decorate([
|
|
450
475
|
(0, class_validator_1.IsOptional)(),
|
|
451
|
-
(0, class_validator_1.
|
|
452
|
-
(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}),
|
|
476
|
+
(0, class_validator_1.IsNumber)(),
|
|
477
|
+
__metadata("design:type", Number)
|
|
478
|
+
], VehicleUpdateDTO.prototype, "warrantyKm", void 0);
|
|
479
|
+
__decorate([
|
|
480
|
+
(0, class_validator_1.IsOptional)(),
|
|
481
|
+
(0, class_validator_1.IsEnum)(enums_1.VehicleWarrantyYearType),
|
|
458
482
|
__metadata("design:type", String)
|
|
459
|
-
], VehicleUpdateDTO.prototype, "
|
|
483
|
+
], VehicleUpdateDTO.prototype, "serviceContractYears", void 0);
|
|
484
|
+
__decorate([
|
|
485
|
+
(0, class_validator_1.IsOptional)(),
|
|
486
|
+
(0, class_validator_1.IsNumber)(),
|
|
487
|
+
__metadata("design:type", Number)
|
|
488
|
+
], VehicleUpdateDTO.prototype, "serviceContractKm", void 0);
|
|
460
489
|
__decorate([
|
|
461
490
|
(0, class_validator_1.IsOptional)(),
|
|
462
491
|
(0, class_validator_1.IsArray)(),
|
|
@@ -7,7 +7,7 @@ export declare class VehicleModelGetDTO {
|
|
|
7
7
|
options?: VehicleModelOptions;
|
|
8
8
|
validate(): string[];
|
|
9
9
|
static fromPlain(plain: Record<string, unknown>): VehicleModelGetDTO;
|
|
10
|
-
toPlain(): Record<string,
|
|
10
|
+
static toPlain(entity: any): Record<string, unknown>;
|
|
11
11
|
}
|
|
12
12
|
export declare class VehicleModelGetUniqueDTO {
|
|
13
13
|
filter?: VehicleModelUniqueFilter;
|
|
@@ -24,8 +24,8 @@ class VehicleModelGetDTO {
|
|
|
24
24
|
static fromPlain(plain) {
|
|
25
25
|
return (0, class_transformer_1.plainToClass)(VehicleModelGetDTO, plain);
|
|
26
26
|
}
|
|
27
|
-
toPlain() {
|
|
28
|
-
return (0, class_transformer_1.instanceToPlain)(
|
|
27
|
+
static toPlain(entity) {
|
|
28
|
+
return (0, class_transformer_1.instanceToPlain)(entity);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.VehicleModelGetDTO = VehicleModelGetDTO;
|
|
@@ -5,7 +5,7 @@ export declare class VehicleBodyTypeGetDTO {
|
|
|
5
5
|
options?: VehicleBodyTypeOptions;
|
|
6
6
|
validate(): string[];
|
|
7
7
|
static fromPlain(plain: Record<string, unknown>): VehicleBodyTypeGetDTO;
|
|
8
|
-
toPlain(): Record<string,
|
|
8
|
+
static toPlain(entity: any): Record<string, unknown>;
|
|
9
9
|
}
|
|
10
10
|
export declare class VehicleBodyTypeGetUniqueDTO {
|
|
11
11
|
filter?: VehicleBodyTypeUniqueFilter;
|
|
@@ -22,8 +22,8 @@ class VehicleBodyTypeGetDTO {
|
|
|
22
22
|
static fromPlain(plain) {
|
|
23
23
|
return (0, class_transformer_1.plainToClass)(VehicleBodyTypeGetDTO, plain);
|
|
24
24
|
}
|
|
25
|
-
toPlain() {
|
|
26
|
-
return (0, class_transformer_1.instanceToPlain)(
|
|
25
|
+
static toPlain(entity) {
|
|
26
|
+
return (0, class_transformer_1.instanceToPlain)(entity);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
exports.VehicleBodyTypeGetDTO = VehicleBodyTypeGetDTO;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VehicleWarrantyYearType } from "../enums";
|
|
2
|
+
export declare class VehicleWarrantyDTO {
|
|
3
|
+
year?: VehicleWarrantyYearType;
|
|
4
|
+
km?: number;
|
|
5
|
+
constructor(year?: VehicleWarrantyYearType, km?: number);
|
|
6
|
+
toString(): string;
|
|
7
|
+
validate(): string[];
|
|
8
|
+
static fromPlain(plain: Record<string, unknown>): VehicleWarrantyDTO;
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.VehicleWarrantyDTO = void 0;
|
|
13
|
+
const enums_1 = require("../enums");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
class VehicleWarrantyDTO {
|
|
17
|
+
constructor(year, km) {
|
|
18
|
+
this.year = year;
|
|
19
|
+
this.km = km;
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return `Until ${this.year} or ${this.km}Kms`;
|
|
23
|
+
}
|
|
24
|
+
validate() {
|
|
25
|
+
const errors = (0, class_validator_1.validateSync)(this);
|
|
26
|
+
if (!this.year && !this.km) {
|
|
27
|
+
return ['Either year or km must be provided'];
|
|
28
|
+
}
|
|
29
|
+
return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
|
|
30
|
+
}
|
|
31
|
+
static fromPlain(plain) {
|
|
32
|
+
return (0, class_transformer_1.plainToClass)(VehicleWarrantyDTO, plain);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsOptional)(),
|
|
37
|
+
(0, class_validator_1.IsEnum)(enums_1.VehicleWarrantyYearType),
|
|
38
|
+
(0, class_validator_1.ValidateIf)((o) => o.km === undefined || o.km === null),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], VehicleWarrantyDTO.prototype, "year", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, class_validator_1.IsNumber)(),
|
|
44
|
+
(0, class_validator_1.ValidateIf)((o) => o.year === undefined || o.year === null),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], VehicleWarrantyDTO.prototype, "km", void 0);
|
|
47
|
+
exports.VehicleWarrantyDTO = VehicleWarrantyDTO;
|
|
@@ -32,3 +32,4 @@ __exportStar(require("./VehicleInspectionDTO"), exports);
|
|
|
32
32
|
__exportStar(require("./VehicleFilterDTO"), exports);
|
|
33
33
|
__exportStar(require("./SimilarVehicleDTO"), exports);
|
|
34
34
|
__exportStar(require("./VehicleFavoritesDTO"), exports);
|
|
35
|
+
__exportStar(require("./VehicleWarrantyDTO"), exports);
|
|
@@ -7,9 +7,10 @@ export declare enum VehicleStatusType {
|
|
|
7
7
|
DRAFT = "Draft",
|
|
8
8
|
PUBLISHED = "Published",
|
|
9
9
|
SELF_RESERVED = "Self-Reserved",
|
|
10
|
-
SOLD = "Sold"
|
|
10
|
+
SOLD = "Sold",
|
|
11
|
+
UNPUBLISHED = "Unpublished"
|
|
11
12
|
}
|
|
12
|
-
export declare enum
|
|
13
|
+
export declare enum VehicleWarrantyYearType {
|
|
13
14
|
ONE_YEAR = "1 Year",
|
|
14
15
|
TWO_YEARS = "2 Years",
|
|
15
16
|
THREE_YEARS = "3 Years",
|
|
@@ -20,14 +21,25 @@ export declare enum VehicleWarrantyType {
|
|
|
20
21
|
EIGHT_YEARS = "8 Years",
|
|
21
22
|
NINE_YEARS = "9 Years",
|
|
22
23
|
TEN_YEARS = "10 Years",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
ELEVEN_YEARS = "11 Years",
|
|
25
|
+
TWELVE_YEARS = "12 Years",
|
|
26
|
+
THIRTEEN_YEARS = "13 Years",
|
|
27
|
+
FOURTEEN_YEARS = "14 Years",
|
|
28
|
+
FIFTEEN_YEARS = "15 Years"
|
|
29
|
+
}
|
|
30
|
+
export declare enum VehicleRegionSpec {
|
|
31
|
+
GCC_SPECS = "GCC specs",
|
|
32
|
+
CHINESE_SPECS = "Chinese specs",
|
|
33
|
+
EUROPEAN_SPECS = "European specs",
|
|
34
|
+
ENGLAND_SPECS = "English specs",
|
|
35
|
+
AUSTRALIA_SPECS = "Australian specs",
|
|
36
|
+
JAPANESE_SPECS = "Japanese specs",
|
|
37
|
+
USA_SPECS = "USA specs",
|
|
38
|
+
CANADIAN_SPECS = "Canadian specs",
|
|
39
|
+
NORTH_AMERICAN_SPECS = "North American specs",
|
|
40
|
+
KOREAN_SPECS = "Korean specs",
|
|
41
|
+
SOUTH_AFRICAN_SPECS = "South African specs",
|
|
42
|
+
BRITISH_SPECS = "British specs",
|
|
43
|
+
IMPORTED_SPECS = "Imported",
|
|
44
|
+
OTHER_SPECS = "Other specs"
|
|
33
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VehicleRegionSpec = exports.VehicleWarrantyYearType = exports.VehicleStatusType = exports.VehicleMediaType = void 0;
|
|
4
4
|
var VehicleMediaType;
|
|
5
5
|
(function (VehicleMediaType) {
|
|
6
6
|
VehicleMediaType["IMAGE"] = "image";
|
|
@@ -13,27 +13,40 @@ var VehicleStatusType;
|
|
|
13
13
|
VehicleStatusType["PUBLISHED"] = "Published";
|
|
14
14
|
VehicleStatusType["SELF_RESERVED"] = "Self-Reserved";
|
|
15
15
|
VehicleStatusType["SOLD"] = "Sold";
|
|
16
|
+
VehicleStatusType["UNPUBLISHED"] = "Unpublished";
|
|
16
17
|
})(VehicleStatusType = exports.VehicleStatusType || (exports.VehicleStatusType = {}));
|
|
17
|
-
var
|
|
18
|
-
(function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
var VehicleWarrantyYearType;
|
|
19
|
+
(function (VehicleWarrantyYearType) {
|
|
20
|
+
VehicleWarrantyYearType["ONE_YEAR"] = "1 Year";
|
|
21
|
+
VehicleWarrantyYearType["TWO_YEARS"] = "2 Years";
|
|
22
|
+
VehicleWarrantyYearType["THREE_YEARS"] = "3 Years";
|
|
23
|
+
VehicleWarrantyYearType["FOUR_YEARS"] = "4 Years";
|
|
24
|
+
VehicleWarrantyYearType["FIVE_YEARS"] = "5 Years";
|
|
25
|
+
VehicleWarrantyYearType["SIX_YEARS"] = "6 Years";
|
|
26
|
+
VehicleWarrantyYearType["SEVEN_YEARS"] = "7 Years";
|
|
27
|
+
VehicleWarrantyYearType["EIGHT_YEARS"] = "8 Years";
|
|
28
|
+
VehicleWarrantyYearType["NINE_YEARS"] = "9 Years";
|
|
29
|
+
VehicleWarrantyYearType["TEN_YEARS"] = "10 Years";
|
|
30
|
+
VehicleWarrantyYearType["ELEVEN_YEARS"] = "11 Years";
|
|
31
|
+
VehicleWarrantyYearType["TWELVE_YEARS"] = "12 Years";
|
|
32
|
+
VehicleWarrantyYearType["THIRTEEN_YEARS"] = "13 Years";
|
|
33
|
+
VehicleWarrantyYearType["FOURTEEN_YEARS"] = "14 Years";
|
|
34
|
+
VehicleWarrantyYearType["FIFTEEN_YEARS"] = "15 Years";
|
|
35
|
+
})(VehicleWarrantyYearType = exports.VehicleWarrantyYearType || (exports.VehicleWarrantyYearType = {}));
|
|
36
|
+
var VehicleRegionSpec;
|
|
37
|
+
(function (VehicleRegionSpec) {
|
|
38
|
+
VehicleRegionSpec["GCC_SPECS"] = "GCC specs";
|
|
39
|
+
VehicleRegionSpec["CHINESE_SPECS"] = "Chinese specs";
|
|
40
|
+
VehicleRegionSpec["EUROPEAN_SPECS"] = "European specs";
|
|
41
|
+
VehicleRegionSpec["ENGLAND_SPECS"] = "English specs";
|
|
42
|
+
VehicleRegionSpec["AUSTRALIA_SPECS"] = "Australian specs";
|
|
43
|
+
VehicleRegionSpec["JAPANESE_SPECS"] = "Japanese specs";
|
|
44
|
+
VehicleRegionSpec["USA_SPECS"] = "USA specs";
|
|
45
|
+
VehicleRegionSpec["CANADIAN_SPECS"] = "Canadian specs";
|
|
46
|
+
VehicleRegionSpec["NORTH_AMERICAN_SPECS"] = "North American specs";
|
|
47
|
+
VehicleRegionSpec["KOREAN_SPECS"] = "Korean specs";
|
|
48
|
+
VehicleRegionSpec["SOUTH_AFRICAN_SPECS"] = "South African specs";
|
|
49
|
+
VehicleRegionSpec["BRITISH_SPECS"] = "British specs";
|
|
50
|
+
VehicleRegionSpec["IMPORTED_SPECS"] = "Imported";
|
|
51
|
+
VehicleRegionSpec["OTHER_SPECS"] = "Other specs";
|
|
52
|
+
})(VehicleRegionSpec = exports.VehicleRegionSpec || (exports.VehicleRegionSpec = {}));
|
package/package.json
CHANGED