@alba-cars/common-modules 1.10.15 → 1.10.17
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/features/models/Vehicle.d.ts +2 -3
- package/dist/features/vehicle/data/dto/VehicleDTO.d.ts +2 -0
- package/dist/features/vehicle/data/dto/VehicleDTO.js +24 -7
- package/dist/features/vehicle/data/enums/index.d.ts +0 -7
- package/dist/features/vehicle/data/enums/index.js +0 -7
- package/package.json +1 -1
|
@@ -10,7 +10,6 @@ import { VehicleOrder } from "./VehicleOrder";
|
|
|
10
10
|
import { UserFavoriteVehicle } from "./UserFavoriteVehicle";
|
|
11
11
|
import { User } from "./User";
|
|
12
12
|
import { Deposit } from "./Deposit";
|
|
13
|
-
import { VehicleWarrantyDTO } from "../vehicle/data/dto/VehicleWarrantyDTO";
|
|
14
13
|
import { VehicleInspectionDTO, VehicleWarrantyYearType } from "../vehicle";
|
|
15
14
|
export declare class Vehicle extends BaseModel {
|
|
16
15
|
referenceNumber?: string;
|
|
@@ -50,8 +49,8 @@ export declare class Vehicle extends BaseModel {
|
|
|
50
49
|
warrantyKm?: number;
|
|
51
50
|
serviceContractYears?: VehicleWarrantyYearType;
|
|
52
51
|
serviceContractKm?: number;
|
|
53
|
-
serviceContract?:
|
|
54
|
-
warranty
|
|
52
|
+
serviceContract?: string;
|
|
53
|
+
warranty?: string;
|
|
55
54
|
orders?: VehicleOrder[];
|
|
56
55
|
draft?: VehicleDraft;
|
|
57
56
|
vehicleFavorites?: UserFavoriteVehicle[];
|
|
@@ -58,8 +58,10 @@ export declare class VehicleCreateDTO extends BaseCreateDTO {
|
|
|
58
58
|
emissions: string;
|
|
59
59
|
warrantyYears?: VehicleWarrantyYearType;
|
|
60
60
|
warrantyKm?: number;
|
|
61
|
+
warranty?: string;
|
|
61
62
|
serviceContractYears?: VehicleWarrantyYearType;
|
|
62
63
|
serviceContractKm?: number;
|
|
64
|
+
serviceContract?: string;
|
|
63
65
|
media?: VehicleMediaCreateDTO[];
|
|
64
66
|
finance?: VehicleFinanceCreateDTO;
|
|
65
67
|
year: number;
|
|
@@ -106,13 +106,16 @@ class VehicleCreateDTO extends BaseDTO_1.BaseCreateDTO {
|
|
|
106
106
|
const customErrors = [];
|
|
107
107
|
// Validate warranty
|
|
108
108
|
if (!this.warrantyYears && !this.warrantyKm) {
|
|
109
|
-
customErrors.push(
|
|
109
|
+
customErrors.push("Either warranty years or warranty kilometers must be provided");
|
|
110
110
|
}
|
|
111
111
|
// Validate service contract
|
|
112
112
|
if (!this.serviceContractYears && !this.serviceContractKm) {
|
|
113
|
-
customErrors.push(
|
|
113
|
+
customErrors.push("Either service contract years or service contract kilometers must be provided");
|
|
114
114
|
}
|
|
115
|
-
return [
|
|
115
|
+
return [
|
|
116
|
+
...errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat(),
|
|
117
|
+
...customErrors,
|
|
118
|
+
];
|
|
116
119
|
}
|
|
117
120
|
static fromPlain(plain) {
|
|
118
121
|
return (0, class_transformer_1.plainToClass)(VehicleCreateDTO, plain);
|
|
@@ -244,6 +247,11 @@ __decorate([
|
|
|
244
247
|
(0, class_validator_1.IsNumber)(),
|
|
245
248
|
__metadata("design:type", Number)
|
|
246
249
|
], VehicleCreateDTO.prototype, "warrantyKm", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
(0, class_validator_1.IsOptional)(),
|
|
252
|
+
(0, class_validator_1.IsString)(),
|
|
253
|
+
__metadata("design:type", String)
|
|
254
|
+
], VehicleCreateDTO.prototype, "warranty", void 0);
|
|
247
255
|
__decorate([
|
|
248
256
|
(0, class_validator_1.IsOptional)(),
|
|
249
257
|
(0, class_validator_1.IsEnum)(enums_1.VehicleWarrantyYearType),
|
|
@@ -254,6 +262,11 @@ __decorate([
|
|
|
254
262
|
(0, class_validator_1.IsNumber)(),
|
|
255
263
|
__metadata("design:type", Number)
|
|
256
264
|
], VehicleCreateDTO.prototype, "serviceContractKm", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
(0, class_validator_1.IsOptional)(),
|
|
267
|
+
(0, class_validator_1.IsString)(),
|
|
268
|
+
__metadata("design:type", String)
|
|
269
|
+
], VehicleCreateDTO.prototype, "serviceContract", void 0);
|
|
257
270
|
__decorate([
|
|
258
271
|
(0, class_validator_1.IsArray)(),
|
|
259
272
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -339,16 +352,20 @@ class VehicleUpdateDTO extends BaseDTO_1.BaseUpdateDTO {
|
|
|
339
352
|
// Only validate if at least one warranty field is provided
|
|
340
353
|
if (this.warrantyYears !== undefined || this.warrantyKm !== undefined) {
|
|
341
354
|
if (!this.warrantyYears && !this.warrantyKm) {
|
|
342
|
-
customErrors.push(
|
|
355
|
+
customErrors.push("Either warranty years or warranty kilometers must be provided");
|
|
343
356
|
}
|
|
344
357
|
}
|
|
345
358
|
// Only validate if at least one service contract field is provided
|
|
346
|
-
if (this.serviceContractYears !== undefined ||
|
|
359
|
+
if (this.serviceContractYears !== undefined ||
|
|
360
|
+
this.serviceContractKm !== undefined) {
|
|
347
361
|
if (!this.serviceContractYears && !this.serviceContractKm) {
|
|
348
|
-
customErrors.push(
|
|
362
|
+
customErrors.push("Either service contract years or service contract kilometers must be provided");
|
|
349
363
|
}
|
|
350
364
|
}
|
|
351
|
-
return [
|
|
365
|
+
return [
|
|
366
|
+
...errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat(),
|
|
367
|
+
...customErrors,
|
|
368
|
+
];
|
|
352
369
|
}
|
|
353
370
|
static fromPlain(plain) {
|
|
354
371
|
return (0, class_transformer_1.plainToClass)(VehicleUpdateDTO, plain);
|
|
@@ -31,15 +31,8 @@ export declare enum VehicleRegionSpec {
|
|
|
31
31
|
GCC_SPECS = "GCC specs",
|
|
32
32
|
CHINESE_SPECS = "Chinese specs",
|
|
33
33
|
EUROPEAN_SPECS = "European specs",
|
|
34
|
-
ENGLAND_SPECS = "English specs",
|
|
35
|
-
AUSTRALIA_SPECS = "Australian specs",
|
|
36
34
|
JAPANESE_SPECS = "Japanese specs",
|
|
37
35
|
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
36
|
IMPORTED_SPECS = "Imported",
|
|
44
37
|
OTHER_SPECS = "Other specs"
|
|
45
38
|
}
|
|
@@ -38,15 +38,8 @@ var VehicleRegionSpec;
|
|
|
38
38
|
VehicleRegionSpec["GCC_SPECS"] = "GCC specs";
|
|
39
39
|
VehicleRegionSpec["CHINESE_SPECS"] = "Chinese specs";
|
|
40
40
|
VehicleRegionSpec["EUROPEAN_SPECS"] = "European specs";
|
|
41
|
-
VehicleRegionSpec["ENGLAND_SPECS"] = "English specs";
|
|
42
|
-
VehicleRegionSpec["AUSTRALIA_SPECS"] = "Australian specs";
|
|
43
41
|
VehicleRegionSpec["JAPANESE_SPECS"] = "Japanese specs";
|
|
44
42
|
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
43
|
VehicleRegionSpec["IMPORTED_SPECS"] = "Imported";
|
|
51
44
|
VehicleRegionSpec["OTHER_SPECS"] = "Other specs";
|
|
52
45
|
})(VehicleRegionSpec = exports.VehicleRegionSpec || (exports.VehicleRegionSpec = {}));
|
package/package.json
CHANGED