@alba-cars/common-modules 1.6.0 → 1.6.1

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.
@@ -23,7 +23,7 @@ type MetaEndpoints = BaseEndpoint & {
23
23
  aiGenerateKeyword: EndpointFunction;
24
24
  };
25
25
  type DepositEndpoints = BaseEndpoint & {
26
- initiateRefund: EndpointFunction;
26
+ initiateRefund: string | EndpointFunction;
27
27
  };
28
28
  type APIEndpointType = {
29
29
  vehicle: VehicleEndpoints;
@@ -115,7 +115,7 @@ exports.API_ENDPOINTS = {
115
115
  getOne: (id) => `/deposits/${id}`,
116
116
  deleteOne: (id) => `/deposits/${id}`,
117
117
  updateOne: (id) => `/deposits/${id}`,
118
- initiateRefund: () => `/deposits/refund/`,
118
+ initiateRefund: `/deposits/refund/`,
119
119
  },
120
120
  leads: {
121
121
  getAll: `/leads`,
@@ -277,7 +277,6 @@ __decorate([
277
277
  __metadata("design:type", DepositFilter)
278
278
  ], DepositGetDTO.prototype, "filters", void 0);
279
279
  __decorate([
280
- (0, class_validator_1.ValidateNested)(),
281
280
  (0, class_transformer_1.Type)(() => DepositOptions),
282
281
  (0, class_validator_1.IsOptional)(),
283
282
  __metadata("design:type", DepositOptions)
@@ -3,40 +3,67 @@ export declare enum RequestType {
3
3
  SELL = "sell",
4
4
  TRADE_IN = "trade_in"
5
5
  }
6
- export declare class SellCarRequestCreateDTO {
6
+ export declare enum TradeInOption {
7
+ YES = "yes",
8
+ NO = "no"
9
+ }
10
+ export declare enum VehicleOption {
11
+ NEW = "new",
12
+ USED = "used"
13
+ }
14
+ export declare class SellCarRequestDTO {
15
+ id: string;
7
16
  name: string;
8
17
  phone: string;
9
- email?: string;
18
+ brand: string;
19
+ brandName: string;
20
+ model: string;
21
+ modelName: string;
22
+ modelVersion: string;
23
+ modelVersionName: string;
24
+ trim: string;
25
+ trimName: string;
26
+ year: string;
27
+ mileage: number;
28
+ expectedSellingPrice: number;
29
+ description: string;
10
30
  city: string;
11
- requestType: RequestType;
12
- makeId: string;
13
- modelId: string;
14
- year: number;
31
+ emirates: string;
32
+ engineCylinderCount: number;
33
+ specification: string;
34
+ specificationName: string;
35
+ tradeIn: TradeInOption;
36
+ vehicleOptions: VehicleOption;
37
+ isDeleted?: boolean;
38
+ createdAt?: Date;
39
+ updatedAt?: Date;
40
+ validate(): string[];
41
+ static fromPlain(plain: Record<string, unknown>): SellCarRequestDTO;
42
+ toPlain(): Record<string, unknown>;
43
+ }
44
+ export declare class SellCarRequestCreateDTO {
45
+ name: string;
46
+ phone: string;
47
+ brand: string;
48
+ brandName: string;
49
+ model: string;
50
+ modelName: string;
51
+ modelVersion: string;
52
+ modelVersionName: string;
53
+ trim: string;
54
+ trimName: string;
55
+ year: string;
15
56
  mileage: number;
16
- expectedSellingPrice?: number;
17
- vehicleOptions?: string;
18
- specification?: string;
19
- images?: string[];
20
- desiredVehicleId?: string;
21
- color?: string;
22
- transmission?: string;
23
- condition?: string;
24
- fuelType?: string;
25
- engineCapacity?: string;
26
- description?: string;
27
- additionalDetails?: {
28
- serviceHistory?: boolean;
29
- numberOfOwners?: number;
30
- accidentHistory?: boolean;
31
- modifications?: string[];
32
- lastServiceDate?: Date;
33
- warrantyValid?: boolean;
34
- tradeIn?: boolean;
35
- inspectionDate?: Date;
36
- inspectionLocation?: string;
37
- finalTradeInOffer?: number;
38
- [key: string]: any;
39
- };
57
+ expectedSellingPrice: number;
58
+ description: string;
59
+ city: string;
60
+ emirates: string;
61
+ engineCylinderCount: number;
62
+ requestType?: RequestType;
63
+ specification: string;
64
+ specificationName: string;
65
+ tradeIn: TradeInOption;
66
+ vehicleOptions: VehicleOption;
40
67
  validate(): string[];
41
68
  static fromPlain(plain: Record<string, unknown>): SellCarRequestCreateDTO;
42
69
  toPlain(): Record<string, unknown>;
@@ -9,7 +9,7 @@ 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.SellCarFetchDTO = exports.SellCarOptionsDTO = exports.SellCarFilterDTO = exports.SellCarRequestResponseDTO = exports.SellCarRequestUpdateDTO = exports.SellCarRequestCreateDTO = exports.RequestType = void 0;
12
+ exports.SellCarFetchDTO = exports.SellCarOptionsDTO = exports.SellCarFilterDTO = exports.SellCarRequestResponseDTO = exports.SellCarRequestUpdateDTO = exports.SellCarRequestCreateDTO = exports.SellCarRequestDTO = exports.VehicleOption = exports.TradeInOption = exports.RequestType = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const class_transformer_1 = require("class-transformer");
15
15
  const global_1 = require("../../../../global");
@@ -18,126 +18,235 @@ var RequestType;
18
18
  RequestType["SELL"] = "sell";
19
19
  RequestType["TRADE_IN"] = "trade_in";
20
20
  })(RequestType = exports.RequestType || (exports.RequestType = {}));
21
- class SellCarRequestCreateDTO {
21
+ var TradeInOption;
22
+ (function (TradeInOption) {
23
+ TradeInOption["YES"] = "yes";
24
+ TradeInOption["NO"] = "no";
25
+ })(TradeInOption = exports.TradeInOption || (exports.TradeInOption = {}));
26
+ var VehicleOption;
27
+ (function (VehicleOption) {
28
+ VehicleOption["NEW"] = "new";
29
+ VehicleOption["USED"] = "used";
30
+ })(VehicleOption = exports.VehicleOption || (exports.VehicleOption = {}));
31
+ class SellCarRequestDTO {
22
32
  validate() {
23
33
  const errors = (0, class_validator_1.validateSync)(this);
24
34
  return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
25
35
  }
26
36
  static fromPlain(plain) {
27
- const requestType = plain.desiredVehicleId
28
- ? RequestType.TRADE_IN
29
- : RequestType.SELL;
30
- return (0, class_transformer_1.plainToClass)(SellCarRequestCreateDTO, { ...plain, requestType });
37
+ return (0, class_transformer_1.plainToClass)(SellCarRequestDTO, plain);
31
38
  }
32
39
  toPlain() {
33
40
  return (0, class_transformer_1.classToPlain)(this);
34
41
  }
35
42
  }
43
+ __decorate([
44
+ (0, class_validator_1.IsUUID)(),
45
+ __metadata("design:type", String)
46
+ ], SellCarRequestDTO.prototype, "id", void 0);
36
47
  __decorate([
37
48
  (0, class_validator_1.IsString)(),
38
49
  __metadata("design:type", String)
39
- ], SellCarRequestCreateDTO.prototype, "name", void 0);
50
+ ], SellCarRequestDTO.prototype, "name", void 0);
40
51
  __decorate([
52
+ (0, class_validator_1.IsString)(),
41
53
  (0, class_validator_1.IsPhoneNumber)(),
42
54
  __metadata("design:type", String)
43
- ], SellCarRequestCreateDTO.prototype, "phone", void 0);
55
+ ], SellCarRequestDTO.prototype, "phone", void 0);
44
56
  __decorate([
45
- (0, class_validator_1.IsEmail)(),
46
- (0, class_validator_1.IsOptional)(),
57
+ (0, class_validator_1.IsString)(),
47
58
  __metadata("design:type", String)
48
- ], SellCarRequestCreateDTO.prototype, "email", void 0);
59
+ ], SellCarRequestDTO.prototype, "brand", void 0);
49
60
  __decorate([
50
61
  (0, class_validator_1.IsString)(),
51
62
  __metadata("design:type", String)
52
- ], SellCarRequestCreateDTO.prototype, "city", void 0);
63
+ ], SellCarRequestDTO.prototype, "brandName", void 0);
53
64
  __decorate([
54
- (0, class_validator_1.IsEnum)(RequestType),
65
+ (0, class_validator_1.IsString)(),
55
66
  __metadata("design:type", String)
56
- ], SellCarRequestCreateDTO.prototype, "requestType", void 0);
67
+ ], SellCarRequestDTO.prototype, "model", void 0);
57
68
  __decorate([
58
- (0, class_validator_1.IsUUID)(),
69
+ (0, class_validator_1.IsString)(),
59
70
  __metadata("design:type", String)
60
- ], SellCarRequestCreateDTO.prototype, "makeId", void 0);
71
+ ], SellCarRequestDTO.prototype, "modelName", void 0);
61
72
  __decorate([
62
- (0, class_validator_1.IsUUID)(),
73
+ (0, class_validator_1.IsString)(),
63
74
  __metadata("design:type", String)
64
- ], SellCarRequestCreateDTO.prototype, "modelId", void 0);
75
+ ], SellCarRequestDTO.prototype, "modelVersion", void 0);
76
+ __decorate([
77
+ (0, class_validator_1.IsString)(),
78
+ __metadata("design:type", String)
79
+ ], SellCarRequestDTO.prototype, "modelVersionName", void 0);
80
+ __decorate([
81
+ (0, class_validator_1.IsString)(),
82
+ __metadata("design:type", String)
83
+ ], SellCarRequestDTO.prototype, "trim", void 0);
84
+ __decorate([
85
+ (0, class_validator_1.IsString)(),
86
+ __metadata("design:type", String)
87
+ ], SellCarRequestDTO.prototype, "trimName", void 0);
88
+ __decorate([
89
+ (0, class_validator_1.IsString)(),
90
+ __metadata("design:type", String)
91
+ ], SellCarRequestDTO.prototype, "year", void 0);
65
92
  __decorate([
66
93
  (0, class_validator_1.IsNumber)(),
67
- (0, class_validator_1.IsPositive)(),
68
94
  __metadata("design:type", Number)
69
- ], SellCarRequestCreateDTO.prototype, "year", void 0);
95
+ ], SellCarRequestDTO.prototype, "mileage", void 0);
70
96
  __decorate([
71
97
  (0, class_validator_1.IsNumber)(),
72
- (0, class_validator_1.IsPositive)(),
73
98
  __metadata("design:type", Number)
74
- ], SellCarRequestCreateDTO.prototype, "mileage", void 0);
99
+ ], SellCarRequestDTO.prototype, "expectedSellingPrice", void 0);
100
+ __decorate([
101
+ (0, class_validator_1.IsString)(),
102
+ __metadata("design:type", String)
103
+ ], SellCarRequestDTO.prototype, "description", void 0);
104
+ __decorate([
105
+ (0, class_validator_1.IsString)(),
106
+ __metadata("design:type", String)
107
+ ], SellCarRequestDTO.prototype, "city", void 0);
108
+ __decorate([
109
+ (0, class_validator_1.IsString)(),
110
+ __metadata("design:type", String)
111
+ ], SellCarRequestDTO.prototype, "emirates", void 0);
75
112
  __decorate([
76
113
  (0, class_validator_1.IsNumber)(),
77
- (0, class_validator_1.IsPositive)(),
78
- (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
79
- (0, class_validator_1.IsOptional)(),
80
114
  __metadata("design:type", Number)
81
- ], SellCarRequestCreateDTO.prototype, "expectedSellingPrice", void 0);
115
+ ], SellCarRequestDTO.prototype, "engineCylinderCount", void 0);
82
116
  __decorate([
83
117
  (0, class_validator_1.IsString)(),
84
- (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
85
- (0, class_validator_1.IsOptional)(),
86
118
  __metadata("design:type", String)
87
- ], SellCarRequestCreateDTO.prototype, "vehicleOptions", void 0);
119
+ ], SellCarRequestDTO.prototype, "specification", void 0);
88
120
  __decorate([
89
121
  (0, class_validator_1.IsString)(),
90
- (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
91
- (0, class_validator_1.IsOptional)(),
92
122
  __metadata("design:type", String)
93
- ], SellCarRequestCreateDTO.prototype, "specification", void 0);
123
+ ], SellCarRequestDTO.prototype, "specificationName", void 0);
94
124
  __decorate([
95
- (0, class_validator_1.IsArray)(),
96
- (0, class_validator_1.IsString)({ each: true }),
97
- (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
125
+ (0, class_validator_1.IsEnum)(TradeInOption),
126
+ __metadata("design:type", String)
127
+ ], SellCarRequestDTO.prototype, "tradeIn", void 0);
128
+ __decorate([
129
+ (0, class_validator_1.IsEnum)(VehicleOption),
130
+ __metadata("design:type", String)
131
+ ], SellCarRequestDTO.prototype, "vehicleOptions", void 0);
132
+ __decorate([
133
+ (0, class_validator_1.IsBoolean)(),
98
134
  (0, class_validator_1.IsOptional)(),
99
- __metadata("design:type", Array)
100
- ], SellCarRequestCreateDTO.prototype, "images", void 0);
135
+ __metadata("design:type", Boolean)
136
+ ], SellCarRequestDTO.prototype, "isDeleted", void 0);
101
137
  __decorate([
102
- (0, class_validator_1.IsUUID)(),
103
- (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.TRADE_IN),
138
+ (0, class_validator_1.IsDate)(),
139
+ (0, class_validator_1.IsOptional)(),
140
+ __metadata("design:type", Date)
141
+ ], SellCarRequestDTO.prototype, "createdAt", void 0);
142
+ __decorate([
143
+ (0, class_validator_1.IsDate)(),
104
144
  (0, class_validator_1.IsOptional)(),
145
+ __metadata("design:type", Date)
146
+ ], SellCarRequestDTO.prototype, "updatedAt", void 0);
147
+ exports.SellCarRequestDTO = SellCarRequestDTO;
148
+ class SellCarRequestCreateDTO {
149
+ validate() {
150
+ const errors = (0, class_validator_1.validateSync)(this);
151
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
152
+ }
153
+ static fromPlain(plain) {
154
+ return (0, class_transformer_1.plainToClass)(SellCarRequestCreateDTO, plain);
155
+ }
156
+ toPlain() {
157
+ return (0, class_transformer_1.classToPlain)(this);
158
+ }
159
+ }
160
+ __decorate([
161
+ (0, class_validator_1.IsString)(),
105
162
  __metadata("design:type", String)
106
- ], SellCarRequestCreateDTO.prototype, "desiredVehicleId", void 0);
163
+ ], SellCarRequestCreateDTO.prototype, "name", void 0);
107
164
  __decorate([
108
165
  (0, class_validator_1.IsString)(),
109
- (0, class_validator_1.IsOptional)(),
166
+ (0, class_validator_1.IsPhoneNumber)(),
110
167
  __metadata("design:type", String)
111
- ], SellCarRequestCreateDTO.prototype, "color", void 0);
168
+ ], SellCarRequestCreateDTO.prototype, "phone", void 0);
112
169
  __decorate([
113
170
  (0, class_validator_1.IsString)(),
114
- (0, class_validator_1.IsOptional)(),
115
171
  __metadata("design:type", String)
116
- ], SellCarRequestCreateDTO.prototype, "transmission", void 0);
172
+ ], SellCarRequestCreateDTO.prototype, "brand", void 0);
117
173
  __decorate([
118
174
  (0, class_validator_1.IsString)(),
119
- (0, class_validator_1.IsOptional)(),
120
175
  __metadata("design:type", String)
121
- ], SellCarRequestCreateDTO.prototype, "condition", void 0);
176
+ ], SellCarRequestCreateDTO.prototype, "brandName", void 0);
122
177
  __decorate([
123
178
  (0, class_validator_1.IsString)(),
124
- (0, class_validator_1.IsOptional)(),
125
179
  __metadata("design:type", String)
126
- ], SellCarRequestCreateDTO.prototype, "fuelType", void 0);
180
+ ], SellCarRequestCreateDTO.prototype, "model", void 0);
127
181
  __decorate([
128
182
  (0, class_validator_1.IsString)(),
129
- (0, class_validator_1.IsOptional)(),
130
183
  __metadata("design:type", String)
131
- ], SellCarRequestCreateDTO.prototype, "engineCapacity", void 0);
184
+ ], SellCarRequestCreateDTO.prototype, "modelName", void 0);
185
+ __decorate([
186
+ (0, class_validator_1.IsString)(),
187
+ __metadata("design:type", String)
188
+ ], SellCarRequestCreateDTO.prototype, "modelVersion", void 0);
189
+ __decorate([
190
+ (0, class_validator_1.IsString)(),
191
+ __metadata("design:type", String)
192
+ ], SellCarRequestCreateDTO.prototype, "modelVersionName", void 0);
193
+ __decorate([
194
+ (0, class_validator_1.IsString)(),
195
+ __metadata("design:type", String)
196
+ ], SellCarRequestCreateDTO.prototype, "trim", void 0);
197
+ __decorate([
198
+ (0, class_validator_1.IsString)(),
199
+ __metadata("design:type", String)
200
+ ], SellCarRequestCreateDTO.prototype, "trimName", void 0);
201
+ __decorate([
202
+ (0, class_validator_1.IsString)(),
203
+ __metadata("design:type", String)
204
+ ], SellCarRequestCreateDTO.prototype, "year", void 0);
205
+ __decorate([
206
+ (0, class_validator_1.IsNumber)(),
207
+ __metadata("design:type", Number)
208
+ ], SellCarRequestCreateDTO.prototype, "mileage", void 0);
209
+ __decorate([
210
+ (0, class_validator_1.IsNumber)(),
211
+ __metadata("design:type", Number)
212
+ ], SellCarRequestCreateDTO.prototype, "expectedSellingPrice", void 0);
132
213
  __decorate([
133
214
  (0, class_validator_1.IsString)(),
134
- (0, class_validator_1.IsOptional)(),
135
215
  __metadata("design:type", String)
136
216
  ], SellCarRequestCreateDTO.prototype, "description", void 0);
217
+ __decorate([
218
+ (0, class_validator_1.IsString)(),
219
+ __metadata("design:type", String)
220
+ ], SellCarRequestCreateDTO.prototype, "city", void 0);
221
+ __decorate([
222
+ (0, class_validator_1.IsString)(),
223
+ __metadata("design:type", String)
224
+ ], SellCarRequestCreateDTO.prototype, "emirates", void 0);
225
+ __decorate([
226
+ (0, class_validator_1.IsNumber)(),
227
+ __metadata("design:type", Number)
228
+ ], SellCarRequestCreateDTO.prototype, "engineCylinderCount", void 0);
137
229
  __decorate([
138
230
  (0, class_validator_1.IsOptional)(),
139
- __metadata("design:type", Object)
140
- ], SellCarRequestCreateDTO.prototype, "additionalDetails", void 0);
231
+ (0, class_validator_1.IsEnum)(RequestType),
232
+ __metadata("design:type", String)
233
+ ], SellCarRequestCreateDTO.prototype, "requestType", void 0);
234
+ __decorate([
235
+ (0, class_validator_1.IsString)(),
236
+ __metadata("design:type", String)
237
+ ], SellCarRequestCreateDTO.prototype, "specification", void 0);
238
+ __decorate([
239
+ (0, class_validator_1.IsString)(),
240
+ __metadata("design:type", String)
241
+ ], SellCarRequestCreateDTO.prototype, "specificationName", void 0);
242
+ __decorate([
243
+ (0, class_validator_1.IsEnum)(TradeInOption),
244
+ __metadata("design:type", String)
245
+ ], SellCarRequestCreateDTO.prototype, "tradeIn", void 0);
246
+ __decorate([
247
+ (0, class_validator_1.IsEnum)(VehicleOption),
248
+ __metadata("design:type", String)
249
+ ], SellCarRequestCreateDTO.prototype, "vehicleOptions", void 0);
141
250
  exports.SellCarRequestCreateDTO = SellCarRequestCreateDTO;
142
251
  class SellCarRequestUpdateDTO {
143
252
  validate() {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.0",
6
+ "version": "1.6.1",
7
7
  "description": "A package containing DTOs, validation classes and common modules and interfaces for Alba Cars",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",