@alba-cars/common-modules 1.3.1 → 1.3.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.
@@ -2,8 +2,10 @@ import { FinanceType } from "../enums/finance-type";
2
2
  import { ReservationStatus } from "../enums/reservation-type";
3
3
  import { Vehicle } from "../../../vehicle/data";
4
4
  import { PaginationOptions } from "../../../../global";
5
+ import { LeadDTO } from "../../../lead/data/dto/lead_dto";
5
6
  export declare class CreateVehicleReservationDto {
6
- leadId: string;
7
+ leadId?: string;
8
+ newLead?: LeadDTO;
7
9
  vehicleId: string;
8
10
  financeType: FinanceType;
9
11
  depositAmount?: number;
@@ -20,7 +22,8 @@ export declare class CreateVehicleReservationDto {
20
22
  toPlain(): Record<string, unknown>;
21
23
  }
22
24
  export declare class VehicleReservationDto {
23
- leadId: string;
25
+ id: string;
26
+ leadId: LeadDTO;
24
27
  vehicleId: string;
25
28
  financeType: FinanceType;
26
29
  depositAmount?: number;
@@ -76,10 +79,11 @@ export declare class VehicleReservationsOptions extends PaginationOptions {
76
79
  export declare class GetVehicleReservationsDTO {
77
80
  filter: GetVehicleReservationsFilterDto;
78
81
  options: VehicleReservationsOptions;
79
- static fromPlain(plain: Record<string, unknown>): GetVehicleReservationsFilterDto;
82
+ static fromPlain(plain: Record<string, unknown>): GetVehicleReservationsDTO;
80
83
  toPlain(): Record<string, unknown>;
81
84
  }
82
85
  export declare class GetVehicleReservationsFilterDto {
86
+ search?: string;
83
87
  status?: ReservationStatus;
84
88
  financeType?: FinanceType;
85
89
  vehicleId?: string;
@@ -15,6 +15,7 @@ const finance_type_1 = require("../enums/finance-type");
15
15
  const reservation_type_1 = require("../enums/reservation-type");
16
16
  const class_transformer_1 = require("class-transformer");
17
17
  const global_1 = require("../../../../global");
18
+ const lead_dto_1 = require("../../../lead/data/dto/lead_dto");
18
19
  class CreateVehicleReservationDto {
19
20
  validate() {
20
21
  const errors = (0, class_validator_1.validateSync)(this);
@@ -29,8 +30,15 @@ class CreateVehicleReservationDto {
29
30
  }
30
31
  __decorate([
31
32
  (0, class_validator_1.IsUUID)(),
33
+ (0, class_validator_1.ValidateIf)((o) => !o.newLead),
32
34
  __metadata("design:type", String)
33
35
  ], CreateVehicleReservationDto.prototype, "leadId", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.ValidateNested)(),
38
+ (0, class_transformer_1.Type)(() => lead_dto_1.LeadDTO),
39
+ (0, class_validator_1.ValidateIf)((o) => !o.leadId),
40
+ __metadata("design:type", lead_dto_1.LeadDTO)
41
+ ], CreateVehicleReservationDto.prototype, "newLead", void 0);
34
42
  __decorate([
35
43
  (0, class_validator_1.IsUUID)(),
36
44
  __metadata("design:type", String)
@@ -101,7 +109,7 @@ class VehicleReservationDto {
101
109
  __decorate([
102
110
  (0, class_validator_1.IsUUID)(),
103
111
  __metadata("design:type", String)
104
- ], VehicleReservationDto.prototype, "leadId", void 0);
112
+ ], VehicleReservationDto.prototype, "id", void 0);
105
113
  __decorate([
106
114
  (0, class_validator_1.IsUUID)(),
107
115
  __metadata("design:type", String)
@@ -264,7 +272,7 @@ class VehicleReservationsOptions extends global_1.PaginationOptions {
264
272
  exports.VehicleReservationsOptions = VehicleReservationsOptions;
265
273
  class GetVehicleReservationsDTO {
266
274
  static fromPlain(plain) {
267
- return (0, class_transformer_1.plainToClass)(GetVehicleReservationsFilterDto, plain);
275
+ return (0, class_transformer_1.plainToClass)(GetVehicleReservationsDTO, plain);
268
276
  }
269
277
  toPlain() {
270
278
  return (0, class_transformer_1.classToPlain)(this);
@@ -283,6 +291,10 @@ class GetVehicleReservationsFilterDto {
283
291
  return (0, class_transformer_1.classToPlain)(this);
284
292
  }
285
293
  }
294
+ __decorate([
295
+ (0, class_validator_1.IsOptional)(),
296
+ __metadata("design:type", String)
297
+ ], GetVehicleReservationsFilterDto.prototype, "search", void 0);
286
298
  __decorate([
287
299
  (0, class_validator_1.IsEnum)(reservation_type_1.ReservationStatus),
288
300
  (0, class_validator_1.IsOptional)(),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.1",
6
+ "version": "1.3.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",