@alba-cars/common-modules 1.2.0

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.
Files changed (84) hide show
  1. package/README.md +42 -0
  2. package/dist/features/blog/data/dto/BlogDTO.d.ts +41 -0
  3. package/dist/features/blog/data/dto/BlogDTO.js +128 -0
  4. package/dist/features/newsletter/data/dto/NewsletterDTO.d.ts +17 -0
  5. package/dist/features/newsletter/data/dto/NewsletterDTO.js +79 -0
  6. package/dist/features/sales-team/data/dto/SalesAgentDTO.d.ts +47 -0
  7. package/dist/features/sales-team/data/dto/SalesAgentDTO.js +134 -0
  8. package/dist/features/showroom-visit/data/dto/ShowroomVisit.d.ts +28 -0
  9. package/dist/features/showroom-visit/data/dto/ShowroomVisit.js +119 -0
  10. package/dist/features/test-drive-request/data/dto/TestDriveRequestDTO.d.ts +45 -0
  11. package/dist/features/test-drive-request/data/dto/TestDriveRequestDTO.js +163 -0
  12. package/dist/features/test-drive-request/data/enums/index.d.ts +24 -0
  13. package/dist/features/test-drive-request/data/enums/index.js +29 -0
  14. package/dist/features/test-drive-request/data/models/TestDriveRequest.d.ts +14 -0
  15. package/dist/features/test-drive-request/data/models/TestDriveRequest.js +7 -0
  16. package/dist/features/test-drive-request/data/models/index.d.ts +2 -0
  17. package/dist/features/test-drive-request/data/models/index.js +5 -0
  18. package/dist/features/test-drive-request/data/utilities.d.ts +29 -0
  19. package/dist/features/test-drive-request/data/utilities.js +95 -0
  20. package/dist/features/vehicle/data/dto/BaseDTO.d.ts +10 -0
  21. package/dist/features/vehicle/data/dto/BaseDTO.js +42 -0
  22. package/dist/features/vehicle/data/dto/PaymentDTO.d.ts +52 -0
  23. package/dist/features/vehicle/data/dto/PaymentDTO.js +161 -0
  24. package/dist/features/vehicle/data/dto/UserDTO.d.ts +16 -0
  25. package/dist/features/vehicle/data/dto/UserDTO.js +53 -0
  26. package/dist/features/vehicle/data/dto/VehicleDTO.d.ts +103 -0
  27. package/dist/features/vehicle/data/dto/VehicleDTO.js +425 -0
  28. package/dist/features/vehicle/data/dto/VehicleFeatureCategoriesDTO.d.ts +39 -0
  29. package/dist/features/vehicle/data/dto/VehicleFeatureCategoriesDTO.js +114 -0
  30. package/dist/features/vehicle/data/dto/VehicleFeatureDTO.d.ts +38 -0
  31. package/dist/features/vehicle/data/dto/VehicleFeatureDTO.js +121 -0
  32. package/dist/features/vehicle/data/dto/VehicleFinanceDTO.d.ts +46 -0
  33. package/dist/features/vehicle/data/dto/VehicleFinanceDTO.js +143 -0
  34. package/dist/features/vehicle/data/dto/VehicleMakeDTO.d.ts +46 -0
  35. package/dist/features/vehicle/data/dto/VehicleMakeDTO.js +169 -0
  36. package/dist/features/vehicle/data/dto/VehicleMedia.d.ts +28 -0
  37. package/dist/features/vehicle/data/dto/VehicleMedia.js +119 -0
  38. package/dist/features/vehicle/data/dto/VehicleModelDTO.d.ts +52 -0
  39. package/dist/features/vehicle/data/dto/VehicleModelDTO.js +189 -0
  40. package/dist/features/vehicle/data/dto/VehicleOrderDTO.d.ts +34 -0
  41. package/dist/features/vehicle/data/dto/VehicleOrderDTO.js +139 -0
  42. package/dist/features/vehicle/data/dto/VehicleTypeDTO.d.ts +35 -0
  43. package/dist/features/vehicle/data/dto/VehicleTypeDTO.js +102 -0
  44. package/dist/features/vehicle/data/enums/index.d.ts +4 -0
  45. package/dist/features/vehicle/data/enums/index.js +8 -0
  46. package/dist/features/vehicle/data/models/Base.d.ts +12 -0
  47. package/dist/features/vehicle/data/models/Base.js +6 -0
  48. package/dist/features/vehicle/data/models/Payment.d.ts +18 -0
  49. package/dist/features/vehicle/data/models/Payment.js +7 -0
  50. package/dist/features/vehicle/data/models/User.d.ts +15 -0
  51. package/dist/features/vehicle/data/models/User.js +6 -0
  52. package/dist/features/vehicle/data/models/Vehicle.d.ts +42 -0
  53. package/dist/features/vehicle/data/models/Vehicle.js +7 -0
  54. package/dist/features/vehicle/data/models/VehicleBodyType.d.ts +8 -0
  55. package/dist/features/vehicle/data/models/VehicleBodyType.js +7 -0
  56. package/dist/features/vehicle/data/models/VehicleCategory.d.ts +6 -0
  57. package/dist/features/vehicle/data/models/VehicleCategory.js +7 -0
  58. package/dist/features/vehicle/data/models/VehicleFeature.d.ts +8 -0
  59. package/dist/features/vehicle/data/models/VehicleFeature.js +7 -0
  60. package/dist/features/vehicle/data/models/VehicleFeatureCategory.d.ts +6 -0
  61. package/dist/features/vehicle/data/models/VehicleFeatureCategory.js +7 -0
  62. package/dist/features/vehicle/data/models/VehicleFinance.d.ts +16 -0
  63. package/dist/features/vehicle/data/models/VehicleFinance.js +7 -0
  64. package/dist/features/vehicle/data/models/VehicleMake.d.ts +14 -0
  65. package/dist/features/vehicle/data/models/VehicleMake.js +7 -0
  66. package/dist/features/vehicle/data/models/VehicleMedia.d.ts +11 -0
  67. package/dist/features/vehicle/data/models/VehicleMedia.js +7 -0
  68. package/dist/features/vehicle/data/models/VehicleMetaData.d.ts +11 -0
  69. package/dist/features/vehicle/data/models/VehicleMetaData.js +7 -0
  70. package/dist/features/vehicle/data/models/VehicleModel.d.ts +17 -0
  71. package/dist/features/vehicle/data/models/VehicleModel.js +7 -0
  72. package/dist/features/vehicle/data/models/VehicleOrder.d.ts +14 -0
  73. package/dist/features/vehicle/data/models/VehicleOrder.js +7 -0
  74. package/dist/features/vehicle/data/models/index.d.ts +14 -0
  75. package/dist/features/vehicle/data/models/index.js +29 -0
  76. package/dist/features/vehicle/data/utilities.d.ts +209 -0
  77. package/dist/features/vehicle/data/utilities.js +706 -0
  78. package/dist/global/dto/BaseGetDTO.d.ts +8 -0
  79. package/dist/global/dto/BaseGetDTO.js +18 -0
  80. package/dist/global/utilities.d.ts +48 -0
  81. package/dist/global/utilities.js +138 -0
  82. package/dist/index.d.ts +18 -0
  83. package/dist/index.js +34 -0
  84. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Alba Cars DTOs
2
+
3
+ A package containing DTOs, validation classes and common modules and interfaces for Alba Cars
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install github:alba-cars/AlbaCarsCommonModules
9
+ ```
10
+
11
+ ## Usage
12
+
13
+
14
+ ## Development
15
+
16
+ To set up the project for development:
17
+
18
+ 1. Clone the repository:
19
+ ```bash
20
+ git clone https://github.com/alba-cars/AlbaCarsCommonModules.git
21
+ ```
22
+
23
+ 2. Install dependencies:
24
+ ```bash
25
+ npm install
26
+ ```
27
+
28
+ 3. Build the package:
29
+ ```bash
30
+ npm run prepare
31
+ ```
32
+
33
+ This command will compile the TypeScript code into JavaScript in the `dist` directory.
34
+
35
+ 4. Run tests:
36
+ ```bash
37
+ npm test
38
+ ```
39
+
40
+ ## License
41
+
42
+ This project is unlicensed.
@@ -0,0 +1,41 @@
1
+ export declare class BlogGetDTO {
2
+ id: string;
3
+ title: string;
4
+ description: string;
5
+ date: Date;
6
+ imageLink: string;
7
+ imageAlt: string;
8
+ metaDescription: string;
9
+ metaKeywords: string;
10
+ slug: string;
11
+ status: string;
12
+ createdById: string;
13
+ static fromEntity(entity: any): BlogGetDTO;
14
+ toPlain(): Record<string, unknown>;
15
+ }
16
+ export declare class BlogCreateDTO {
17
+ title: string;
18
+ description: string;
19
+ date: Date;
20
+ imageLink: string;
21
+ imageAlt: string;
22
+ metaDescription: string;
23
+ metaKeywords: string;
24
+ slug: string;
25
+ status: string;
26
+ validate(): string[];
27
+ static fromPlain(plain: Record<string, unknown>): BlogCreateDTO;
28
+ }
29
+ export declare class BlogUpdateDTO {
30
+ title?: string;
31
+ description?: string;
32
+ date?: Date;
33
+ imageLink?: string;
34
+ imageAlt?: string;
35
+ metaDescription?: string;
36
+ metaKeywords?: string;
37
+ slug?: string;
38
+ status?: string;
39
+ validate(): string[];
40
+ static fromPlain(plain: Record<string, unknown>): BlogUpdateDTO;
41
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BlogUpdateDTO = exports.BlogCreateDTO = exports.BlogGetDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ class BlogGetDTO {
16
+ static fromEntity(entity) {
17
+ return (0, class_transformer_1.plainToClass)(BlogGetDTO, entity);
18
+ }
19
+ toPlain() {
20
+ return (0, class_transformer_1.classToPlain)(this);
21
+ }
22
+ }
23
+ exports.BlogGetDTO = BlogGetDTO;
24
+ class BlogCreateDTO {
25
+ constructor() {
26
+ this.status = 'draft';
27
+ }
28
+ validate() {
29
+ const errors = (0, class_validator_1.validateSync)(this);
30
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
31
+ }
32
+ static fromPlain(plain) {
33
+ return (0, class_transformer_1.plainToClass)(BlogCreateDTO, plain);
34
+ }
35
+ }
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
38
+ __metadata("design:type", String)
39
+ ], BlogCreateDTO.prototype, "title", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsString)(),
42
+ __metadata("design:type", String)
43
+ ], BlogCreateDTO.prototype, "description", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsDate)(),
46
+ __metadata("design:type", Date)
47
+ ], BlogCreateDTO.prototype, "date", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsString)(),
50
+ __metadata("design:type", String)
51
+ ], BlogCreateDTO.prototype, "imageLink", void 0);
52
+ __decorate([
53
+ (0, class_validator_1.IsString)(),
54
+ __metadata("design:type", String)
55
+ ], BlogCreateDTO.prototype, "imageAlt", void 0);
56
+ __decorate([
57
+ (0, class_validator_1.IsString)(),
58
+ __metadata("design:type", String)
59
+ ], BlogCreateDTO.prototype, "metaDescription", void 0);
60
+ __decorate([
61
+ (0, class_validator_1.IsString)(),
62
+ __metadata("design:type", String)
63
+ ], BlogCreateDTO.prototype, "metaKeywords", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsString)(),
66
+ __metadata("design:type", String)
67
+ ], BlogCreateDTO.prototype, "slug", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.IsString)(),
71
+ __metadata("design:type", String)
72
+ ], BlogCreateDTO.prototype, "status", void 0);
73
+ exports.BlogCreateDTO = BlogCreateDTO;
74
+ class BlogUpdateDTO {
75
+ validate() {
76
+ const errors = (0, class_validator_1.validateSync)(this);
77
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
78
+ }
79
+ static fromPlain(plain) {
80
+ return (0, class_transformer_1.plainToClass)(BlogUpdateDTO, plain);
81
+ }
82
+ }
83
+ __decorate([
84
+ (0, class_validator_1.IsOptional)(),
85
+ (0, class_validator_1.IsString)(),
86
+ __metadata("design:type", String)
87
+ ], BlogUpdateDTO.prototype, "title", void 0);
88
+ __decorate([
89
+ (0, class_validator_1.IsOptional)(),
90
+ (0, class_validator_1.IsString)(),
91
+ __metadata("design:type", String)
92
+ ], BlogUpdateDTO.prototype, "description", void 0);
93
+ __decorate([
94
+ (0, class_validator_1.IsOptional)(),
95
+ (0, class_validator_1.IsDate)(),
96
+ __metadata("design:type", Date)
97
+ ], BlogUpdateDTO.prototype, "date", void 0);
98
+ __decorate([
99
+ (0, class_validator_1.IsOptional)(),
100
+ (0, class_validator_1.IsString)(),
101
+ __metadata("design:type", String)
102
+ ], BlogUpdateDTO.prototype, "imageLink", void 0);
103
+ __decorate([
104
+ (0, class_validator_1.IsOptional)(),
105
+ (0, class_validator_1.IsString)(),
106
+ __metadata("design:type", String)
107
+ ], BlogUpdateDTO.prototype, "imageAlt", void 0);
108
+ __decorate([
109
+ (0, class_validator_1.IsOptional)(),
110
+ (0, class_validator_1.IsString)(),
111
+ __metadata("design:type", String)
112
+ ], BlogUpdateDTO.prototype, "metaDescription", void 0);
113
+ __decorate([
114
+ (0, class_validator_1.IsOptional)(),
115
+ (0, class_validator_1.IsString)(),
116
+ __metadata("design:type", String)
117
+ ], BlogUpdateDTO.prototype, "metaKeywords", void 0);
118
+ __decorate([
119
+ (0, class_validator_1.IsOptional)(),
120
+ (0, class_validator_1.IsString)(),
121
+ __metadata("design:type", String)
122
+ ], BlogUpdateDTO.prototype, "slug", void 0);
123
+ __decorate([
124
+ (0, class_validator_1.IsOptional)(),
125
+ (0, class_validator_1.IsString)(),
126
+ __metadata("design:type", String)
127
+ ], BlogUpdateDTO.prototype, "status", void 0);
128
+ exports.BlogUpdateDTO = BlogUpdateDTO;
@@ -0,0 +1,17 @@
1
+ export declare class NewsletterCreateDTO {
2
+ fullName?: string;
3
+ phone?: string;
4
+ email: string;
5
+ subscribe: boolean;
6
+ validate(): string[];
7
+ static fromPlain(plain: Record<string, unknown>): NewsletterCreateDTO;
8
+ toPlain(): Record<string, unknown>;
9
+ }
10
+ export declare class NewsletterUpdateDTO {
11
+ fullName?: string;
12
+ phone?: string;
13
+ email?: string;
14
+ subscribe?: boolean;
15
+ validate(): string[];
16
+ static fromPlain(plain: Record<string, unknown>): NewsletterUpdateDTO;
17
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NewsletterUpdateDTO = exports.NewsletterCreateDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ class NewsletterCreateDTO {
16
+ constructor() {
17
+ this.subscribe = true;
18
+ }
19
+ validate() {
20
+ const errors = (0, class_validator_1.validateSync)(this);
21
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
22
+ }
23
+ static fromPlain(plain) {
24
+ return (0, class_transformer_1.plainToClass)(NewsletterCreateDTO, plain);
25
+ }
26
+ toPlain() {
27
+ return (0, class_transformer_1.classToPlain)(this);
28
+ }
29
+ }
30
+ __decorate([
31
+ (0, class_validator_1.IsOptional)(),
32
+ (0, class_validator_1.IsString)(),
33
+ __metadata("design:type", String)
34
+ ], NewsletterCreateDTO.prototype, "fullName", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsOptional)(),
37
+ (0, class_validator_1.IsString)(),
38
+ __metadata("design:type", String)
39
+ ], NewsletterCreateDTO.prototype, "phone", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsEmail)(),
42
+ __metadata("design:type", String)
43
+ ], NewsletterCreateDTO.prototype, "email", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsOptional)(),
46
+ (0, class_validator_1.IsBoolean)(),
47
+ __metadata("design:type", Object)
48
+ ], NewsletterCreateDTO.prototype, "subscribe", void 0);
49
+ exports.NewsletterCreateDTO = NewsletterCreateDTO;
50
+ class NewsletterUpdateDTO {
51
+ validate() {
52
+ const errors = (0, class_validator_1.validateSync)(this);
53
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
54
+ }
55
+ static fromPlain(plain) {
56
+ return (0, class_transformer_1.plainToClass)(NewsletterUpdateDTO, plain);
57
+ }
58
+ }
59
+ __decorate([
60
+ (0, class_validator_1.IsOptional)(),
61
+ (0, class_validator_1.IsString)(),
62
+ __metadata("design:type", String)
63
+ ], NewsletterUpdateDTO.prototype, "fullName", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsOptional)(),
66
+ (0, class_validator_1.IsString)(),
67
+ __metadata("design:type", String)
68
+ ], NewsletterUpdateDTO.prototype, "phone", void 0);
69
+ __decorate([
70
+ (0, class_validator_1.IsOptional)(),
71
+ (0, class_validator_1.IsEmail)(),
72
+ __metadata("design:type", String)
73
+ ], NewsletterUpdateDTO.prototype, "email", void 0);
74
+ __decorate([
75
+ (0, class_validator_1.IsOptional)(),
76
+ (0, class_validator_1.IsBoolean)(),
77
+ __metadata("design:type", Boolean)
78
+ ], NewsletterUpdateDTO.prototype, "subscribe", void 0);
79
+ exports.NewsletterUpdateDTO = NewsletterUpdateDTO;
@@ -0,0 +1,47 @@
1
+ export declare enum Designation {
2
+ AGENT = "agent"
3
+ }
4
+ export declare enum Gender {
5
+ MALE = "male",
6
+ FEMALE = "female"
7
+ }
8
+ export declare class SalesAgentGetDTO {
9
+ id: string;
10
+ name: string;
11
+ email?: string;
12
+ status: number;
13
+ designation: Designation;
14
+ dob: Date;
15
+ gender: Gender;
16
+ address: string;
17
+ phone: string;
18
+ photo: string;
19
+ static fromEntity(entity: any): SalesAgentGetDTO;
20
+ toPlain(): Record<string, unknown>;
21
+ }
22
+ export declare class SalesAgentCreateDTO {
23
+ name: string;
24
+ email?: string;
25
+ status: number;
26
+ designation: Designation;
27
+ dob: Date;
28
+ gender: Gender;
29
+ address: string;
30
+ phone: string;
31
+ photo: string;
32
+ validate(): string[];
33
+ static fromPlain(plain: Record<string, unknown>): SalesAgentCreateDTO;
34
+ }
35
+ export declare class SalesAgentUpdateDTO {
36
+ name?: string;
37
+ email?: string;
38
+ status?: number;
39
+ designation?: Designation;
40
+ dob?: Date;
41
+ gender?: Gender;
42
+ address?: string;
43
+ phone?: string;
44
+ photo?: string;
45
+ validate(): string[];
46
+ static fromPlain(plain: Record<string, unknown>): SalesAgentUpdateDTO;
47
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SalesAgentUpdateDTO = exports.SalesAgentCreateDTO = exports.SalesAgentGetDTO = exports.Gender = exports.Designation = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ var Designation;
16
+ (function (Designation) {
17
+ Designation["AGENT"] = "agent";
18
+ })(Designation = exports.Designation || (exports.Designation = {}));
19
+ var Gender;
20
+ (function (Gender) {
21
+ Gender["MALE"] = "male";
22
+ Gender["FEMALE"] = "female";
23
+ })(Gender = exports.Gender || (exports.Gender = {}));
24
+ class SalesAgentGetDTO {
25
+ static fromEntity(entity) {
26
+ return (0, class_transformer_1.plainToClass)(SalesAgentGetDTO, entity);
27
+ }
28
+ toPlain() {
29
+ return (0, class_transformer_1.classToPlain)(this);
30
+ }
31
+ }
32
+ exports.SalesAgentGetDTO = SalesAgentGetDTO;
33
+ class SalesAgentCreateDTO {
34
+ validate() {
35
+ const errors = (0, class_validator_1.validateSync)(this);
36
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
37
+ }
38
+ static fromPlain(plain) {
39
+ return (0, class_transformer_1.plainToClass)(SalesAgentCreateDTO, plain);
40
+ }
41
+ }
42
+ __decorate([
43
+ (0, class_validator_1.IsString)(),
44
+ __metadata("design:type", String)
45
+ ], SalesAgentCreateDTO.prototype, "name", void 0);
46
+ __decorate([
47
+ (0, class_validator_1.IsOptional)(),
48
+ (0, class_validator_1.IsEmail)(),
49
+ __metadata("design:type", String)
50
+ ], SalesAgentCreateDTO.prototype, "email", void 0);
51
+ __decorate([
52
+ (0, class_validator_1.IsNumber)(),
53
+ __metadata("design:type", Number)
54
+ ], SalesAgentCreateDTO.prototype, "status", void 0);
55
+ __decorate([
56
+ (0, class_validator_1.IsEnum)(Designation),
57
+ __metadata("design:type", String)
58
+ ], SalesAgentCreateDTO.prototype, "designation", void 0);
59
+ __decorate([
60
+ (0, class_validator_1.IsDate)(),
61
+ __metadata("design:type", Date)
62
+ ], SalesAgentCreateDTO.prototype, "dob", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsEnum)(Gender),
65
+ __metadata("design:type", String)
66
+ ], SalesAgentCreateDTO.prototype, "gender", void 0);
67
+ __decorate([
68
+ (0, class_validator_1.IsString)(),
69
+ __metadata("design:type", String)
70
+ ], SalesAgentCreateDTO.prototype, "address", void 0);
71
+ __decorate([
72
+ (0, class_validator_1.IsString)(),
73
+ __metadata("design:type", String)
74
+ ], SalesAgentCreateDTO.prototype, "phone", void 0);
75
+ __decorate([
76
+ (0, class_validator_1.IsString)(),
77
+ __metadata("design:type", String)
78
+ ], SalesAgentCreateDTO.prototype, "photo", void 0);
79
+ exports.SalesAgentCreateDTO = SalesAgentCreateDTO;
80
+ class SalesAgentUpdateDTO {
81
+ validate() {
82
+ const errors = (0, class_validator_1.validateSync)(this);
83
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
84
+ }
85
+ static fromPlain(plain) {
86
+ return (0, class_transformer_1.plainToClass)(SalesAgentUpdateDTO, plain);
87
+ }
88
+ }
89
+ __decorate([
90
+ (0, class_validator_1.IsOptional)(),
91
+ (0, class_validator_1.IsString)(),
92
+ __metadata("design:type", String)
93
+ ], SalesAgentUpdateDTO.prototype, "name", void 0);
94
+ __decorate([
95
+ (0, class_validator_1.IsOptional)(),
96
+ (0, class_validator_1.IsEmail)(),
97
+ __metadata("design:type", String)
98
+ ], SalesAgentUpdateDTO.prototype, "email", void 0);
99
+ __decorate([
100
+ (0, class_validator_1.IsOptional)(),
101
+ (0, class_validator_1.IsNumber)(),
102
+ __metadata("design:type", Number)
103
+ ], SalesAgentUpdateDTO.prototype, "status", void 0);
104
+ __decorate([
105
+ (0, class_validator_1.IsOptional)(),
106
+ (0, class_validator_1.IsEnum)(Designation),
107
+ __metadata("design:type", String)
108
+ ], SalesAgentUpdateDTO.prototype, "designation", void 0);
109
+ __decorate([
110
+ (0, class_validator_1.IsOptional)(),
111
+ (0, class_validator_1.IsDate)(),
112
+ __metadata("design:type", Date)
113
+ ], SalesAgentUpdateDTO.prototype, "dob", void 0);
114
+ __decorate([
115
+ (0, class_validator_1.IsOptional)(),
116
+ (0, class_validator_1.IsEnum)(Gender),
117
+ __metadata("design:type", String)
118
+ ], SalesAgentUpdateDTO.prototype, "gender", void 0);
119
+ __decorate([
120
+ (0, class_validator_1.IsOptional)(),
121
+ (0, class_validator_1.IsString)(),
122
+ __metadata("design:type", String)
123
+ ], SalesAgentUpdateDTO.prototype, "address", void 0);
124
+ __decorate([
125
+ (0, class_validator_1.IsOptional)(),
126
+ (0, class_validator_1.IsString)(),
127
+ __metadata("design:type", String)
128
+ ], SalesAgentUpdateDTO.prototype, "phone", void 0);
129
+ __decorate([
130
+ (0, class_validator_1.IsOptional)(),
131
+ (0, class_validator_1.IsString)(),
132
+ __metadata("design:type", String)
133
+ ], SalesAgentUpdateDTO.prototype, "photo", void 0);
134
+ exports.SalesAgentUpdateDTO = SalesAgentUpdateDTO;
@@ -0,0 +1,28 @@
1
+ import { ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
2
+ export declare class IsTimeConstraint implements ValidatorConstraintInterface {
3
+ validate(time: string, args: ValidationArguments): boolean;
4
+ defaultMessage(args: ValidationArguments): string;
5
+ }
6
+ export declare class ShowroomVisitCreateDTO {
7
+ Visitor_FullName: string;
8
+ Visitor_Mobile: string;
9
+ Visit_Date: string;
10
+ Visit_Time: string;
11
+ Visit_Interest: string;
12
+ Interested_Cars: string[];
13
+ AssignedAgentId?: string;
14
+ validate(): string[];
15
+ static fromPlain(plain: Record<string, unknown>): ShowroomVisitCreateDTO;
16
+ toPlain(): Record<string, unknown>;
17
+ }
18
+ export declare class ShowroomVisitUpdateDTO {
19
+ Visitor_FullName?: string;
20
+ Visitor_Mobile?: string;
21
+ Visit_Date?: string;
22
+ Visit_Time?: string;
23
+ Visit_Interest?: string;
24
+ Interested_Cars?: string[];
25
+ AssignedAgentId?: string;
26
+ validate(): string[];
27
+ static fromPlain(plain: Record<string, unknown>): ShowroomVisitUpdateDTO;
28
+ }
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ShowroomVisitUpdateDTO = exports.ShowroomVisitCreateDTO = exports.IsTimeConstraint = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ // Custom time format validator
16
+ let IsTimeConstraint = class IsTimeConstraint {
17
+ validate(time, args) {
18
+ // Regex for HH:MM 24-hour time format
19
+ return /^([01]\d|2[0-3]):([0-5]\d)$/.test(time);
20
+ }
21
+ defaultMessage(args) {
22
+ return 'Time ($value) is not a valid 24-hour time format (HH:MM)';
23
+ }
24
+ };
25
+ IsTimeConstraint = __decorate([
26
+ (0, class_validator_1.ValidatorConstraint)({ name: 'isTime', async: false })
27
+ ], IsTimeConstraint);
28
+ exports.IsTimeConstraint = IsTimeConstraint;
29
+ class ShowroomVisitCreateDTO {
30
+ validate() {
31
+ const errors = (0, class_validator_1.validateSync)(this);
32
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
33
+ }
34
+ static fromPlain(plain) {
35
+ return (0, class_transformer_1.plainToClass)(ShowroomVisitCreateDTO, plain);
36
+ }
37
+ toPlain() {
38
+ return (0, class_transformer_1.classToPlain)(this);
39
+ }
40
+ }
41
+ __decorate([
42
+ (0, class_validator_1.IsString)(),
43
+ __metadata("design:type", String)
44
+ ], ShowroomVisitCreateDTO.prototype, "Visitor_FullName", void 0);
45
+ __decorate([
46
+ (0, class_validator_1.IsString)(),
47
+ __metadata("design:type", String)
48
+ ], ShowroomVisitCreateDTO.prototype, "Visitor_Mobile", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.IsDateString)(),
51
+ __metadata("design:type", String)
52
+ ], ShowroomVisitCreateDTO.prototype, "Visit_Date", void 0);
53
+ __decorate([
54
+ (0, class_validator_1.Validate)(IsTimeConstraint),
55
+ __metadata("design:type", String)
56
+ ], ShowroomVisitCreateDTO.prototype, "Visit_Time", void 0);
57
+ __decorate([
58
+ (0, class_validator_1.IsString)(),
59
+ __metadata("design:type", String)
60
+ ], ShowroomVisitCreateDTO.prototype, "Visit_Interest", void 0);
61
+ __decorate([
62
+ (0, class_validator_1.IsArray)(),
63
+ (0, class_validator_1.IsString)({ each: true }),
64
+ __metadata("design:type", Array)
65
+ ], ShowroomVisitCreateDTO.prototype, "Interested_Cars", void 0);
66
+ __decorate([
67
+ (0, class_validator_1.IsOptional)(),
68
+ (0, class_validator_1.IsUUID)() // Ensure that AssignedAgentId is a valid UUID
69
+ ,
70
+ __metadata("design:type", String)
71
+ ], ShowroomVisitCreateDTO.prototype, "AssignedAgentId", void 0);
72
+ exports.ShowroomVisitCreateDTO = ShowroomVisitCreateDTO;
73
+ class ShowroomVisitUpdateDTO {
74
+ validate() {
75
+ const errors = (0, class_validator_1.validateSync)(this);
76
+ return errors.map(error => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
77
+ }
78
+ static fromPlain(plain) {
79
+ return (0, class_transformer_1.plainToClass)(ShowroomVisitUpdateDTO, plain);
80
+ }
81
+ }
82
+ __decorate([
83
+ (0, class_validator_1.IsOptional)(),
84
+ (0, class_validator_1.IsString)(),
85
+ __metadata("design:type", String)
86
+ ], ShowroomVisitUpdateDTO.prototype, "Visitor_FullName", void 0);
87
+ __decorate([
88
+ (0, class_validator_1.IsOptional)(),
89
+ (0, class_validator_1.IsString)(),
90
+ __metadata("design:type", String)
91
+ ], ShowroomVisitUpdateDTO.prototype, "Visitor_Mobile", void 0);
92
+ __decorate([
93
+ (0, class_validator_1.IsOptional)(),
94
+ (0, class_validator_1.IsDateString)(),
95
+ __metadata("design:type", String)
96
+ ], ShowroomVisitUpdateDTO.prototype, "Visit_Date", void 0);
97
+ __decorate([
98
+ (0, class_validator_1.IsOptional)(),
99
+ (0, class_validator_1.Validate)(IsTimeConstraint),
100
+ __metadata("design:type", String)
101
+ ], ShowroomVisitUpdateDTO.prototype, "Visit_Time", void 0);
102
+ __decorate([
103
+ (0, class_validator_1.IsOptional)(),
104
+ (0, class_validator_1.IsString)(),
105
+ __metadata("design:type", String)
106
+ ], ShowroomVisitUpdateDTO.prototype, "Visit_Interest", void 0);
107
+ __decorate([
108
+ (0, class_validator_1.IsOptional)(),
109
+ (0, class_validator_1.IsArray)(),
110
+ (0, class_validator_1.IsString)({ each: true }),
111
+ __metadata("design:type", Array)
112
+ ], ShowroomVisitUpdateDTO.prototype, "Interested_Cars", void 0);
113
+ __decorate([
114
+ (0, class_validator_1.IsOptional)(),
115
+ (0, class_validator_1.IsUUID)() // Ensure that AssignedAgentId is a valid UUID
116
+ ,
117
+ __metadata("design:type", String)
118
+ ], ShowroomVisitUpdateDTO.prototype, "AssignedAgentId", void 0);
119
+ exports.ShowroomVisitUpdateDTO = ShowroomVisitUpdateDTO;
@@ -0,0 +1,45 @@
1
+ import { TestDriveRequestFilter, TestDriveRequestSelectFields } from "../utilities";
2
+ import { BaseCreateDTO, BaseUpdateDTO } from "../../../vehicle/data/dto/BaseDTO";
3
+ import { DynamicVehicleDTO } from "../../../vehicle/data/dto/VehicleDTO";
4
+ import { LeadThrough, TestDriveRequestStatus } from "../enums";
5
+ import { TestDriveRequest } from "../models/TestDriveRequest";
6
+ import { BaseGetDTO } from "../../../../global/dto/BaseGetDTO";
7
+ import { TypedOptions } from "../../../../global/utilities";
8
+ import { VehicleSelectFields } from "../../../vehicle/data/utilities";
9
+ export type TestDriveRequestGetDTOOptions = Omit<TypedOptions<TestDriveRequest>, "select"> & {
10
+ select?: (TestDriveRequestSelectFields | `vehicle.${VehicleSelectFields}`)[];
11
+ withVehicle?: boolean;
12
+ };
13
+ export declare class TestDriveRequestGetDTO extends BaseGetDTO<TestDriveRequest, TestDriveRequestFilter> {
14
+ filters?: TestDriveRequestFilter;
15
+ options?: TestDriveRequestGetDTOOptions;
16
+ }
17
+ export declare class TestDriveRequestCreateDTO extends BaseCreateDTO {
18
+ vehicle: DynamicVehicleDTO;
19
+ testerName: string;
20
+ testerMobile: string;
21
+ testerEmail?: string;
22
+ requestedDate: string;
23
+ testDriveDate?: string;
24
+ status?: TestDriveRequestStatus;
25
+ leadThrough?: LeadThrough;
26
+ comments?: string;
27
+ validate(): string[];
28
+ constructor(data?: Partial<TestDriveRequestCreateDTO>);
29
+ static fromPlain(plain: Record<string, unknown>): TestDriveRequestCreateDTO;
30
+ toPlain(): Record<string, unknown>;
31
+ }
32
+ export declare class TestDriveRequestUpdateDTO extends BaseUpdateDTO {
33
+ vehicle?: DynamicVehicleDTO;
34
+ testerName?: string;
35
+ testerMobile?: string;
36
+ testerEmail?: string;
37
+ requestedDate?: Date;
38
+ testDriveDate?: Date;
39
+ status?: TestDriveRequestStatus;
40
+ leadThrough?: LeadThrough;
41
+ comments?: string;
42
+ validate(): string[];
43
+ static fromPlain(plain: Record<string, unknown>): TestDriveRequestUpdateDTO;
44
+ toPlain(): Record<string, unknown>;
45
+ }