@alba-cars/common-modules 1.8.0 → 1.8.2

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.
@@ -5,20 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.api = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
- const global_utils_1 = require("../utils/global-utils");
9
8
  const HttpStatusCodes_1 = require("../enums/HttpStatusCodes");
10
- function authRequestInterceptor(config) {
11
- if (config.headers) {
12
- config.headers.Accept = "application/json";
13
- config.headers.Authorization = `Bearer ${(0, global_utils_1.generateRandomBase64)(20)}`;
14
- }
15
- config.withCredentials = true;
16
- return config;
17
- }
18
9
  exports.api = axios_1.default.create({
19
10
  baseURL: process.env.NEXT_API_URL, // Base backend URL would be defined here.
20
11
  });
21
- exports.api.interceptors.request.use(authRequestInterceptor);
22
12
  exports.api.interceptors.response.use((response) => {
23
13
  return response.data;
24
14
  }, (error) => {
@@ -27,4 +27,6 @@ export declare class OtpLoginDTO {
27
27
  export declare class AuthResponseDTO {
28
28
  user: User;
29
29
  token: string;
30
+ refreshToken?: string;
31
+ expiresAt?: number;
30
32
  }
@@ -61,6 +61,9 @@ export declare class UserFilterDTO {
61
61
  toPlain(): Record<string, unknown>;
62
62
  }
63
63
  export declare class UserOptionsDTO extends PaginationOptions {
64
+ withDocuments?: boolean;
65
+ withDeposits?: boolean;
66
+ withFavoriteVehicles?: boolean;
64
67
  static fromPlain(plain: Record<string, unknown>): UserOptionsDTO;
65
68
  toPlain(): Record<string, unknown>;
66
69
  }
@@ -199,4 +199,19 @@ class UserOptionsDTO extends utilities_1.PaginationOptions {
199
199
  return (0, class_transformer_1.classToPlain)(this);
200
200
  }
201
201
  }
202
+ __decorate([
203
+ (0, class_validator_1.IsOptional)(),
204
+ (0, class_validator_1.IsBoolean)(),
205
+ __metadata("design:type", Boolean)
206
+ ], UserOptionsDTO.prototype, "withDocuments", void 0);
207
+ __decorate([
208
+ (0, class_validator_1.IsOptional)(),
209
+ (0, class_validator_1.IsBoolean)(),
210
+ __metadata("design:type", Boolean)
211
+ ], UserOptionsDTO.prototype, "withDeposits", void 0);
212
+ __decorate([
213
+ (0, class_validator_1.IsOptional)(),
214
+ (0, class_validator_1.IsBoolean)(),
215
+ __metadata("design:type", Boolean)
216
+ ], UserOptionsDTO.prototype, "withFavoriteVehicles", void 0);
202
217
  exports.UserOptionsDTO = UserOptionsDTO;
@@ -33,9 +33,9 @@ export declare class FinanceEligibilityRequestCreateDTO {
33
33
  totalCreditLimit: number;
34
34
  salaryType: SalaryType;
35
35
  previousDisputes: YesNo;
36
- employeeCount: EmployeeCount;
36
+ employeeCount?: EmployeeCount;
37
37
  isCompanyOlderThanOneYear: boolean;
38
- hasLandline: YesNo;
38
+ hasLandline?: YesNo;
39
39
  documents?: string[];
40
40
  static fromPlain(plain: Record<string, unknown>): FinanceEligibilityRequestCreateDTO;
41
41
  toPlain(): Record<string, unknown>;
@@ -107,6 +107,7 @@ __decorate([
107
107
  ], FinanceEligibilityRequestCreateDTO.prototype, "previousDisputes", void 0);
108
108
  __decorate([
109
109
  (0, class_validator_1.IsEnum)(EmployeeCount),
110
+ (0, class_validator_1.IsOptional)(),
110
111
  __metadata("design:type", String)
111
112
  ], FinanceEligibilityRequestCreateDTO.prototype, "employeeCount", void 0);
112
113
  __decorate([
@@ -115,6 +116,7 @@ __decorate([
115
116
  ], FinanceEligibilityRequestCreateDTO.prototype, "isCompanyOlderThanOneYear", void 0);
116
117
  __decorate([
117
118
  (0, class_validator_1.IsEnum)(YesNo),
119
+ (0, class_validator_1.IsOptional)(),
118
120
  __metadata("design:type", String)
119
121
  ], FinanceEligibilityRequestCreateDTO.prototype, "hasLandline", void 0);
120
122
  __decorate([
@@ -0,0 +1,24 @@
1
+ export declare class CreateUserDocumentDto {
2
+ url: string;
3
+ fileName?: string;
4
+ description?: string;
5
+ fileType: 'image' | 'pdf' | 'unknown';
6
+ ownerId: string;
7
+ }
8
+ export declare class UserDocumentResponseDto {
9
+ id: string;
10
+ url: string;
11
+ fileName?: string;
12
+ description?: string;
13
+ fileType: 'image' | 'pdf' | 'unknown';
14
+ ownerId: string;
15
+ createdAt: Date;
16
+ updatedAt: Date;
17
+ constructor(partial: Partial<UserDocumentResponseDto>);
18
+ }
19
+ export declare class UpdateUserDocumentDto {
20
+ url?: string;
21
+ fileName?: string;
22
+ description?: string;
23
+ fileType?: 'image' | 'pdf' | 'unknown';
24
+ }
@@ -0,0 +1,73 @@
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.UpdateUserDocumentDto = exports.UserDocumentResponseDto = exports.CreateUserDocumentDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ // DTO for creating a new UserDocument
15
+ class CreateUserDocumentDto {
16
+ }
17
+ __decorate([
18
+ (0, class_validator_1.IsNotEmpty)(),
19
+ (0, class_validator_1.IsString)(),
20
+ __metadata("design:type", String)
21
+ ], CreateUserDocumentDto.prototype, "url", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsOptional)(),
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], CreateUserDocumentDto.prototype, "fileName", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsOptional)(),
29
+ (0, class_validator_1.IsString)(),
30
+ __metadata("design:type", String)
31
+ ], CreateUserDocumentDto.prototype, "description", void 0);
32
+ __decorate([
33
+ (0, class_validator_1.IsNotEmpty)(),
34
+ (0, class_validator_1.IsEnum)(['image', 'pdf', 'unknown']),
35
+ __metadata("design:type", String)
36
+ ], CreateUserDocumentDto.prototype, "fileType", void 0);
37
+ __decorate([
38
+ (0, class_validator_1.IsNotEmpty)(),
39
+ (0, class_validator_1.IsUUID)(),
40
+ __metadata("design:type", String)
41
+ ], CreateUserDocumentDto.prototype, "ownerId", void 0);
42
+ exports.CreateUserDocumentDto = CreateUserDocumentDto;
43
+ // DTO for returning UserDocument data
44
+ class UserDocumentResponseDto {
45
+ constructor(partial) {
46
+ Object.assign(this, partial);
47
+ }
48
+ }
49
+ exports.UserDocumentResponseDto = UserDocumentResponseDto;
50
+ // DTO for updating a UserDocument
51
+ class UpdateUserDocumentDto {
52
+ }
53
+ __decorate([
54
+ (0, class_validator_1.IsOptional)(),
55
+ (0, class_validator_1.IsString)(),
56
+ __metadata("design:type", String)
57
+ ], UpdateUserDocumentDto.prototype, "url", void 0);
58
+ __decorate([
59
+ (0, class_validator_1.IsOptional)(),
60
+ (0, class_validator_1.IsString)(),
61
+ __metadata("design:type", String)
62
+ ], UpdateUserDocumentDto.prototype, "fileName", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsOptional)(),
65
+ (0, class_validator_1.IsString)(),
66
+ __metadata("design:type", String)
67
+ ], UpdateUserDocumentDto.prototype, "description", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.IsEnum)(['image', 'pdf', 'unknown']),
71
+ __metadata("design:type", String)
72
+ ], UpdateUserDocumentDto.prototype, "fileType", void 0);
73
+ exports.UpdateUserDocumentDto = UpdateUserDocumentDto;
@@ -1,3 +1,4 @@
1
+ import { UserDocumentResponseDto } from "../lead/data/dto/lead_documents_dto";
1
2
  import { Deposit } from "./Deposit";
2
3
  import { Role } from "./Roles";
3
4
  import { UserFavoriteVehicle } from "./UserFavoriteVehicle";
@@ -18,4 +19,5 @@ export interface User {
18
19
  vehicleFavorites?: UserFavoriteVehicle[];
19
20
  favoriteVehicles?: Vehicle[];
20
21
  deposits?: Deposit[];
22
+ documents?: UserDocumentResponseDto[];
21
23
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.0",
6
+ "version": "1.8.2",
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",