@alba-cars/common-modules 1.9.3 → 1.9.6

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.
@@ -28,10 +28,22 @@ type MetaEndpoints = BaseEndpoint & {
28
28
  type DepositEndpoints = BaseEndpoint & {
29
29
  initiateRefund: string | EndpointFunction;
30
30
  };
31
+ type UserEndpoints = BaseEndpoint & {
32
+ changeProfilePicture: EndpointFunction;
33
+ deleteProfilePicture: EndpointFunction;
34
+ };
35
+ type TicketEndpoints = BaseEndpoint & {
36
+ getMyTickets: string;
37
+ getUserTickets: EndpointFunction;
38
+ getAgentTickets: EndpointFunction;
39
+ };
40
+ type DealDriveEndpoints = BaseEndpoint & {
41
+ getAllMakes: EndpointFunction;
42
+ getAllModels: EndpointFunction;
43
+ };
31
44
  type APIEndpointType = {
32
45
  vehicle: VehicleEndpoints;
33
46
  blogs: BlogEndpoints;
34
- vehicleDetails: BaseEndpoint;
35
47
  vehicleFinance: BaseEndpoint;
36
48
  TestDrive: BaseEndpoint;
37
49
  vehicleMake: BaseEndpoint;
@@ -42,7 +54,6 @@ type APIEndpointType = {
42
54
  vehicleFeatures: BaseEndpoint;
43
55
  vehicleFeatureCategories: BaseEndpoint;
44
56
  vehicleType: BaseEndpoint;
45
- carOptions: BaseEndpoint;
46
57
  payment: BaseEndpoint;
47
58
  deposit: DepositEndpoints;
48
59
  agents: BaseEndpoint;
@@ -54,9 +65,10 @@ type APIEndpointType = {
54
65
  leads: BaseEndpoint;
55
66
  leadPreferences: BaseEndpoint;
56
67
  googleReview: BaseEndpoint;
57
- tickets: BaseEndpoint;
58
- user: BaseEndpoint;
68
+ tickets: TicketEndpoints;
69
+ user: UserEndpoints;
59
70
  faq: BaseEndpoint;
71
+ dealDrive: DealDriveEndpoints;
60
72
  };
61
73
  export declare const API_ENDPOINTS: APIEndpointType;
62
74
  export declare const UTIL_ENDPOINTS: {
@@ -71,6 +83,10 @@ export declare const UTIL_ENDPOINTS: {
71
83
  export declare const AUTH_ENDPOINTS: {
72
84
  login: string;
73
85
  register: string;
74
- getLoggedInUser: string;
86
+ refreshAccessToken: string;
87
+ sendPhoneVerificationCode: string;
88
+ verifyPhoneAndLogin: string;
89
+ verifyAnyPhoneNumber: string;
90
+ checkPhoneNumberExists: string;
75
91
  };
76
92
  export {};
@@ -17,13 +17,6 @@ exports.API_ENDPOINTS = {
17
17
  markVehicleSold: (id) => `/vehicle/mark-vehicle-sold/${id}`,
18
18
  markVehicleDraft: (id) => `/vehicle/mark-vehicle-draft/${id}`,
19
19
  },
20
- vehicleDetails: {
21
- getAll: `/vehicledetails`,
22
- create: `/vehicledetails`,
23
- getOne: (id) => `/vehicledetails/${id}`,
24
- deleteOne: (id) => `/vehicledetails/${id}`,
25
- updateOne: (id) => `/vehicledetails/${id}`,
26
- },
27
20
  vehicleFinance: {
28
21
  getAll: `/vehicle-finance`,
29
22
  create: `/vehicle-finance`,
@@ -78,11 +71,11 @@ exports.API_ENDPOINTS = {
78
71
  updateOne: (id) => `/test-drive-requests/${id}`,
79
72
  },
80
73
  vehicleOrder: {
81
- getAll: `/vehicleorder`,
82
- create: `/vehicleorder`,
83
- getOne: (id) => `/vehicleorder/${id}`,
84
- deleteOne: (id) => `/vehicleorder/${id}`,
85
- updateOne: (id) => `/vehicleorder/${id}`,
74
+ getAll: `/vehicle-order`,
75
+ create: `/vehicle-order`,
76
+ getOne: (id) => `/vehicle-order/${id}`,
77
+ deleteOne: (id) => `/vehicle-order/${id}`,
78
+ updateOne: (id) => `/vehicle-order/${id}`,
86
79
  },
87
80
  vehicleType: {
88
81
  getAll: `/vehicle/body-types`,
@@ -98,13 +91,6 @@ exports.API_ENDPOINTS = {
98
91
  deleteOne: (id) => `/vehicle-inspection/${id}`,
99
92
  updateOne: (id) => `/vehicle-inspection/${id}`,
100
93
  },
101
- carOptions: {
102
- getAll: `/caroptions`,
103
- create: `/caroptions`,
104
- getOne: (id) => `/caroptions/${id}`,
105
- deleteOne: (id) => `/caroptions/${id}`,
106
- updateOne: (id) => `/caroptions/${id}`,
107
- },
108
94
  payment: {
109
95
  getAll: `/payment`,
110
96
  create: `/payment`,
@@ -190,6 +176,8 @@ exports.API_ENDPOINTS = {
190
176
  getOne: (id) => `/user/${id}`,
191
177
  deleteOne: (id) => `/user/${id}`,
192
178
  updateOne: (id) => `/user/${id}`,
179
+ changeProfilePicture: (id) => `/user/${id}/profile-pic`,
180
+ deleteProfilePicture: (id) => `/user/${id}/profile-pic`,
193
181
  },
194
182
  googleReview: {
195
183
  getAll: `/google-reviews`,
@@ -204,6 +192,9 @@ exports.API_ENDPOINTS = {
204
192
  getOne: (id) => `/tickets/${id}`,
205
193
  deleteOne: (id) => `/tickets/${id}`,
206
194
  updateOne: (id) => `/tickets/${id}`,
195
+ getMyTickets: `/tickets/my`,
196
+ getUserTickets: (userId) => `/tickets/user/${userId}`,
197
+ getAgentTickets: (userId) => `/tickets/agent/${userId}`,
207
198
  },
208
199
  faq: {
209
200
  getAll: `/faqs`,
@@ -211,19 +202,34 @@ exports.API_ENDPOINTS = {
211
202
  getOne: (id) => `/faqs/${id}`,
212
203
  deleteOne: (id) => `/faqs/${id}`,
213
204
  updateOne: (id) => `/faqs/${id}`,
214
- }
205
+ },
206
+ dealDrive: {
207
+ getAll: `/deal-drive`,
208
+ create: `/deal-drive`,
209
+ getOne: (id) => `/deal-drive/${id}`,
210
+ deleteOne: (id) => `/deal-drive/${id}`,
211
+ updateOne: (id) => `/deal-drive/${id}`,
212
+ getAllMakes: (id) => `/deal-drive/brands`,
213
+ getAllModels: (id) => `/deal-drive/models`,
214
+ },
215
215
  };
216
+ const utilRoutePrefix = "/utils";
216
217
  exports.UTIL_ENDPOINTS = {
217
218
  media: {
218
- createS3Url: "/utils/get-upload-url",
219
- preprocessMediaUrl: "/utils/process-media",
220
- removeS3Media: '/utils/remove-s3',
221
- removeVehicleMedia: '/utils/remove-vehcile-media',
222
- removeByIdentifier: '/utils/remove-by-identifier'
219
+ createS3Url: `${utilRoutePrefix}/get-upload-url`,
220
+ preprocessMediaUrl: `${utilRoutePrefix}/process-media`,
221
+ removeS3Media: `${utilRoutePrefix}/remove-s3`,
222
+ removeVehicleMedia: `${utilRoutePrefix}/remove-vehcile-media`,
223
+ removeByIdentifier: `${utilRoutePrefix}/remove-by-identifier`
223
224
  },
224
225
  };
226
+ const authRoutePrefix = "/auth";
225
227
  exports.AUTH_ENDPOINTS = {
226
- login: "/auth/login",
227
- register: "/auth/register",
228
- getLoggedInUser: "/auth/me",
228
+ login: `${authRoutePrefix}/login`,
229
+ register: `${authRoutePrefix}/register`,
230
+ refreshAccessToken: `${authRoutePrefix}/refresh-token`,
231
+ sendPhoneVerificationCode: `${authRoutePrefix}/phone/send-verification`,
232
+ verifyPhoneAndLogin: `${authRoutePrefix}/phone/verify-and-login`,
233
+ verifyAnyPhoneNumber: `${authRoutePrefix}/phone/verify`,
234
+ checkPhoneNumberExists: `${authRoutePrefix}/phone/check`,
229
235
  };
@@ -40,6 +40,15 @@ export declare class GoogleReviewResponseDTO {
40
40
  }
41
41
  export declare class ReviewGetDTO {
42
42
  id: string;
43
+ placeId?: string;
44
+ platform?: ReviewPlatform;
45
+ comment?: string;
46
+ username?: string;
47
+ showPublic?: boolean;
48
+ minRating?: number;
49
+ maxRating?: number;
50
+ skip?: number;
51
+ take?: number;
43
52
  filters?: ReviewFilter;
44
53
  options?: ReviewOptions;
45
54
  validate(): string[];
@@ -181,6 +181,68 @@ __decorate([
181
181
  (0, class_validator_1.IsOptional)(),
182
182
  __metadata("design:type", String)
183
183
  ], ReviewGetDTO.prototype, "id", void 0);
184
+ __decorate([
185
+ (0, class_validator_1.IsString)(),
186
+ (0, class_validator_1.IsOptional)(),
187
+ __metadata("design:type", String)
188
+ ], ReviewGetDTO.prototype, "placeId", void 0);
189
+ __decorate([
190
+ (0, class_validator_1.IsEnum)(enums_1.ReviewPlatform),
191
+ (0, class_validator_1.IsOptional)(),
192
+ __metadata("design:type", String)
193
+ ], ReviewGetDTO.prototype, "platform", void 0);
194
+ __decorate([
195
+ (0, class_validator_1.IsString)(),
196
+ (0, class_validator_1.IsOptional)(),
197
+ __metadata("design:type", String)
198
+ ], ReviewGetDTO.prototype, "comment", void 0);
199
+ __decorate([
200
+ (0, class_validator_1.IsString)(),
201
+ (0, class_validator_1.IsOptional)(),
202
+ __metadata("design:type", String)
203
+ ], ReviewGetDTO.prototype, "username", void 0);
204
+ __decorate([
205
+ (0, class_validator_1.IsBoolean)(),
206
+ (0, class_validator_1.IsOptional)(),
207
+ (0, class_transformer_1.Transform)(({ value }) => {
208
+ if (value === 'true')
209
+ return true;
210
+ if (value === 'false')
211
+ return false;
212
+ return value;
213
+ }),
214
+ __metadata("design:type", Boolean)
215
+ ], ReviewGetDTO.prototype, "showPublic", void 0);
216
+ __decorate([
217
+ (0, class_validator_1.IsNumber)(),
218
+ (0, class_validator_1.IsOptional)(),
219
+ (0, class_validator_1.Min)(1),
220
+ (0, class_validator_1.Max)(5),
221
+ (0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
222
+ __metadata("design:type", Number)
223
+ ], ReviewGetDTO.prototype, "minRating", void 0);
224
+ __decorate([
225
+ (0, class_validator_1.IsNumber)(),
226
+ (0, class_validator_1.IsOptional)(),
227
+ (0, class_validator_1.Min)(1),
228
+ (0, class_validator_1.Max)(5),
229
+ (0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
230
+ __metadata("design:type", Number)
231
+ ], ReviewGetDTO.prototype, "maxRating", void 0);
232
+ __decorate([
233
+ (0, class_validator_1.IsNumber)(),
234
+ (0, class_validator_1.IsOptional)(),
235
+ (0, class_validator_1.Min)(0),
236
+ (0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
237
+ __metadata("design:type", Number)
238
+ ], ReviewGetDTO.prototype, "skip", void 0);
239
+ __decorate([
240
+ (0, class_validator_1.IsNumber)(),
241
+ (0, class_validator_1.IsOptional)(),
242
+ (0, class_validator_1.Min)(1),
243
+ (0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : undefined),
244
+ __metadata("design:type", Number)
245
+ ], ReviewGetDTO.prototype, "take", void 0);
184
246
  exports.ReviewGetDTO = ReviewGetDTO;
185
247
  class ReviewFilter {
186
248
  }
@@ -2,7 +2,9 @@ export declare class GetSimilarVehiclesDTO {
2
2
  vehicleId: string;
3
3
  makeId?: string;
4
4
  modelId?: string;
5
- priceRange?: number;
5
+ priceRangePercentage?: number;
6
+ mileageRange?: number;
7
+ yearRange?: number;
6
8
  limit?: number;
7
9
  options?: Record<string, any>;
8
10
  static fromPlain(data: any): GetSimilarVehiclesDTO;
@@ -5,7 +5,7 @@ class GetSimilarVehiclesDTO {
5
5
  static fromPlain(data) {
6
6
  const dto = new GetSimilarVehiclesDTO();
7
7
  dto.vehicleId = data.vehicleId;
8
- dto.priceRange = data.priceRange;
8
+ dto.priceRangePercentage = data.priceRange;
9
9
  dto.limit = data.limit;
10
10
  dto.options = data.options;
11
11
  dto.makeId = data.makeId;
@@ -17,9 +17,17 @@ class GetSimilarVehiclesDTO {
17
17
  if (!this.vehicleId) {
18
18
  errors.push("Vehicle ID is required");
19
19
  }
20
- if (this.priceRange !== undefined &&
21
- (isNaN(this.priceRange) || this.priceRange < 0)) {
22
- errors.push("Price range must be a positive number");
20
+ if (this.priceRangePercentage !== undefined &&
21
+ (isNaN(this.priceRangePercentage) || this.priceRangePercentage < 0 || this.priceRangePercentage > 100)) {
22
+ errors.push("Price range percentage must be a positive number between 0 and 100");
23
+ }
24
+ if (this.mileageRange !== undefined &&
25
+ (isNaN(this.mileageRange) || this.mileageRange < 0)) {
26
+ errors.push("Mileage range must be a positive number");
27
+ }
28
+ if (this.yearRange !== undefined &&
29
+ (isNaN(this.yearRange) || this.yearRange < 0)) {
30
+ errors.push("Year range must be a positive number");
23
31
  }
24
32
  if (this.limit !== undefined && (isNaN(this.limit) || this.limit < 1)) {
25
33
  errors.push("Limit must be a positive number");
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.9.3",
6
+ "version": "1.9.6",
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",