@alba-cars/common-modules 1.6.9 → 1.7.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.
@@ -52,6 +52,7 @@ type APIEndpointType = {
52
52
  leads: BaseEndpoint;
53
53
  leadPreferences: BaseEndpoint;
54
54
  googleReview: BaseEndpoint;
55
+ tickets: BaseEndpoint;
55
56
  user: BaseEndpoint;
56
57
  };
57
58
  export declare const API_ENDPOINTS: APIEndpointType;
@@ -196,6 +196,13 @@ exports.API_ENDPOINTS = {
196
196
  deleteOne: (id) => `/google-reviews/${id}`,
197
197
  updateOne: (id) => `/google-reviews/${id}`,
198
198
  },
199
+ tickets: {
200
+ getAll: `/tickets`,
201
+ create: `/tickets`,
202
+ getOne: (id) => `/tickets/${id}`,
203
+ deleteOne: (id) => `/tickets/${id}`,
204
+ updateOne: (id) => `/tickets/${id}`,
205
+ },
199
206
  };
200
207
  exports.UTIL_ENDPOINTS = {
201
208
  media: {
@@ -1,13 +1,13 @@
1
1
  import { User } from "../../../models";
2
2
  export declare class RegisterDTO {
3
- email: string;
4
- password: string;
3
+ email?: string;
4
+ password?: string;
5
5
  name?: string;
6
6
  phone?: string;
7
7
  savedFavoriteVehicles?: string[];
8
8
  static fromPlain(entity: any): RegisterDTO;
9
9
  toPlain(): Record<string, unknown>;
10
- validate(): string[];
10
+ validate?(): string[];
11
11
  }
12
12
  export declare class LoginDTO {
13
13
  email: string;
@@ -15,7 +15,14 @@ export declare class LoginDTO {
15
15
  savedFavoriteVehicles?: string[];
16
16
  static fromPlain(entity: any): LoginDTO;
17
17
  toPlain(): Record<string, unknown>;
18
- validate(): string[];
18
+ validate?(): string[];
19
+ }
20
+ export declare class OtpLoginDTO {
21
+ phone: string;
22
+ otp: string;
23
+ static fromPlain(entity: any): OtpLoginDTO;
24
+ toPlain(): Record<string, unknown>;
25
+ validate?(): string[];
19
26
  }
20
27
  export declare class AuthResponseDTO {
21
28
  user: User;
@@ -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.AuthResponseDTO = exports.LoginDTO = exports.RegisterDTO = void 0;
12
+ exports.AuthResponseDTO = exports.OtpLoginDTO = exports.LoginDTO = exports.RegisterDTO = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  class RegisterDTO {
@@ -26,11 +26,13 @@ class RegisterDTO {
26
26
  }
27
27
  __decorate([
28
28
  (0, class_validator_1.IsEmail)(),
29
+ (0, class_validator_1.IsOptional)(),
29
30
  __metadata("design:type", String)
30
31
  ], RegisterDTO.prototype, "email", void 0);
31
32
  __decorate([
32
33
  (0, class_validator_1.IsString)(),
33
34
  (0, class_validator_1.MinLength)(8),
35
+ (0, class_validator_1.IsOptional)(),
34
36
  __metadata("design:type", String)
35
37
  ], RegisterDTO.prototype, "password", void 0);
36
38
  __decorate([
@@ -39,6 +41,7 @@ __decorate([
39
41
  ], RegisterDTO.prototype, "name", void 0);
40
42
  __decorate([
41
43
  (0, class_validator_1.IsString)(),
44
+ (0, class_validator_1.IsOptional)(),
42
45
  __metadata("design:type", String)
43
46
  ], RegisterDTO.prototype, "phone", void 0);
44
47
  __decorate([
@@ -75,6 +78,29 @@ __decorate([
75
78
  __metadata("design:type", Array)
76
79
  ], LoginDTO.prototype, "savedFavoriteVehicles", void 0);
77
80
  exports.LoginDTO = LoginDTO;
81
+ class OtpLoginDTO {
82
+ static fromPlain(entity) {
83
+ return (0, class_transformer_1.plainToClass)(OtpLoginDTO, entity);
84
+ }
85
+ toPlain() {
86
+ return (0, class_transformer_1.classToPlain)(this);
87
+ }
88
+ validate() {
89
+ const errors = (0, class_validator_1.validateSync)(this);
90
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
91
+ }
92
+ }
93
+ __decorate([
94
+ (0, class_validator_1.IsString)(),
95
+ (0, class_validator_1.IsPhoneNumber)(),
96
+ __metadata("design:type", String)
97
+ ], OtpLoginDTO.prototype, "phone", void 0);
98
+ __decorate([
99
+ (0, class_validator_1.IsString)(),
100
+ (0, class_validator_1.MinLength)(6),
101
+ __metadata("design:type", String)
102
+ ], OtpLoginDTO.prototype, "otp", void 0);
103
+ exports.OtpLoginDTO = OtpLoginDTO;
78
104
  class AuthResponseDTO {
79
105
  }
80
106
  exports.AuthResponseDTO = AuthResponseDTO;
@@ -12,3 +12,4 @@ export * from "./google-review";
12
12
  export * from "./deposits";
13
13
  export * from "./lead";
14
14
  export * from "./faq/";
15
+ export * from "./tickets";
@@ -28,3 +28,4 @@ __exportStar(require("./google-review"), exports);
28
28
  __exportStar(require("./deposits"), exports);
29
29
  __exportStar(require("./lead"), exports);
30
30
  __exportStar(require("./faq/"), exports);
31
+ __exportStar(require("./tickets"), exports);
@@ -0,0 +1,48 @@
1
+ import { TicketRequestType, TicketStatusType } from '../enums';
2
+ export declare class CreateTicketDto {
3
+ userId: string;
4
+ requestType: TicketRequestType;
5
+ message: string;
6
+ assignedSalesAgentId: string;
7
+ agentName: string;
8
+ agentPhoneNumber: string;
9
+ }
10
+ export declare class UpdateTicketDto {
11
+ requestType?: TicketRequestType;
12
+ message?: string;
13
+ assignedSalesAgentId?: string;
14
+ agentName?: string;
15
+ agentPhoneNumber?: string;
16
+ status?: TicketStatusType;
17
+ }
18
+ export declare class TicketDto {
19
+ id: string;
20
+ userId: string;
21
+ requestType: TicketRequestType;
22
+ message: string;
23
+ assignedSalesAgentId: string;
24
+ agentName: string;
25
+ agentPhoneNumber: string;
26
+ status: TicketStatusType;
27
+ createdAt: Date;
28
+ updatedAt: Date;
29
+ }
30
+ export declare class TicketGetDTO {
31
+ id: string;
32
+ refId: number;
33
+ createdById: string | null;
34
+ updatedById: string | null;
35
+ deletedById: string | null;
36
+ isDeleted: boolean;
37
+ isActive: boolean;
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ userId: string;
41
+ requestType: TicketRequestType;
42
+ message: string;
43
+ assignedSalesAgentId: string;
44
+ agentName: string;
45
+ agentPhoneNumber: string;
46
+ status: TicketStatusType;
47
+ constructor();
48
+ }
@@ -0,0 +1,208 @@
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.TicketGetDTO = exports.TicketDto = exports.UpdateTicketDto = exports.CreateTicketDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const enums_1 = require("../enums");
16
+ class CreateTicketDto {
17
+ }
18
+ __decorate([
19
+ (0, class_validator_1.IsUUID)(),
20
+ __metadata("design:type", String)
21
+ ], CreateTicketDto.prototype, "userId", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsEnum)(enums_1.TicketRequestType),
24
+ __metadata("design:type", String)
25
+ ], CreateTicketDto.prototype, "requestType", void 0);
26
+ __decorate([
27
+ (0, class_validator_1.IsString)(),
28
+ __metadata("design:type", String)
29
+ ], CreateTicketDto.prototype, "message", void 0);
30
+ __decorate([
31
+ (0, class_validator_1.IsUUID)(),
32
+ __metadata("design:type", String)
33
+ ], CreateTicketDto.prototype, "assignedSalesAgentId", void 0);
34
+ __decorate([
35
+ (0, class_validator_1.IsString)(),
36
+ __metadata("design:type", String)
37
+ ], CreateTicketDto.prototype, "agentName", void 0);
38
+ __decorate([
39
+ (0, class_validator_1.IsString)(),
40
+ __metadata("design:type", String)
41
+ ], CreateTicketDto.prototype, "agentPhoneNumber", void 0);
42
+ exports.CreateTicketDto = CreateTicketDto;
43
+ class UpdateTicketDto {
44
+ }
45
+ __decorate([
46
+ (0, class_validator_1.IsEnum)(enums_1.TicketRequestType),
47
+ (0, class_validator_1.IsOptional)(),
48
+ __metadata("design:type", String)
49
+ ], UpdateTicketDto.prototype, "requestType", void 0);
50
+ __decorate([
51
+ (0, class_validator_1.IsString)(),
52
+ (0, class_validator_1.IsOptional)(),
53
+ __metadata("design:type", String)
54
+ ], UpdateTicketDto.prototype, "message", void 0);
55
+ __decorate([
56
+ (0, class_validator_1.IsUUID)(),
57
+ (0, class_validator_1.IsOptional)(),
58
+ __metadata("design:type", String)
59
+ ], UpdateTicketDto.prototype, "assignedSalesAgentId", void 0);
60
+ __decorate([
61
+ (0, class_validator_1.IsString)(),
62
+ (0, class_validator_1.IsOptional)(),
63
+ __metadata("design:type", String)
64
+ ], UpdateTicketDto.prototype, "agentName", void 0);
65
+ __decorate([
66
+ (0, class_validator_1.IsString)(),
67
+ (0, class_validator_1.IsOptional)(),
68
+ __metadata("design:type", String)
69
+ ], UpdateTicketDto.prototype, "agentPhoneNumber", void 0);
70
+ __decorate([
71
+ (0, class_validator_1.IsEnum)(enums_1.TicketStatusType),
72
+ (0, class_validator_1.IsOptional)(),
73
+ __metadata("design:type", String)
74
+ ], UpdateTicketDto.prototype, "status", void 0);
75
+ exports.UpdateTicketDto = UpdateTicketDto;
76
+ class TicketDto {
77
+ }
78
+ __decorate([
79
+ (0, class_validator_1.IsUUID)(),
80
+ __metadata("design:type", String)
81
+ ], TicketDto.prototype, "id", void 0);
82
+ __decorate([
83
+ (0, class_validator_1.IsUUID)(),
84
+ __metadata("design:type", String)
85
+ ], TicketDto.prototype, "userId", void 0);
86
+ __decorate([
87
+ (0, class_validator_1.IsEnum)(enums_1.TicketRequestType),
88
+ __metadata("design:type", String)
89
+ ], TicketDto.prototype, "requestType", void 0);
90
+ __decorate([
91
+ (0, class_validator_1.IsString)(),
92
+ __metadata("design:type", String)
93
+ ], TicketDto.prototype, "message", void 0);
94
+ __decorate([
95
+ (0, class_validator_1.IsUUID)(),
96
+ __metadata("design:type", String)
97
+ ], TicketDto.prototype, "assignedSalesAgentId", void 0);
98
+ __decorate([
99
+ (0, class_validator_1.IsString)(),
100
+ __metadata("design:type", String)
101
+ ], TicketDto.prototype, "agentName", void 0);
102
+ __decorate([
103
+ (0, class_validator_1.IsString)(),
104
+ __metadata("design:type", String)
105
+ ], TicketDto.prototype, "agentPhoneNumber", void 0);
106
+ __decorate([
107
+ (0, class_validator_1.IsEnum)(enums_1.TicketStatusType),
108
+ __metadata("design:type", String)
109
+ ], TicketDto.prototype, "status", void 0);
110
+ __decorate([
111
+ (0, class_transformer_1.Type)(() => Date),
112
+ (0, class_validator_1.IsDate)(),
113
+ __metadata("design:type", Date)
114
+ ], TicketDto.prototype, "createdAt", void 0);
115
+ __decorate([
116
+ (0, class_transformer_1.Type)(() => Date),
117
+ (0, class_validator_1.IsDate)(),
118
+ __metadata("design:type", Date)
119
+ ], TicketDto.prototype, "updatedAt", void 0);
120
+ exports.TicketDto = TicketDto;
121
+ class TicketGetDTO {
122
+ constructor() {
123
+ this.id = '';
124
+ this.refId = 0;
125
+ this.createdById = null;
126
+ this.updatedById = null;
127
+ this.deletedById = null;
128
+ this.isDeleted = false;
129
+ this.isActive = true;
130
+ this.createdAt = new Date().toISOString();
131
+ this.updatedAt = new Date().toISOString();
132
+ this.userId = '';
133
+ this.requestType = enums_1.TicketRequestType.CAR_VIEWING;
134
+ this.message = '';
135
+ this.assignedSalesAgentId = '';
136
+ this.agentName = '';
137
+ this.agentPhoneNumber = '';
138
+ this.status = enums_1.TicketStatusType.OPEN;
139
+ }
140
+ }
141
+ __decorate([
142
+ (0, class_validator_1.IsUUID)(),
143
+ __metadata("design:type", String)
144
+ ], TicketGetDTO.prototype, "id", void 0);
145
+ __decorate([
146
+ (0, class_validator_1.IsNumber)(),
147
+ __metadata("design:type", Number)
148
+ ], TicketGetDTO.prototype, "refId", void 0);
149
+ __decorate([
150
+ (0, class_validator_1.IsUUID)(),
151
+ (0, class_validator_1.IsOptional)(),
152
+ __metadata("design:type", Object)
153
+ ], TicketGetDTO.prototype, "createdById", void 0);
154
+ __decorate([
155
+ (0, class_validator_1.IsUUID)(),
156
+ (0, class_validator_1.IsOptional)(),
157
+ __metadata("design:type", Object)
158
+ ], TicketGetDTO.prototype, "updatedById", void 0);
159
+ __decorate([
160
+ (0, class_validator_1.IsUUID)(),
161
+ (0, class_validator_1.IsOptional)(),
162
+ __metadata("design:type", Object)
163
+ ], TicketGetDTO.prototype, "deletedById", void 0);
164
+ __decorate([
165
+ (0, class_validator_1.IsBoolean)(),
166
+ __metadata("design:type", Boolean)
167
+ ], TicketGetDTO.prototype, "isDeleted", void 0);
168
+ __decorate([
169
+ (0, class_validator_1.IsBoolean)(),
170
+ __metadata("design:type", Boolean)
171
+ ], TicketGetDTO.prototype, "isActive", void 0);
172
+ __decorate([
173
+ (0, class_validator_1.IsString)(),
174
+ __metadata("design:type", String)
175
+ ], TicketGetDTO.prototype, "createdAt", void 0);
176
+ __decorate([
177
+ (0, class_validator_1.IsString)(),
178
+ __metadata("design:type", String)
179
+ ], TicketGetDTO.prototype, "updatedAt", void 0);
180
+ __decorate([
181
+ (0, class_validator_1.IsUUID)(),
182
+ __metadata("design:type", String)
183
+ ], TicketGetDTO.prototype, "userId", void 0);
184
+ __decorate([
185
+ (0, class_validator_1.IsEnum)(enums_1.TicketRequestType),
186
+ __metadata("design:type", String)
187
+ ], TicketGetDTO.prototype, "requestType", void 0);
188
+ __decorate([
189
+ (0, class_validator_1.IsString)(),
190
+ __metadata("design:type", String)
191
+ ], TicketGetDTO.prototype, "message", void 0);
192
+ __decorate([
193
+ (0, class_validator_1.IsUUID)(),
194
+ __metadata("design:type", String)
195
+ ], TicketGetDTO.prototype, "assignedSalesAgentId", void 0);
196
+ __decorate([
197
+ (0, class_validator_1.IsString)(),
198
+ __metadata("design:type", String)
199
+ ], TicketGetDTO.prototype, "agentName", void 0);
200
+ __decorate([
201
+ (0, class_validator_1.IsString)(),
202
+ __metadata("design:type", String)
203
+ ], TicketGetDTO.prototype, "agentPhoneNumber", void 0);
204
+ __decorate([
205
+ (0, class_validator_1.IsEnum)(enums_1.TicketStatusType),
206
+ __metadata("design:type", String)
207
+ ], TicketGetDTO.prototype, "status", void 0);
208
+ exports.TicketGetDTO = TicketGetDTO;
@@ -0,0 +1,12 @@
1
+ export declare enum TicketRequestType {
2
+ WARRANTY = "Warranty",
3
+ REFUND = "Refund",
4
+ TEST_DRIVE = "Test Drive",
5
+ CAR_VIEWING = "Car Viewing"
6
+ }
7
+ export declare enum TicketStatusType {
8
+ OPEN = "Open",
9
+ IN_PROGRESS = "In Progress",
10
+ RESOLVED = "Resolved",
11
+ CLOSED = "Closed"
12
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TicketStatusType = exports.TicketRequestType = void 0;
4
+ var TicketRequestType;
5
+ (function (TicketRequestType) {
6
+ TicketRequestType["WARRANTY"] = "Warranty";
7
+ TicketRequestType["REFUND"] = "Refund";
8
+ TicketRequestType["TEST_DRIVE"] = "Test Drive";
9
+ TicketRequestType["CAR_VIEWING"] = "Car Viewing";
10
+ })(TicketRequestType = exports.TicketRequestType || (exports.TicketRequestType = {}));
11
+ var TicketStatusType;
12
+ (function (TicketStatusType) {
13
+ TicketStatusType["OPEN"] = "Open";
14
+ TicketStatusType["IN_PROGRESS"] = "In Progress";
15
+ TicketStatusType["RESOLVED"] = "Resolved";
16
+ TicketStatusType["CLOSED"] = "Closed";
17
+ })(TicketStatusType = exports.TicketStatusType || (exports.TicketStatusType = {}));
@@ -0,0 +1,2 @@
1
+ export * from './data/enums';
2
+ export * from './data/dto/TicketDto';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data/enums"), exports);
18
+ __exportStar(require("./data/dto/TicketDto"), exports);
@@ -209,7 +209,7 @@ export declare class VehicleFilter extends BaseFilter {
209
209
  includeDraft?: boolean;
210
210
  features?: string | string[];
211
211
  search?: string;
212
- validate(): string[];
212
+ validate?(): string[];
213
213
  static fromPlain(plain: Record<string, unknown>): VehicleFilter;
214
214
  static toPlain(entity: any): Record<string, unknown>;
215
215
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.9",
6
+ "version": "1.7.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",