@alba-cars/common-modules 1.5.2 → 1.5.4

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.
@@ -1,4 +1,5 @@
1
- export interface GoogleReviewCreateDTO {
1
+ import { ReviewPlatform } from "../enums";
2
+ export interface GoogleApiReviewDTO {
2
3
  authorName: string;
3
4
  authorUrl?: string;
4
5
  profilePhotoUrl?: string;
@@ -8,31 +9,50 @@ export interface GoogleReviewCreateDTO {
8
9
  relativeTimeDescription: string;
9
10
  placeId: string;
10
11
  }
11
- export interface GoogleReviewUpdateDTO {
12
+ export interface ReviewCreateDTO {
13
+ username: string;
14
+ rating: number;
15
+ comment: string;
16
+ date: Date;
17
+ platform: ReviewPlatform;
18
+ showPublic: boolean;
19
+ authorUrl?: string;
20
+ profilePhotoUrl?: string;
21
+ placeId?: string;
22
+ relativeTimeDescription?: string;
23
+ }
24
+ export interface ReviewUpdateDTO {
12
25
  rating?: number;
13
- text?: string;
26
+ comment?: string;
27
+ showPublic?: boolean;
14
28
  }
15
- export interface GoogleReviewGetUniqueDTO {
29
+ export interface ReviewGetUniqueDTO {
16
30
  id?: string;
17
- authorName?: string;
31
+ username?: string;
18
32
  placeId?: string;
33
+ platform?: ReviewPlatform;
19
34
  }
20
- export interface GoogleReviewGetDTO {
21
- placeId: string;
35
+ export interface ReviewGetDTO {
36
+ placeId?: string;
37
+ platform?: ReviewPlatform;
22
38
  minRating?: number;
23
39
  maxRating?: number;
24
- authorName?: string;
40
+ username?: string;
41
+ showPublic?: boolean;
25
42
  limit?: number;
26
43
  page?: number;
27
44
  }
28
- export interface GoogleReview {
45
+ export interface ReviewResponseDTO {
29
46
  id: string;
30
- authorName: string;
47
+ username: string;
48
+ rating: number;
49
+ comment: string;
50
+ date: Date;
51
+ platform: ReviewPlatform;
52
+ showPublic: boolean;
31
53
  authorUrl?: string;
32
54
  profilePhotoUrl?: string;
33
- rating: number;
34
- text: string;
35
- time: number;
36
- relativeTimeDescription: string;
37
- placeId: string;
55
+ placeId?: string;
56
+ relativeTimeDescription?: string;
38
57
  }
58
+ export declare function convertGoogleApiToReviewCreate(googleReview: GoogleApiReviewDTO): ReviewCreateDTO;
@@ -1,2 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertGoogleApiToReviewCreate = void 0;
4
+ const enums_1 = require("../enums");
5
+ // Helper function to convert Google API review to database format
6
+ function convertGoogleApiToReviewCreate(googleReview) {
7
+ return {
8
+ username: googleReview.authorName,
9
+ rating: googleReview.rating,
10
+ comment: googleReview.text,
11
+ date: new Date(googleReview.time * 1000),
12
+ platform: enums_1.ReviewPlatform.GOOGLE,
13
+ showPublic: true,
14
+ authorUrl: googleReview.authorUrl,
15
+ profilePhotoUrl: googleReview.profilePhotoUrl,
16
+ placeId: googleReview.placeId,
17
+ relativeTimeDescription: googleReview.relativeTimeDescription
18
+ };
19
+ }
20
+ exports.convertGoogleApiToReviewCreate = convertGoogleApiToReviewCreate;
@@ -1,2 +1,2 @@
1
- import { GoogleReviewCreateDTO, GoogleReview, GoogleReviewGetDTO, GoogleReviewGetUniqueDTO, GoogleReviewUpdateDTO } from "./GoogleReviewDTO";
2
- export { GoogleReviewCreateDTO, GoogleReview, GoogleReviewGetDTO, GoogleReviewGetUniqueDTO, GoogleReviewUpdateDTO, };
1
+ import { GoogleApiReviewDTO, ReviewCreateDTO, ReviewUpdateDTO, ReviewGetUniqueDTO, ReviewGetDTO, ReviewResponseDTO } from "./GoogleReviewDTO";
2
+ export { GoogleApiReviewDTO, ReviewCreateDTO, ReviewUpdateDTO, ReviewGetUniqueDTO, ReviewGetDTO, ReviewResponseDTO, };
@@ -0,0 +1,4 @@
1
+ export declare enum ReviewPlatform {
2
+ GOOGLE = "Google",
3
+ DUBAI_REVIEW = "DubaiReview"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReviewPlatform = void 0;
4
+ var ReviewPlatform;
5
+ (function (ReviewPlatform) {
6
+ ReviewPlatform["GOOGLE"] = "Google";
7
+ ReviewPlatform["DUBAI_REVIEW"] = "DubaiReview";
8
+ })(ReviewPlatform = exports.ReviewPlatform || (exports.ReviewPlatform = {}));
@@ -1 +1,2 @@
1
1
  export * from './dto';
2
+ export * from "./enums/index";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./dto"), exports);
18
+ __exportStar(require("./enums/index"), exports);
@@ -1,6 +1,8 @@
1
1
  import { LeadStatus } from "../enum/lead_status_type";
2
2
  import { LeadSource } from "../enum/lead_source_status_types";
3
3
  import { LeadPreferencesDTO } from "./lead_prefernce_dto";
4
+ import { TypedFilter, TypedOptions } from "../../../../global/utilities";
5
+ import { BaseGetDTO } from "../../../../global";
4
6
  export declare class LeadDTO {
5
7
  id?: string;
6
8
  firstName: string;
@@ -24,3 +26,40 @@ export declare class LeadDTO {
24
26
  static fromPlain(plain: Record<string, unknown>): LeadDTO;
25
27
  toPlain(): Record<string, unknown>;
26
28
  }
29
+ export declare class LeadUpdateDTO {
30
+ firstName?: string;
31
+ lastName?: string;
32
+ email?: string;
33
+ phone?: string;
34
+ alternatePhone?: string;
35
+ address?: string;
36
+ city?: string;
37
+ state?: string;
38
+ zipCode?: string;
39
+ status?: LeadStatus;
40
+ notes?: string;
41
+ leadSource?: LeadSource;
42
+ isTestDriveScheduled?: boolean;
43
+ testDriveDate?: Date;
44
+ isActive?: boolean;
45
+ preference?: LeadPreferencesDTO;
46
+ validate(): string[];
47
+ static fromPlain(plain: Record<string, unknown>): LeadUpdateDTO;
48
+ toPlain(): Record<string, unknown>;
49
+ }
50
+ export declare class LeadFilter extends TypedFilter {
51
+ id?: string | string[];
52
+ firstName?: string | string[];
53
+ lastName?: string | string[];
54
+ email?: string | string[];
55
+ phone?: string | string[];
56
+ status?: LeadStatus | LeadStatus[];
57
+ leadSource?: LeadSource | LeadSource[];
58
+ isTestDriveScheduled?: boolean;
59
+ isActive?: boolean;
60
+ lastContactedAt?: Date;
61
+ }
62
+ export declare class LeadGetDTO extends BaseGetDTO<LeadDTO, LeadFilter> {
63
+ filters?: LeadFilter;
64
+ options?: TypedOptions<LeadDTO>;
65
+ }
@@ -9,10 +9,14 @@ 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.LeadDTO = void 0;
12
+ exports.LeadGetDTO = exports.LeadFilter = exports.LeadUpdateDTO = exports.LeadDTO = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
+ const lead_status_type_1 = require("../enum/lead_status_type");
15
+ const lead_source_status_types_1 = require("../enum/lead_source_status_types");
14
16
  const lead_prefernce_dto_1 = require("./lead_prefernce_dto");
15
17
  const class_transformer_1 = require("class-transformer");
18
+ const utilities_1 = require("../../../../global/utilities");
19
+ const global_1 = require("../../../../global");
16
20
  class LeadDTO {
17
21
  validate() {
18
22
  const errors = (0, class_validator_1.validateSync)(this);
@@ -101,3 +105,169 @@ __decorate([
101
105
  __metadata("design:type", lead_prefernce_dto_1.LeadPreferencesDTO)
102
106
  ], LeadDTO.prototype, "preference", void 0);
103
107
  exports.LeadDTO = LeadDTO;
108
+ class LeadUpdateDTO {
109
+ validate() {
110
+ const errors = (0, class_validator_1.validateSync)(this);
111
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
112
+ }
113
+ static fromPlain(plain) {
114
+ return (0, class_transformer_1.plainToClass)(LeadUpdateDTO, plain);
115
+ }
116
+ toPlain() {
117
+ return (0, class_transformer_1.classToPlain)(this);
118
+ }
119
+ }
120
+ __decorate([
121
+ (0, class_validator_1.IsString)(),
122
+ (0, class_validator_1.MinLength)(2),
123
+ (0, class_validator_1.IsOptional)(),
124
+ __metadata("design:type", String)
125
+ ], LeadUpdateDTO.prototype, "firstName", void 0);
126
+ __decorate([
127
+ (0, class_validator_1.IsString)(),
128
+ (0, class_validator_1.MinLength)(2),
129
+ (0, class_validator_1.IsOptional)(),
130
+ __metadata("design:type", String)
131
+ ], LeadUpdateDTO.prototype, "lastName", void 0);
132
+ __decorate([
133
+ (0, class_validator_1.IsOptional)(),
134
+ (0, class_validator_1.IsString)(),
135
+ __metadata("design:type", String)
136
+ ], LeadUpdateDTO.prototype, "email", void 0);
137
+ __decorate([
138
+ (0, class_validator_1.IsString)(),
139
+ (0, class_validator_1.MinLength)(8),
140
+ (0, class_validator_1.IsOptional)(),
141
+ __metadata("design:type", String)
142
+ ], LeadUpdateDTO.prototype, "phone", void 0);
143
+ __decorate([
144
+ (0, class_validator_1.IsString)(),
145
+ (0, class_validator_1.IsOptional)(),
146
+ __metadata("design:type", String)
147
+ ], LeadUpdateDTO.prototype, "alternatePhone", void 0);
148
+ __decorate([
149
+ (0, class_validator_1.IsString)(),
150
+ (0, class_validator_1.IsOptional)(),
151
+ __metadata("design:type", String)
152
+ ], LeadUpdateDTO.prototype, "address", void 0);
153
+ __decorate([
154
+ (0, class_validator_1.IsString)(),
155
+ (0, class_validator_1.IsOptional)(),
156
+ __metadata("design:type", String)
157
+ ], LeadUpdateDTO.prototype, "city", void 0);
158
+ __decorate([
159
+ (0, class_validator_1.IsString)(),
160
+ (0, class_validator_1.IsOptional)(),
161
+ __metadata("design:type", String)
162
+ ], LeadUpdateDTO.prototype, "state", void 0);
163
+ __decorate([
164
+ (0, class_validator_1.IsString)(),
165
+ (0, class_validator_1.IsOptional)(),
166
+ __metadata("design:type", String)
167
+ ], LeadUpdateDTO.prototype, "zipCode", void 0);
168
+ __decorate([
169
+ (0, class_validator_1.IsEnum)(lead_status_type_1.LeadStatus),
170
+ (0, class_validator_1.IsOptional)(),
171
+ __metadata("design:type", String)
172
+ ], LeadUpdateDTO.prototype, "status", void 0);
173
+ __decorate([
174
+ (0, class_validator_1.IsString)(),
175
+ (0, class_validator_1.IsOptional)(),
176
+ __metadata("design:type", String)
177
+ ], LeadUpdateDTO.prototype, "notes", void 0);
178
+ __decorate([
179
+ (0, class_validator_1.IsEnum)(lead_source_status_types_1.LeadSource),
180
+ (0, class_validator_1.IsOptional)(),
181
+ __metadata("design:type", String)
182
+ ], LeadUpdateDTO.prototype, "leadSource", void 0);
183
+ __decorate([
184
+ (0, class_validator_1.IsBoolean)(),
185
+ (0, class_validator_1.IsOptional)(),
186
+ __metadata("design:type", Boolean)
187
+ ], LeadUpdateDTO.prototype, "isTestDriveScheduled", void 0);
188
+ __decorate([
189
+ (0, class_validator_1.IsDate)(),
190
+ (0, class_validator_1.IsOptional)(),
191
+ __metadata("design:type", Date)
192
+ ], LeadUpdateDTO.prototype, "testDriveDate", void 0);
193
+ __decorate([
194
+ (0, class_validator_1.IsBoolean)(),
195
+ (0, class_validator_1.IsOptional)(),
196
+ __metadata("design:type", Boolean)
197
+ ], LeadUpdateDTO.prototype, "isActive", void 0);
198
+ __decorate([
199
+ (0, class_validator_1.ValidateNested)(),
200
+ (0, class_transformer_1.Type)(() => lead_prefernce_dto_1.LeadPreferencesDTO),
201
+ (0, class_validator_1.IsOptional)(),
202
+ __metadata("design:type", lead_prefernce_dto_1.LeadPreferencesDTO)
203
+ ], LeadUpdateDTO.prototype, "preference", void 0);
204
+ exports.LeadUpdateDTO = LeadUpdateDTO;
205
+ class LeadFilter extends utilities_1.TypedFilter {
206
+ }
207
+ __decorate([
208
+ (0, class_validator_1.IsOptional)(),
209
+ (0, class_validator_1.IsString)({ each: true }),
210
+ __metadata("design:type", Object)
211
+ ], LeadFilter.prototype, "id", void 0);
212
+ __decorate([
213
+ (0, class_validator_1.IsOptional)(),
214
+ (0, class_validator_1.IsString)({ each: true }),
215
+ __metadata("design:type", Object)
216
+ ], LeadFilter.prototype, "firstName", void 0);
217
+ __decorate([
218
+ (0, class_validator_1.IsOptional)(),
219
+ (0, class_validator_1.IsString)({ each: true }),
220
+ __metadata("design:type", Object)
221
+ ], LeadFilter.prototype, "lastName", void 0);
222
+ __decorate([
223
+ (0, class_validator_1.IsOptional)(),
224
+ (0, class_validator_1.IsString)({ each: true }),
225
+ __metadata("design:type", Object)
226
+ ], LeadFilter.prototype, "email", void 0);
227
+ __decorate([
228
+ (0, class_validator_1.IsOptional)(),
229
+ (0, class_validator_1.IsString)({ each: true }),
230
+ __metadata("design:type", Object)
231
+ ], LeadFilter.prototype, "phone", void 0);
232
+ __decorate([
233
+ (0, class_validator_1.IsOptional)(),
234
+ (0, class_validator_1.IsEnum)(lead_status_type_1.LeadStatus, { each: true }),
235
+ __metadata("design:type", Object)
236
+ ], LeadFilter.prototype, "status", void 0);
237
+ __decorate([
238
+ (0, class_validator_1.IsOptional)(),
239
+ (0, class_validator_1.IsEnum)(lead_source_status_types_1.LeadSource, { each: true }),
240
+ __metadata("design:type", Object)
241
+ ], LeadFilter.prototype, "leadSource", void 0);
242
+ __decorate([
243
+ (0, class_validator_1.IsOptional)(),
244
+ (0, class_validator_1.IsBoolean)(),
245
+ __metadata("design:type", Boolean)
246
+ ], LeadFilter.prototype, "isTestDriveScheduled", void 0);
247
+ __decorate([
248
+ (0, class_validator_1.IsOptional)(),
249
+ (0, class_validator_1.IsBoolean)(),
250
+ __metadata("design:type", Boolean)
251
+ ], LeadFilter.prototype, "isActive", void 0);
252
+ __decorate([
253
+ (0, class_validator_1.IsOptional)(),
254
+ (0, class_transformer_1.Type)(() => Date),
255
+ (0, class_validator_1.ValidateNested)(),
256
+ __metadata("design:type", Date)
257
+ ], LeadFilter.prototype, "lastContactedAt", void 0);
258
+ exports.LeadFilter = LeadFilter;
259
+ class LeadGetDTO extends global_1.BaseGetDTO {
260
+ }
261
+ __decorate([
262
+ (0, class_validator_1.ValidateNested)(),
263
+ (0, class_transformer_1.Type)(() => LeadFilter),
264
+ (0, class_validator_1.IsOptional)(),
265
+ __metadata("design:type", LeadFilter)
266
+ ], LeadGetDTO.prototype, "filters", void 0);
267
+ __decorate([
268
+ (0, class_validator_1.ValidateNested)(),
269
+ (0, class_transformer_1.Type)(() => utilities_1.TypedOptions),
270
+ (0, class_validator_1.IsOptional)(),
271
+ __metadata("design:type", utilities_1.TypedOptions)
272
+ ], LeadGetDTO.prototype, "options", void 0);
273
+ exports.LeadGetDTO = LeadGetDTO;
@@ -17,6 +17,7 @@ export declare class VehicleMakeFilter extends BaseFilter {
17
17
  models?: string | string[];
18
18
  vehicles?: string | string[];
19
19
  search?: string;
20
+ promoted?: boolean;
20
21
  validate(): string[];
21
22
  static fromPlain(plain: Record<string, unknown>): VehicleMakeFilter;
22
23
  static toPlain(entity: any): Record<string, unknown>;
@@ -61,6 +61,11 @@ __decorate([
61
61
  (0, class_validator_1.IsString)(),
62
62
  __metadata("design:type", String)
63
63
  ], VehicleMakeFilter.prototype, "search", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsOptional)(),
66
+ (0, class_validator_1.IsBoolean)(),
67
+ __metadata("design:type", Boolean)
68
+ ], VehicleMakeFilter.prototype, "promoted", void 0);
64
69
  exports.VehicleMakeFilter = VehicleMakeFilter;
65
70
  // This filter is used to get a unique vehicle make by unique fields
66
71
  class VehicleMakeUniqueFilter extends global_1.BaseFilter {
@@ -23,6 +23,7 @@ export declare class VehicleMakeCreateDTO extends BaseCreateDTO {
23
23
  metaTitle?: string;
24
24
  metaDescription?: string;
25
25
  metaKeywords?: string;
26
+ promoted?: boolean;
26
27
  validate(): string[];
27
28
  static fromPlain(plain: Record<string, unknown>): VehicleMakeCreateDTO;
28
29
  static toPlain(entity: any): Record<string, unknown>;
@@ -34,6 +35,7 @@ export declare class VehicleMakeUpdateDTO extends BaseUpdateDTO {
34
35
  metaTitle?: string;
35
36
  metaDescription?: string;
36
37
  metaKeywords?: string;
38
+ promoted?: boolean;
37
39
  isActive?: boolean;
38
40
  validate(): string[];
39
41
  static fromPlain(plain: Record<string, unknown>): VehicleMakeUpdateDTO;
@@ -90,6 +90,11 @@ __decorate([
90
90
  (0, class_validator_1.IsOptional)(),
91
91
  __metadata("design:type", String)
92
92
  ], VehicleMakeCreateDTO.prototype, "metaKeywords", void 0);
93
+ __decorate([
94
+ (0, class_validator_1.IsBoolean)(),
95
+ (0, class_validator_1.IsOptional)(),
96
+ __metadata("design:type", Boolean)
97
+ ], VehicleMakeCreateDTO.prototype, "promoted", void 0);
93
98
  exports.VehicleMakeCreateDTO = VehicleMakeCreateDTO;
94
99
  class VehicleMakeUpdateDTO extends BaseDTO_1.BaseUpdateDTO {
95
100
  validate() {
@@ -136,6 +141,11 @@ __decorate([
136
141
  (0, class_validator_1.IsOptional)(),
137
142
  __metadata("design:type", String)
138
143
  ], VehicleMakeUpdateDTO.prototype, "metaKeywords", void 0);
144
+ __decorate([
145
+ (0, class_validator_1.IsBoolean)(),
146
+ (0, class_validator_1.IsOptional)(),
147
+ __metadata("design:type", Boolean)
148
+ ], VehicleMakeUpdateDTO.prototype, "promoted", void 0);
139
149
  __decorate([
140
150
  (0, class_validator_1.IsBoolean)(),
141
151
  (0, class_validator_1.IsOptional)(),
@@ -22,6 +22,7 @@ export declare class VehicleMakeFilter extends BaseFilter {
22
22
  models?: string | string[];
23
23
  vehicles?: string | string[];
24
24
  search?: string;
25
+ promoted?: boolean;
25
26
  validate(): string[];
26
27
  static fromPlain(plain: Record<string, unknown>): VehicleMakeFilter;
27
28
  static toPlain(entity: any): Record<string, unknown>;
@@ -60,6 +60,11 @@ __decorate([
60
60
  (0, class_validator_1.IsString)(),
61
61
  __metadata("design:type", String)
62
62
  ], VehicleMakeFilter.prototype, "search", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsOptional)(),
65
+ (0, class_validator_1.IsBoolean)(),
66
+ __metadata("design:type", Boolean)
67
+ ], VehicleMakeFilter.prototype, "promoted", void 0);
63
68
  exports.VehicleMakeFilter = VehicleMakeFilter;
64
69
  // This filter is used to get a unique vehicle make by unique fields
65
70
  class VehicleMakeUniqueFilter extends utilities_1.BaseFilter {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.5.2",
6
+ "version": "1.5.4",
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",