@alba-cars/common-modules 1.3.2 → 1.3.3

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.
@@ -4,7 +4,9 @@ export declare enum ErrorType {
4
4
  UNAUTHORIZED = "UNAUTHORIZED",
5
5
  FORBIDDEN = "FORBIDDEN",
6
6
  INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
7
- BAD_REQUEST = "BAD_REQUEST"
7
+ BAD_REQUEST = "BAD_REQUEST",
8
+ AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
9
+ AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR"
8
10
  }
9
11
  export declare class AppError extends Error {
10
12
  message: string;
@@ -10,6 +10,8 @@ var ErrorType;
10
10
  ErrorType["FORBIDDEN"] = "FORBIDDEN";
11
11
  ErrorType["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
12
12
  ErrorType["BAD_REQUEST"] = "BAD_REQUEST";
13
+ ErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
14
+ ErrorType["AUTHORIZATION_ERROR"] = "AUTHORIZATION_ERROR";
13
15
  })(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
14
16
  class AppError extends Error {
15
17
  constructor(message, statusCode, type, details) {
@@ -40,4 +40,9 @@ export declare const UTIL_ENDPOINTS: {
40
40
  preprocessMediaUrl: string;
41
41
  };
42
42
  };
43
+ export declare const AUTH_ENDPOINTS: {
44
+ login: string;
45
+ register: string;
46
+ getLoggedInUser: string;
47
+ };
43
48
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UTIL_ENDPOINTS = exports.API_ENDPOINTS = void 0;
3
+ exports.AUTH_ENDPOINTS = exports.UTIL_ENDPOINTS = exports.API_ENDPOINTS = void 0;
4
4
  exports.API_ENDPOINTS = {
5
5
  vehicle: {
6
6
  getAll: `/vehicle`,
@@ -130,7 +130,7 @@ exports.API_ENDPOINTS = {
130
130
  getOne: (id) => `/vehicle-reservation/${id}`,
131
131
  deleteOne: (id) => `/vehicle-reservation/${id}`,
132
132
  updateOne: (id) => `/vehicle-reservation/${id}`,
133
- }
133
+ },
134
134
  };
135
135
  exports.UTIL_ENDPOINTS = {
136
136
  media: {
@@ -138,3 +138,8 @@ exports.UTIL_ENDPOINTS = {
138
138
  preprocessMediaUrl: "/utils/process-media",
139
139
  },
140
140
  };
141
+ exports.AUTH_ENDPOINTS = {
142
+ login: "/auth/login",
143
+ register: "/auth/register",
144
+ getLoggedInUser: "/auth/me",
145
+ };
@@ -0,0 +1,20 @@
1
+ export declare class RegisterDTO {
2
+ email: string;
3
+ password: string;
4
+ name?: string;
5
+ phone?: string;
6
+ }
7
+ export declare class LoginDTO {
8
+ email: string;
9
+ password: string;
10
+ }
11
+ export declare class AuthResponseDTO {
12
+ user: {
13
+ id: string;
14
+ email: string;
15
+ firstName?: string;
16
+ lastName?: string;
17
+ roles: string[];
18
+ };
19
+ token: string;
20
+ }
@@ -0,0 +1,47 @@
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.AuthResponseDTO = exports.LoginDTO = exports.RegisterDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class RegisterDTO {
15
+ }
16
+ __decorate([
17
+ (0, class_validator_1.IsEmail)(),
18
+ __metadata("design:type", String)
19
+ ], RegisterDTO.prototype, "email", void 0);
20
+ __decorate([
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.MinLength)(8),
23
+ __metadata("design:type", String)
24
+ ], RegisterDTO.prototype, "password", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsString)(),
27
+ __metadata("design:type", String)
28
+ ], RegisterDTO.prototype, "name", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ __metadata("design:type", String)
32
+ ], RegisterDTO.prototype, "phone", void 0);
33
+ exports.RegisterDTO = RegisterDTO;
34
+ class LoginDTO {
35
+ }
36
+ __decorate([
37
+ (0, class_validator_1.IsEmail)(),
38
+ __metadata("design:type", String)
39
+ ], LoginDTO.prototype, "email", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsString)(),
42
+ __metadata("design:type", String)
43
+ ], LoginDTO.prototype, "password", void 0);
44
+ exports.LoginDTO = LoginDTO;
45
+ class AuthResponseDTO {
46
+ }
47
+ exports.AuthResponseDTO = AuthResponseDTO;
@@ -0,0 +1 @@
1
+ export * from "./dto/AuthDTO";
@@ -0,0 +1,17 @@
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("./dto/AuthDTO"), exports);
@@ -0,0 +1 @@
1
+ export * from "./data";
@@ -0,0 +1,17 @@
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"), exports);
@@ -1,3 +1,4 @@
1
+ import { PaginationOptions } from "../../../../global";
1
2
  export declare enum SalaryType {
2
3
  BANK_TRANSFER = "bank_transfer",
3
4
  CASH = "cash",
@@ -90,3 +91,23 @@ export declare class FinanceEligibilityRequestResponseDTO {
90
91
  static fromPlain(plain: Record<string, unknown>): FinanceEligibilityRequestResponseDTO;
91
92
  toPlain(): Record<string, unknown>;
92
93
  }
94
+ export declare class FinanceEligibiltyFilterDTO {
95
+ search?: string;
96
+ vehicleId?: string;
97
+ leadId?: string;
98
+ isActive?: boolean;
99
+ validate(): string[];
100
+ static fromPlain(plain: Record<string, unknown>): FinanceEligibiltyFilterDTO;
101
+ toPlain(): Record<string, unknown>;
102
+ }
103
+ export declare class FinanceEligiblityOptionsDTO extends PaginationOptions {
104
+ static fromPlain(plain: Record<string, unknown>): FinanceEligibiltyFilterDTO;
105
+ toPlain(): Record<string, unknown>;
106
+ }
107
+ export declare class FinanceElgibiltyFetchDTO {
108
+ filter: FinanceEligibiltyFilterDTO;
109
+ options: FinanceEligiblityOptionsDTO;
110
+ validate(): string[];
111
+ static fromPlain(plain: Record<string, unknown>): FinanceElgibiltyFetchDTO;
112
+ toPlain(): Record<string, unknown>;
113
+ }
@@ -9,9 +9,10 @@ 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.FinanceEligibilityRequestResponseDTO = exports.FinanceEligibilityRequestUpdateDTO = exports.FinanceEligibilityRequestCreateDTO = exports.YesNo = exports.EmployeeCount = exports.SalaryType = void 0;
12
+ exports.FinanceElgibiltyFetchDTO = exports.FinanceEligiblityOptionsDTO = exports.FinanceEligibiltyFilterDTO = exports.FinanceEligibilityRequestResponseDTO = exports.FinanceEligibilityRequestUpdateDTO = exports.FinanceEligibilityRequestCreateDTO = exports.YesNo = exports.EmployeeCount = exports.SalaryType = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const class_transformer_1 = require("class-transformer");
15
+ const global_1 = require("../../../../global");
15
16
  var SalaryType;
16
17
  (function (SalaryType) {
17
18
  SalaryType["BANK_TRANSFER"] = "bank_transfer";
@@ -284,3 +285,57 @@ __decorate([
284
285
  __metadata("design:type", String)
285
286
  ], FinanceEligibilityRequestResponseDTO.prototype, "rejectionReason", void 0);
286
287
  exports.FinanceEligibilityRequestResponseDTO = FinanceEligibilityRequestResponseDTO;
288
+ class FinanceEligibiltyFilterDTO {
289
+ validate() {
290
+ const errors = (0, class_validator_1.validateSync)(this);
291
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
292
+ }
293
+ static fromPlain(plain) {
294
+ return (0, class_transformer_1.plainToClass)(FinanceEligibiltyFilterDTO, plain);
295
+ }
296
+ toPlain() {
297
+ return (0, class_transformer_1.classToPlain)(this);
298
+ }
299
+ }
300
+ __decorate([
301
+ (0, class_validator_1.IsOptional)(),
302
+ __metadata("design:type", String)
303
+ ], FinanceEligibiltyFilterDTO.prototype, "search", void 0);
304
+ __decorate([
305
+ (0, class_validator_1.IsUUID)(),
306
+ (0, class_validator_1.IsOptional)(),
307
+ __metadata("design:type", String)
308
+ ], FinanceEligibiltyFilterDTO.prototype, "vehicleId", void 0);
309
+ __decorate([
310
+ (0, class_validator_1.IsUUID)(),
311
+ (0, class_validator_1.IsOptional)(),
312
+ __metadata("design:type", String)
313
+ ], FinanceEligibiltyFilterDTO.prototype, "leadId", void 0);
314
+ __decorate([
315
+ (0, class_validator_1.IsBoolean)(),
316
+ (0, class_validator_1.IsOptional)(),
317
+ __metadata("design:type", Boolean)
318
+ ], FinanceEligibiltyFilterDTO.prototype, "isActive", void 0);
319
+ exports.FinanceEligibiltyFilterDTO = FinanceEligibiltyFilterDTO;
320
+ class FinanceEligiblityOptionsDTO extends global_1.PaginationOptions {
321
+ static fromPlain(plain) {
322
+ return (0, class_transformer_1.plainToClass)(FinanceEligibiltyFilterDTO, plain);
323
+ }
324
+ toPlain() {
325
+ return (0, class_transformer_1.classToPlain)(this);
326
+ }
327
+ }
328
+ exports.FinanceEligiblityOptionsDTO = FinanceEligiblityOptionsDTO;
329
+ class FinanceElgibiltyFetchDTO {
330
+ validate() {
331
+ const errors = (0, class_validator_1.validateSync)(this);
332
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
333
+ }
334
+ static fromPlain(plain) {
335
+ return (0, class_transformer_1.plainToClass)(FinanceElgibiltyFetchDTO, plain);
336
+ }
337
+ toPlain() {
338
+ return (0, class_transformer_1.classToPlain)(this);
339
+ }
340
+ }
341
+ exports.FinanceElgibiltyFetchDTO = FinanceElgibiltyFetchDTO;
@@ -4,6 +4,7 @@ export * from "./sales-team";
4
4
  export * from "./showroom-visit";
5
5
  export * from "./test-drive-request";
6
6
  export * from "./vehicle";
7
- export * from "./sell-call-request";
7
+ export * from "./sell-car-request";
8
8
  export * from "./finance-eligibilty-request";
9
9
  export * from "./vehicle-reservations";
10
+ export * from "./auth";
@@ -20,6 +20,7 @@ __exportStar(require("./sales-team"), exports);
20
20
  __exportStar(require("./showroom-visit"), exports);
21
21
  __exportStar(require("./test-drive-request"), exports);
22
22
  __exportStar(require("./vehicle"), exports);
23
- __exportStar(require("./sell-call-request"), exports);
23
+ __exportStar(require("./sell-car-request"), exports);
24
24
  __exportStar(require("./finance-eligibilty-request"), exports);
25
25
  __exportStar(require("./vehicle-reservations"), exports);
26
+ __exportStar(require("./auth"), exports);
@@ -0,0 +1,154 @@
1
+ import { PaginationOptions } from "../../../../global";
2
+ export declare enum RequestType {
3
+ SELL = "sell",
4
+ TRADE_IN = "trade_in"
5
+ }
6
+ export declare class SellCarRequestCreateDTO {
7
+ name: string;
8
+ phone: string;
9
+ email?: string;
10
+ city: string;
11
+ requestType: RequestType;
12
+ makeId: string;
13
+ modelId: string;
14
+ year: number;
15
+ mileage: number;
16
+ expectedSellingPrice?: number;
17
+ vehicleOptions?: string;
18
+ specification?: string;
19
+ images?: string[];
20
+ desiredVehicleId?: string;
21
+ color?: string;
22
+ transmission?: string;
23
+ condition?: string;
24
+ fuelType?: string;
25
+ engineCapacity?: string;
26
+ description?: string;
27
+ additionalDetails?: {
28
+ serviceHistory?: boolean;
29
+ numberOfOwners?: number;
30
+ accidentHistory?: boolean;
31
+ modifications?: string[];
32
+ lastServiceDate?: Date;
33
+ warrantyValid?: boolean;
34
+ tradeIn?: boolean;
35
+ inspectionDate?: Date;
36
+ inspectionLocation?: string;
37
+ finalTradeInOffer?: number;
38
+ [key: string]: any;
39
+ };
40
+ validate(): string[];
41
+ static fromPlain(plain: Record<string, unknown>): SellCarRequestCreateDTO;
42
+ toPlain(): Record<string, unknown>;
43
+ }
44
+ export declare class SellCarRequestUpdateDTO {
45
+ name?: string;
46
+ phone?: string;
47
+ email?: string;
48
+ city?: string;
49
+ requestType?: RequestType;
50
+ makeId?: string;
51
+ modelId?: string;
52
+ year?: number;
53
+ mileage?: number;
54
+ expectedSellingPrice?: number;
55
+ vehicleOptions?: string;
56
+ specification?: string;
57
+ condition?: string;
58
+ images?: string[];
59
+ desiredVehicleId?: string;
60
+ color?: string;
61
+ transmission?: string;
62
+ fuelType?: string;
63
+ engineCapacity?: string;
64
+ description?: string;
65
+ status?: "pending" | "inspection_scheduled" | "inspected" | "valued" | "approved" | "rejected" | "completed";
66
+ additionalDetails?: {
67
+ serviceHistory?: boolean;
68
+ numberOfOwners?: number;
69
+ accidentHistory?: boolean;
70
+ modifications?: string[];
71
+ lastServiceDate?: Date;
72
+ warrantyValid?: boolean;
73
+ tradeIn?: boolean;
74
+ inspectionDate?: Date;
75
+ inspectionLocation?: string;
76
+ finalTradeInOffer?: number;
77
+ [key: string]: any;
78
+ };
79
+ validate(): string[];
80
+ static fromPlain(plain: Record<string, unknown>): SellCarRequestUpdateDTO;
81
+ toPlain(): Record<string, unknown>;
82
+ }
83
+ export declare class SellCarRequestResponseDTO {
84
+ id: string;
85
+ name: string;
86
+ phone: string;
87
+ email?: string;
88
+ city: string;
89
+ requestType: RequestType;
90
+ make?: {
91
+ id: string;
92
+ name: string;
93
+ };
94
+ model?: {
95
+ id: string;
96
+ name: string;
97
+ };
98
+ year?: number;
99
+ mileage?: number;
100
+ expectedSellingPrice?: number;
101
+ vehicleOptions?: string;
102
+ specification?: string;
103
+ images?: string[];
104
+ desiredVehicle?: {
105
+ id: string;
106
+ make: string;
107
+ model: string;
108
+ year: number;
109
+ };
110
+ color?: string;
111
+ transmission?: string;
112
+ condition?: string;
113
+ fuelType?: string;
114
+ engineCapacity?: string;
115
+ description?: string;
116
+ status: "pending" | "inspection_scheduled" | "inspected" | "valued" | "approved" | "rejected" | "completed";
117
+ additionalDetails?: {
118
+ serviceHistory?: boolean;
119
+ numberOfOwners?: number;
120
+ accidentHistory?: boolean;
121
+ modifications?: string[];
122
+ lastServiceDate?: Date;
123
+ warrantyValid?: boolean;
124
+ tradeIn?: boolean;
125
+ inspectionDate?: Date;
126
+ inspectionLocation?: string;
127
+ finalTradeInOffer?: number;
128
+ [key: string]: any;
129
+ };
130
+ createdAt: Date;
131
+ updatedAt: Date;
132
+ validate(): string[];
133
+ static fromPlain(plain: Record<string, unknown>): SellCarRequestResponseDTO;
134
+ toPlain(): Record<string, unknown>;
135
+ }
136
+ export declare class SellCarFilterDTO {
137
+ search?: string;
138
+ leadId?: string;
139
+ isActive?: boolean;
140
+ validate(): string[];
141
+ static fromPlain(plain: Record<string, unknown>): SellCarFilterDTO;
142
+ toPlain(): Record<string, unknown>;
143
+ }
144
+ export declare class SellCarOptionsDTO extends PaginationOptions {
145
+ static fromPlain(plain: Record<string, unknown>): SellCarOptionsDTO;
146
+ toPlain(): Record<string, unknown>;
147
+ }
148
+ export declare class SellCarFetchDTO {
149
+ filter: SellCarFilterDTO;
150
+ options: SellCarOptionsDTO;
151
+ validate(): string[];
152
+ static fromPlain(plain: Record<string, unknown>): SellCarFetchDTO;
153
+ toPlain(): Record<string, unknown>;
154
+ }
@@ -0,0 +1,444 @@
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.SellCarFetchDTO = exports.SellCarOptionsDTO = exports.SellCarFilterDTO = exports.SellCarRequestResponseDTO = exports.SellCarRequestUpdateDTO = exports.SellCarRequestCreateDTO = exports.RequestType = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const global_1 = require("../../../../global");
16
+ var RequestType;
17
+ (function (RequestType) {
18
+ RequestType["SELL"] = "sell";
19
+ RequestType["TRADE_IN"] = "trade_in";
20
+ })(RequestType = exports.RequestType || (exports.RequestType = {}));
21
+ class SellCarRequestCreateDTO {
22
+ validate() {
23
+ const errors = (0, class_validator_1.validateSync)(this);
24
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
25
+ }
26
+ static fromPlain(plain) {
27
+ const requestType = plain.desiredVehicleId
28
+ ? RequestType.TRADE_IN
29
+ : RequestType.SELL;
30
+ return (0, class_transformer_1.plainToClass)(SellCarRequestCreateDTO, { ...plain, requestType });
31
+ }
32
+ toPlain() {
33
+ return (0, class_transformer_1.classToPlain)(this);
34
+ }
35
+ }
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
38
+ __metadata("design:type", String)
39
+ ], SellCarRequestCreateDTO.prototype, "name", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsPhoneNumber)(),
42
+ __metadata("design:type", String)
43
+ ], SellCarRequestCreateDTO.prototype, "phone", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsEmail)(),
46
+ (0, class_validator_1.IsOptional)(),
47
+ __metadata("design:type", String)
48
+ ], SellCarRequestCreateDTO.prototype, "email", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.IsString)(),
51
+ __metadata("design:type", String)
52
+ ], SellCarRequestCreateDTO.prototype, "city", void 0);
53
+ __decorate([
54
+ (0, class_validator_1.IsEnum)(RequestType),
55
+ __metadata("design:type", String)
56
+ ], SellCarRequestCreateDTO.prototype, "requestType", void 0);
57
+ __decorate([
58
+ (0, class_validator_1.IsUUID)(),
59
+ __metadata("design:type", String)
60
+ ], SellCarRequestCreateDTO.prototype, "makeId", void 0);
61
+ __decorate([
62
+ (0, class_validator_1.IsUUID)(),
63
+ __metadata("design:type", String)
64
+ ], SellCarRequestCreateDTO.prototype, "modelId", void 0);
65
+ __decorate([
66
+ (0, class_validator_1.IsNumber)(),
67
+ (0, class_validator_1.IsPositive)(),
68
+ __metadata("design:type", Number)
69
+ ], SellCarRequestCreateDTO.prototype, "year", void 0);
70
+ __decorate([
71
+ (0, class_validator_1.IsNumber)(),
72
+ (0, class_validator_1.IsPositive)(),
73
+ __metadata("design:type", Number)
74
+ ], SellCarRequestCreateDTO.prototype, "mileage", void 0);
75
+ __decorate([
76
+ (0, class_validator_1.IsNumber)(),
77
+ (0, class_validator_1.IsPositive)(),
78
+ (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
79
+ (0, class_validator_1.IsOptional)(),
80
+ __metadata("design:type", Number)
81
+ ], SellCarRequestCreateDTO.prototype, "expectedSellingPrice", void 0);
82
+ __decorate([
83
+ (0, class_validator_1.IsString)(),
84
+ (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
85
+ (0, class_validator_1.IsOptional)(),
86
+ __metadata("design:type", String)
87
+ ], SellCarRequestCreateDTO.prototype, "vehicleOptions", void 0);
88
+ __decorate([
89
+ (0, class_validator_1.IsString)(),
90
+ (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
91
+ (0, class_validator_1.IsOptional)(),
92
+ __metadata("design:type", String)
93
+ ], SellCarRequestCreateDTO.prototype, "specification", void 0);
94
+ __decorate([
95
+ (0, class_validator_1.IsArray)(),
96
+ (0, class_validator_1.IsString)({ each: true }),
97
+ (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.SELL),
98
+ (0, class_validator_1.IsOptional)(),
99
+ __metadata("design:type", Array)
100
+ ], SellCarRequestCreateDTO.prototype, "images", void 0);
101
+ __decorate([
102
+ (0, class_validator_1.IsUUID)(),
103
+ (0, class_validator_1.ValidateIf)((o) => o.requestType === RequestType.TRADE_IN),
104
+ (0, class_validator_1.IsOptional)(),
105
+ __metadata("design:type", String)
106
+ ], SellCarRequestCreateDTO.prototype, "desiredVehicleId", void 0);
107
+ __decorate([
108
+ (0, class_validator_1.IsString)(),
109
+ (0, class_validator_1.IsOptional)(),
110
+ __metadata("design:type", String)
111
+ ], SellCarRequestCreateDTO.prototype, "color", void 0);
112
+ __decorate([
113
+ (0, class_validator_1.IsString)(),
114
+ (0, class_validator_1.IsOptional)(),
115
+ __metadata("design:type", String)
116
+ ], SellCarRequestCreateDTO.prototype, "transmission", void 0);
117
+ __decorate([
118
+ (0, class_validator_1.IsString)(),
119
+ (0, class_validator_1.IsOptional)(),
120
+ __metadata("design:type", String)
121
+ ], SellCarRequestCreateDTO.prototype, "condition", void 0);
122
+ __decorate([
123
+ (0, class_validator_1.IsString)(),
124
+ (0, class_validator_1.IsOptional)(),
125
+ __metadata("design:type", String)
126
+ ], SellCarRequestCreateDTO.prototype, "fuelType", void 0);
127
+ __decorate([
128
+ (0, class_validator_1.IsString)(),
129
+ (0, class_validator_1.IsOptional)(),
130
+ __metadata("design:type", String)
131
+ ], SellCarRequestCreateDTO.prototype, "engineCapacity", void 0);
132
+ __decorate([
133
+ (0, class_validator_1.IsString)(),
134
+ (0, class_validator_1.IsOptional)(),
135
+ __metadata("design:type", String)
136
+ ], SellCarRequestCreateDTO.prototype, "description", void 0);
137
+ __decorate([
138
+ (0, class_validator_1.IsOptional)(),
139
+ __metadata("design:type", Object)
140
+ ], SellCarRequestCreateDTO.prototype, "additionalDetails", void 0);
141
+ exports.SellCarRequestCreateDTO = SellCarRequestCreateDTO;
142
+ class SellCarRequestUpdateDTO {
143
+ validate() {
144
+ const errors = (0, class_validator_1.validateSync)(this);
145
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
146
+ }
147
+ static fromPlain(plain) {
148
+ return (0, class_transformer_1.plainToClass)(SellCarRequestUpdateDTO, plain);
149
+ }
150
+ toPlain() {
151
+ return (0, class_transformer_1.classToPlain)(this);
152
+ }
153
+ }
154
+ __decorate([
155
+ (0, class_validator_1.IsOptional)(),
156
+ (0, class_validator_1.IsString)(),
157
+ __metadata("design:type", String)
158
+ ], SellCarRequestUpdateDTO.prototype, "name", void 0);
159
+ __decorate([
160
+ (0, class_validator_1.IsOptional)(),
161
+ (0, class_validator_1.IsPhoneNumber)(),
162
+ __metadata("design:type", String)
163
+ ], SellCarRequestUpdateDTO.prototype, "phone", void 0);
164
+ __decorate([
165
+ (0, class_validator_1.IsOptional)(),
166
+ (0, class_validator_1.IsEmail)(),
167
+ __metadata("design:type", String)
168
+ ], SellCarRequestUpdateDTO.prototype, "email", void 0);
169
+ __decorate([
170
+ (0, class_validator_1.IsOptional)(),
171
+ (0, class_validator_1.IsString)(),
172
+ __metadata("design:type", String)
173
+ ], SellCarRequestUpdateDTO.prototype, "city", void 0);
174
+ __decorate([
175
+ (0, class_validator_1.IsOptional)(),
176
+ (0, class_validator_1.IsEnum)(RequestType),
177
+ __metadata("design:type", String)
178
+ ], SellCarRequestUpdateDTO.prototype, "requestType", void 0);
179
+ __decorate([
180
+ (0, class_validator_1.IsOptional)(),
181
+ (0, class_validator_1.IsUUID)(),
182
+ __metadata("design:type", String)
183
+ ], SellCarRequestUpdateDTO.prototype, "makeId", void 0);
184
+ __decorate([
185
+ (0, class_validator_1.IsOptional)(),
186
+ (0, class_validator_1.IsUUID)(),
187
+ __metadata("design:type", String)
188
+ ], SellCarRequestUpdateDTO.prototype, "modelId", void 0);
189
+ __decorate([
190
+ (0, class_validator_1.IsOptional)(),
191
+ (0, class_validator_1.IsNumber)(),
192
+ (0, class_validator_1.IsPositive)(),
193
+ __metadata("design:type", Number)
194
+ ], SellCarRequestUpdateDTO.prototype, "year", void 0);
195
+ __decorate([
196
+ (0, class_validator_1.IsOptional)(),
197
+ (0, class_validator_1.IsNumber)(),
198
+ (0, class_validator_1.IsPositive)(),
199
+ __metadata("design:type", Number)
200
+ ], SellCarRequestUpdateDTO.prototype, "mileage", void 0);
201
+ __decorate([
202
+ (0, class_validator_1.IsOptional)(),
203
+ (0, class_validator_1.IsNumber)(),
204
+ (0, class_validator_1.IsPositive)(),
205
+ __metadata("design:type", Number)
206
+ ], SellCarRequestUpdateDTO.prototype, "expectedSellingPrice", void 0);
207
+ __decorate([
208
+ (0, class_validator_1.IsOptional)(),
209
+ (0, class_validator_1.IsString)(),
210
+ __metadata("design:type", String)
211
+ ], SellCarRequestUpdateDTO.prototype, "vehicleOptions", void 0);
212
+ __decorate([
213
+ (0, class_validator_1.IsOptional)(),
214
+ (0, class_validator_1.IsString)(),
215
+ __metadata("design:type", String)
216
+ ], SellCarRequestUpdateDTO.prototype, "specification", void 0);
217
+ __decorate([
218
+ (0, class_validator_1.IsString)(),
219
+ (0, class_validator_1.IsOptional)(),
220
+ __metadata("design:type", String)
221
+ ], SellCarRequestUpdateDTO.prototype, "condition", void 0);
222
+ __decorate([
223
+ (0, class_validator_1.IsOptional)(),
224
+ (0, class_validator_1.IsArray)(),
225
+ (0, class_validator_1.IsString)({ each: true }),
226
+ __metadata("design:type", Array)
227
+ ], SellCarRequestUpdateDTO.prototype, "images", void 0);
228
+ __decorate([
229
+ (0, class_validator_1.IsOptional)(),
230
+ (0, class_validator_1.IsUUID)(),
231
+ __metadata("design:type", String)
232
+ ], SellCarRequestUpdateDTO.prototype, "desiredVehicleId", void 0);
233
+ __decorate([
234
+ (0, class_validator_1.IsOptional)(),
235
+ (0, class_validator_1.IsString)(),
236
+ __metadata("design:type", String)
237
+ ], SellCarRequestUpdateDTO.prototype, "color", void 0);
238
+ __decorate([
239
+ (0, class_validator_1.IsOptional)(),
240
+ (0, class_validator_1.IsString)(),
241
+ __metadata("design:type", String)
242
+ ], SellCarRequestUpdateDTO.prototype, "transmission", void 0);
243
+ __decorate([
244
+ (0, class_validator_1.IsOptional)(),
245
+ (0, class_validator_1.IsString)(),
246
+ __metadata("design:type", String)
247
+ ], SellCarRequestUpdateDTO.prototype, "fuelType", void 0);
248
+ __decorate([
249
+ (0, class_validator_1.IsOptional)(),
250
+ (0, class_validator_1.IsString)(),
251
+ __metadata("design:type", String)
252
+ ], SellCarRequestUpdateDTO.prototype, "engineCapacity", void 0);
253
+ __decorate([
254
+ (0, class_validator_1.IsOptional)(),
255
+ (0, class_validator_1.IsString)(),
256
+ __metadata("design:type", String)
257
+ ], SellCarRequestUpdateDTO.prototype, "description", void 0);
258
+ __decorate([
259
+ (0, class_validator_1.IsOptional)(),
260
+ (0, class_validator_1.IsEnum)([
261
+ "pending",
262
+ "inspection_scheduled",
263
+ "inspected",
264
+ "valued",
265
+ "approved",
266
+ "rejected",
267
+ "completed",
268
+ ]),
269
+ __metadata("design:type", String)
270
+ ], SellCarRequestUpdateDTO.prototype, "status", void 0);
271
+ __decorate([
272
+ (0, class_validator_1.IsOptional)(),
273
+ __metadata("design:type", Object)
274
+ ], SellCarRequestUpdateDTO.prototype, "additionalDetails", void 0);
275
+ exports.SellCarRequestUpdateDTO = SellCarRequestUpdateDTO;
276
+ class SellCarRequestResponseDTO {
277
+ validate() {
278
+ const errors = (0, class_validator_1.validateSync)(this);
279
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
280
+ }
281
+ static fromPlain(plain) {
282
+ return (0, class_transformer_1.plainToClass)(SellCarRequestResponseDTO, plain);
283
+ }
284
+ toPlain() {
285
+ return (0, class_transformer_1.classToPlain)(this);
286
+ }
287
+ }
288
+ __decorate([
289
+ (0, class_validator_1.IsString)(),
290
+ __metadata("design:type", String)
291
+ ], SellCarRequestResponseDTO.prototype, "id", void 0);
292
+ __decorate([
293
+ (0, class_validator_1.IsString)(),
294
+ __metadata("design:type", String)
295
+ ], SellCarRequestResponseDTO.prototype, "name", void 0);
296
+ __decorate([
297
+ (0, class_validator_1.IsPhoneNumber)(),
298
+ __metadata("design:type", String)
299
+ ], SellCarRequestResponseDTO.prototype, "phone", void 0);
300
+ __decorate([
301
+ (0, class_validator_1.IsEmail)(),
302
+ (0, class_validator_1.IsOptional)(),
303
+ __metadata("design:type", String)
304
+ ], SellCarRequestResponseDTO.prototype, "email", void 0);
305
+ __decorate([
306
+ (0, class_validator_1.IsString)(),
307
+ __metadata("design:type", String)
308
+ ], SellCarRequestResponseDTO.prototype, "city", void 0);
309
+ __decorate([
310
+ (0, class_validator_1.IsEnum)(RequestType),
311
+ __metadata("design:type", String)
312
+ ], SellCarRequestResponseDTO.prototype, "requestType", void 0);
313
+ __decorate([
314
+ (0, class_validator_1.IsNumber)(),
315
+ (0, class_validator_1.IsOptional)(),
316
+ __metadata("design:type", Number)
317
+ ], SellCarRequestResponseDTO.prototype, "year", void 0);
318
+ __decorate([
319
+ (0, class_validator_1.IsNumber)(),
320
+ (0, class_validator_1.IsOptional)(),
321
+ __metadata("design:type", Number)
322
+ ], SellCarRequestResponseDTO.prototype, "mileage", void 0);
323
+ __decorate([
324
+ (0, class_validator_1.IsNumber)(),
325
+ (0, class_validator_1.IsOptional)(),
326
+ __metadata("design:type", Number)
327
+ ], SellCarRequestResponseDTO.prototype, "expectedSellingPrice", void 0);
328
+ __decorate([
329
+ (0, class_validator_1.IsString)(),
330
+ (0, class_validator_1.IsOptional)(),
331
+ __metadata("design:type", String)
332
+ ], SellCarRequestResponseDTO.prototype, "vehicleOptions", void 0);
333
+ __decorate([
334
+ (0, class_validator_1.IsString)(),
335
+ (0, class_validator_1.IsOptional)(),
336
+ __metadata("design:type", String)
337
+ ], SellCarRequestResponseDTO.prototype, "specification", void 0);
338
+ __decorate([
339
+ (0, class_validator_1.IsArray)(),
340
+ (0, class_validator_1.IsString)({ each: true }),
341
+ (0, class_validator_1.IsOptional)(),
342
+ __metadata("design:type", Array)
343
+ ], SellCarRequestResponseDTO.prototype, "images", void 0);
344
+ __decorate([
345
+ (0, class_validator_1.IsOptional)(),
346
+ __metadata("design:type", Object)
347
+ ], SellCarRequestResponseDTO.prototype, "desiredVehicle", void 0);
348
+ __decorate([
349
+ (0, class_validator_1.IsString)(),
350
+ (0, class_validator_1.IsOptional)(),
351
+ __metadata("design:type", String)
352
+ ], SellCarRequestResponseDTO.prototype, "color", void 0);
353
+ __decorate([
354
+ (0, class_validator_1.IsString)(),
355
+ (0, class_validator_1.IsOptional)(),
356
+ __metadata("design:type", String)
357
+ ], SellCarRequestResponseDTO.prototype, "transmission", void 0);
358
+ __decorate([
359
+ (0, class_validator_1.IsString)(),
360
+ (0, class_validator_1.IsOptional)(),
361
+ __metadata("design:type", String)
362
+ ], SellCarRequestResponseDTO.prototype, "condition", void 0);
363
+ __decorate([
364
+ (0, class_validator_1.IsString)(),
365
+ (0, class_validator_1.IsOptional)(),
366
+ __metadata("design:type", String)
367
+ ], SellCarRequestResponseDTO.prototype, "fuelType", void 0);
368
+ __decorate([
369
+ (0, class_validator_1.IsString)(),
370
+ (0, class_validator_1.IsOptional)(),
371
+ __metadata("design:type", String)
372
+ ], SellCarRequestResponseDTO.prototype, "engineCapacity", void 0);
373
+ __decorate([
374
+ (0, class_validator_1.IsString)(),
375
+ (0, class_validator_1.IsOptional)(),
376
+ __metadata("design:type", String)
377
+ ], SellCarRequestResponseDTO.prototype, "description", void 0);
378
+ __decorate([
379
+ (0, class_validator_1.IsString)(),
380
+ (0, class_validator_1.IsEnum)([
381
+ "pending",
382
+ "inspection_scheduled",
383
+ "inspected",
384
+ "valued",
385
+ "approved",
386
+ "rejected",
387
+ "completed",
388
+ ]),
389
+ __metadata("design:type", String)
390
+ ], SellCarRequestResponseDTO.prototype, "status", void 0);
391
+ __decorate([
392
+ (0, class_validator_1.IsOptional)(),
393
+ __metadata("design:type", Object)
394
+ ], SellCarRequestResponseDTO.prototype, "additionalDetails", void 0);
395
+ exports.SellCarRequestResponseDTO = SellCarRequestResponseDTO;
396
+ class SellCarFilterDTO {
397
+ validate() {
398
+ const errors = (0, class_validator_1.validateSync)(this);
399
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
400
+ }
401
+ static fromPlain(plain) {
402
+ return (0, class_transformer_1.plainToClass)(SellCarFilterDTO, plain);
403
+ }
404
+ toPlain() {
405
+ return (0, class_transformer_1.classToPlain)(this);
406
+ }
407
+ }
408
+ __decorate([
409
+ (0, class_validator_1.IsOptional)(),
410
+ __metadata("design:type", String)
411
+ ], SellCarFilterDTO.prototype, "search", void 0);
412
+ __decorate([
413
+ (0, class_validator_1.IsUUID)(),
414
+ (0, class_validator_1.IsOptional)(),
415
+ __metadata("design:type", String)
416
+ ], SellCarFilterDTO.prototype, "leadId", void 0);
417
+ __decorate([
418
+ (0, class_validator_1.IsBoolean)(),
419
+ (0, class_validator_1.IsOptional)(),
420
+ __metadata("design:type", Boolean)
421
+ ], SellCarFilterDTO.prototype, "isActive", void 0);
422
+ exports.SellCarFilterDTO = SellCarFilterDTO;
423
+ class SellCarOptionsDTO extends global_1.PaginationOptions {
424
+ static fromPlain(plain) {
425
+ return (0, class_transformer_1.plainToClass)(SellCarOptionsDTO, plain);
426
+ }
427
+ toPlain() {
428
+ return (0, class_transformer_1.classToPlain)(this);
429
+ }
430
+ }
431
+ exports.SellCarOptionsDTO = SellCarOptionsDTO;
432
+ class SellCarFetchDTO {
433
+ validate() {
434
+ const errors = (0, class_validator_1.validateSync)(this);
435
+ return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
436
+ }
437
+ static fromPlain(plain) {
438
+ return (0, class_transformer_1.plainToClass)(SellCarFetchDTO, plain);
439
+ }
440
+ toPlain() {
441
+ return (0, class_transformer_1.classToPlain)(this);
442
+ }
443
+ }
444
+ exports.SellCarFetchDTO = SellCarFetchDTO;
@@ -0,0 +1 @@
1
+ export * from "./dto/SellCarRequestDTO";
@@ -0,0 +1,17 @@
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("./dto/SellCarRequestDTO"), exports);
@@ -0,0 +1 @@
1
+ export * from "./data";
@@ -0,0 +1,17 @@
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"), exports);
@@ -1,10 +1,9 @@
1
- import { User } from "../models/User";
2
1
  export declare class BaseCreateDTO {
3
- createdBy: User;
2
+ createdById: string;
4
3
  }
5
4
  export declare class BaseUpdateDTO {
6
- updatedBy: User;
5
+ updatedById: string;
7
6
  }
8
7
  export declare class BaseDeleteDTO {
9
- deletedBy: User;
8
+ deletedById: string;
10
9
  }
@@ -10,33 +10,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseDeleteDTO = exports.BaseUpdateDTO = exports.BaseCreateDTO = void 0;
13
- const class_transformer_1 = require("class-transformer");
14
13
  const class_validator_1 = require("class-validator");
15
- const User_1 = require("../models/User");
16
14
  class BaseCreateDTO {
17
15
  }
18
16
  __decorate([
19
17
  (0, class_validator_1.IsNotEmpty)(),
20
- (0, class_validator_1.ValidateNested)(),
21
- (0, class_transformer_1.Type)(() => User_1.User),
22
- __metadata("design:type", User_1.User)
23
- ], BaseCreateDTO.prototype, "createdBy", void 0);
18
+ __metadata("design:type", String)
19
+ ], BaseCreateDTO.prototype, "createdById", void 0);
24
20
  exports.BaseCreateDTO = BaseCreateDTO;
25
21
  class BaseUpdateDTO {
26
22
  }
27
23
  __decorate([
28
24
  (0, class_validator_1.IsNotEmpty)(),
29
- (0, class_validator_1.ValidateNested)(),
30
- (0, class_transformer_1.Type)(() => User_1.User),
31
- __metadata("design:type", User_1.User)
32
- ], BaseUpdateDTO.prototype, "updatedBy", void 0);
25
+ __metadata("design:type", String)
26
+ ], BaseUpdateDTO.prototype, "updatedById", void 0);
33
27
  exports.BaseUpdateDTO = BaseUpdateDTO;
34
28
  class BaseDeleteDTO {
35
29
  }
36
30
  __decorate([
37
31
  (0, class_validator_1.IsNotEmpty)(),
38
- (0, class_validator_1.ValidateNested)(),
39
- (0, class_transformer_1.Type)(() => User_1.User),
40
- __metadata("design:type", User_1.User)
41
- ], BaseDeleteDTO.prototype, "deletedBy", void 0);
32
+ __metadata("design:type", String)
33
+ ], BaseDeleteDTO.prototype, "deletedById", void 0);
42
34
  exports.BaseDeleteDTO = BaseDeleteDTO;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.2",
6
+ "version": "1.3.3",
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",