@alba-cars/common-modules 1.5.7 → 1.5.8

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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Formats a number as UAE Dirham (AED) currency with proper comma separation
3
+ * @param amount The numeric value to be formatted
4
+ * @param options Optional configuration for formatting
5
+ * @returns Formatted currency string
6
+ */
7
+ export declare const formatCurrency: (amount?: number | null, options?: {
8
+ currency?: string;
9
+ minimumFractionDigits?: number;
10
+ maximumFractionDigits?: number;
11
+ }) => string;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatCurrency = void 0;
4
+ /**
5
+ * Formats a number as UAE Dirham (AED) currency with proper comma separation
6
+ * @param amount The numeric value to be formatted
7
+ * @param options Optional configuration for formatting
8
+ * @returns Formatted currency string
9
+ */
10
+ const formatCurrency = (amount, options = {}) => {
11
+ // If amount is null or undefined, return 'N/A'
12
+ if (amount == null)
13
+ return 'N/A';
14
+ // Default options
15
+ const { currency = 'AED', minimumFractionDigits = 0, maximumFractionDigits = 0 } = options;
16
+ try {
17
+ // Use English locale to ensure consistent formatting
18
+ const formatter = new Intl.NumberFormat('en-US', {
19
+ minimumFractionDigits,
20
+ maximumFractionDigits,
21
+ useGrouping: true
22
+ });
23
+ // Format the number with comma separation
24
+ const formattedAmount = formatter.format(amount);
25
+ // Prepend AED to the formatted amount
26
+ return `AED ${formattedAmount}`;
27
+ }
28
+ catch (error) {
29
+ // Fallback formatting if Intl.NumberFormat fails
30
+ console.warn('Currency formatting failed, using basic formatting', error);
31
+ // Basic fallback formatting
32
+ const baseFormatted = amount.toLocaleString('en-US', {
33
+ minimumFractionDigits,
34
+ maximumFractionDigits
35
+ });
36
+ return `AED ${baseFormatted}`;
37
+ }
38
+ };
39
+ exports.formatCurrency = formatCurrency;
@@ -1,3 +1,4 @@
1
1
  export * from "./global-utils";
2
2
  export * from "./global-constants";
3
3
  export * from "./global_validators";
4
+ export * from "./formatCurrency";
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./global-utils"), exports);
18
18
  __exportStar(require("./global-constants"), exports);
19
19
  __exportStar(require("./global_validators"), exports);
20
+ __exportStar(require("./formatCurrency"), exports);
@@ -26,6 +26,7 @@ export declare class GoogleReviewResponseDTO {
26
26
  data: GoogleReviewDTO[];
27
27
  }
28
28
  export declare class ReviewGetDTO {
29
+ id?: string;
29
30
  placeId?: string;
30
31
  platform?: ReviewPlatform;
31
32
  comment?: string;
@@ -108,6 +108,11 @@ class GoogleReviewResponseDTO {
108
108
  exports.GoogleReviewResponseDTO = GoogleReviewResponseDTO;
109
109
  class ReviewGetDTO {
110
110
  }
111
+ __decorate([
112
+ (0, class_validator_1.IsString)(),
113
+ (0, class_validator_1.IsOptional)(),
114
+ __metadata("design:type", String)
115
+ ], ReviewGetDTO.prototype, "id", void 0);
111
116
  __decorate([
112
117
  (0, class_validator_1.IsString)(),
113
118
  (0, class_validator_1.IsOptional)(),
@@ -8,6 +8,8 @@ export declare class LeadPreferencesDTO {
8
8
  preferredModel?: string;
9
9
  preferredYearMin?: number;
10
10
  preferredYearMax?: number;
11
+ mileageMin?: number;
12
+ mileageMax?: number;
11
13
  preferredColors?: string[];
12
14
  preferredFeatures?: string[];
13
15
  additionalPreferences?: string;
@@ -22,6 +24,8 @@ export declare class LeadPreferencesUpdateDTO {
22
24
  preferredModel?: string;
23
25
  preferredYearMin?: number;
24
26
  preferredYearMax?: number;
27
+ mileageMin?: number;
28
+ mileageMax?: number;
25
29
  preferredColors?: string[];
26
30
  preferredFeatures?: string[];
27
31
  additionalPreferences?: string;
@@ -36,6 +40,8 @@ export declare class LeadPreferencesCreateDTO {
36
40
  preferredModel?: string;
37
41
  preferredYearMin?: number;
38
42
  preferredYearMax?: number;
43
+ mileageMin?: number;
44
+ mileageMax?: number;
39
45
  preferredColors?: string[];
40
46
  preferredFeatures?: string[];
41
47
  additionalPreferences?: string;
@@ -49,6 +55,7 @@ export declare class LeadPreferencesFilter extends TypedFilter {
49
55
  make?: string;
50
56
  model?: string;
51
57
  yearRange?: Range;
58
+ mileageRange?: Range;
52
59
  colors?: string[];
53
60
  features?: string[];
54
61
  search?: string;
@@ -60,6 +60,16 @@ __decorate([
60
60
  (0, class_validator_1.IsNumber)(),
61
61
  __metadata("design:type", Number)
62
62
  ], LeadPreferencesDTO.prototype, "preferredYearMax", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsOptional)(),
65
+ (0, class_validator_1.IsNumber)(),
66
+ __metadata("design:type", Number)
67
+ ], LeadPreferencesDTO.prototype, "mileageMin", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.IsNumber)(),
71
+ __metadata("design:type", Number)
72
+ ], LeadPreferencesDTO.prototype, "mileageMax", void 0);
63
73
  __decorate([
64
74
  (0, class_validator_1.IsOptional)(),
65
75
  (0, class_validator_1.IsArray)(),
@@ -120,6 +130,16 @@ __decorate([
120
130
  (0, class_validator_1.IsNumber)(),
121
131
  __metadata("design:type", Number)
122
132
  ], LeadPreferencesUpdateDTO.prototype, "preferredYearMax", void 0);
133
+ __decorate([
134
+ (0, class_validator_1.IsOptional)(),
135
+ (0, class_validator_1.IsNumber)(),
136
+ __metadata("design:type", Number)
137
+ ], LeadPreferencesUpdateDTO.prototype, "mileageMin", void 0);
138
+ __decorate([
139
+ (0, class_validator_1.IsOptional)(),
140
+ (0, class_validator_1.IsNumber)(),
141
+ __metadata("design:type", Number)
142
+ ], LeadPreferencesUpdateDTO.prototype, "mileageMax", void 0);
123
143
  __decorate([
124
144
  (0, class_validator_1.IsOptional)(),
125
145
  (0, class_validator_1.IsArray)(),
@@ -180,6 +200,16 @@ __decorate([
180
200
  (0, class_validator_1.IsNumber)(),
181
201
  __metadata("design:type", Number)
182
202
  ], LeadPreferencesCreateDTO.prototype, "preferredYearMax", void 0);
203
+ __decorate([
204
+ (0, class_validator_1.IsOptional)(),
205
+ (0, class_validator_1.IsNumber)(),
206
+ __metadata("design:type", Number)
207
+ ], LeadPreferencesCreateDTO.prototype, "mileageMin", void 0);
208
+ __decorate([
209
+ (0, class_validator_1.IsOptional)(),
210
+ (0, class_validator_1.IsNumber)(),
211
+ __metadata("design:type", Number)
212
+ ], LeadPreferencesCreateDTO.prototype, "mileageMax", void 0);
183
213
  __decorate([
184
214
  (0, class_validator_1.IsOptional)(),
185
215
  (0, class_validator_1.IsArray)(),
@@ -227,6 +257,12 @@ __decorate([
227
257
  (0, class_transformer_1.Type)(() => core_1.Range),
228
258
  __metadata("design:type", core_1.Range)
229
259
  ], LeadPreferencesFilter.prototype, "yearRange", void 0);
260
+ __decorate([
261
+ (0, class_validator_1.IsOptional)(),
262
+ (0, class_validator_1.ValidateNested)(),
263
+ (0, class_transformer_1.Type)(() => core_1.Range),
264
+ __metadata("design:type", core_1.Range)
265
+ ], LeadPreferencesFilter.prototype, "mileageRange", void 0);
230
266
  __decorate([
231
267
  (0, class_validator_1.IsOptional)(),
232
268
  (0, class_validator_1.IsArray)(),
@@ -11,6 +11,7 @@ export declare class SalesAgentGetDTO {
11
11
  user: UserGetDTO;
12
12
  languages: LanguageDTO[];
13
13
  agentIntro?: string;
14
+ photo?: string;
14
15
  static fromPlain(plain: Record<string, unknown>): SalesAgentGetDTO;
15
16
  toPlain(): Record<string, unknown>;
16
17
  }
@@ -26,6 +26,11 @@ class SalesAgentGetDTO {
26
26
  return (0, class_transformer_1.classToPlain)(this);
27
27
  }
28
28
  }
29
+ __decorate([
30
+ (0, class_validator_1.IsOptional)(),
31
+ (0, class_validator_1.IsString)(),
32
+ __metadata("design:type", String)
33
+ ], SalesAgentGetDTO.prototype, "photo", void 0);
29
34
  exports.SalesAgentGetDTO = SalesAgentGetDTO;
30
35
  class SalesAgentCreateDTO {
31
36
  constructor() {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.5.7",
6
+ "version": "1.5.8",
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",