resurgence-data 1.1.17 → 1.1.18

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,10 +5,14 @@ export declare class InvoiceCustomerDto extends BaseDTO {
5
5
  phoneNumber?: string;
6
6
  address?: string;
7
7
  }
8
+ export declare class InvoiceItemDto extends BaseDTO {
9
+ id: string;
10
+ quantity: number;
11
+ }
8
12
  export declare class CreateInvoiceDto extends BaseDTO {
9
13
  billerId: string;
10
14
  customerId?: string;
11
- items: string[];
15
+ items: InvoiceItemDto[];
12
16
  discountValue: number;
13
17
  total?: number;
14
18
  totalService?: number;
@@ -20,7 +24,7 @@ export declare class CreateInvoiceDto extends BaseDTO {
20
24
  export declare class UpdateInvoiceDto extends BaseDTO {
21
25
  id: string;
22
26
  billerId?: string;
23
- items?: string[];
27
+ items?: InvoiceItemDto[];
24
28
  customerId?: string;
25
29
  discountValue?: number;
26
30
  discountType?: string;
@@ -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.UpdateInvoiceDto = exports.CreateInvoiceDto = exports.InvoiceCustomerDto = void 0;
12
+ exports.UpdateInvoiceDto = exports.CreateInvoiceDto = exports.InvoiceItemDto = exports.InvoiceCustomerDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
15
  const dto_type_1 = require("../types/dto.type");
@@ -57,6 +57,27 @@ __decorate([
57
57
  (0, class_validator_1.IsOptional)(),
58
58
  __metadata("design:type", String)
59
59
  ], InvoiceCustomerDto.prototype, "address", void 0);
60
+ class InvoiceItemDto extends dto_type_1.BaseDTO {
61
+ }
62
+ exports.InvoiceItemDto = InvoiceItemDto;
63
+ __decorate([
64
+ (0, swagger_1.ApiProperty)({
65
+ description: "The ID of the biller",
66
+ example: "550e8400-e29b-41d4-a716-446655440000",
67
+ }),
68
+ (0, class_validator_1.IsNotEmpty)({ message: "Please provide a valid invoice item id" }),
69
+ (0, class_validator_1.IsString)({ message: "Please select a valid invoice item" }),
70
+ __metadata("design:type", String)
71
+ ], InvoiceItemDto.prototype, "id", void 0);
72
+ __decorate([
73
+ (0, swagger_1.ApiProperty)({
74
+ description: "The ID of the biller",
75
+ example: "550e8400-e29b-41d4-a716-446655440000",
76
+ }),
77
+ (0, class_validator_1.IsNotEmpty)({ message: "Please provide the item quantity" }),
78
+ (0, class_validator_1.IsInt)({ message: "Please select a valid invoice item" }),
79
+ __metadata("design:type", Number)
80
+ ], InvoiceItemDto.prototype, "quantity", void 0);
60
81
  class CreateInvoiceDto extends dto_type_1.BaseDTO {
61
82
  }
62
83
  exports.CreateInvoiceDto = CreateInvoiceDto;
@@ -173,7 +194,7 @@ __decorate([
173
194
  __decorate([
174
195
  (0, swagger_1.ApiProperty)({
175
196
  description: "List of items",
176
- example: "['550e8400-e29b-41d4-a716-446655440001','550e8400-e29b-41d4-a716-446655440001' ]",
197
+ example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
177
198
  required: false,
178
199
  }),
179
200
  (0, class_validator_1.IsNotEmpty)({ message: "Please provide items for this invoice" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "DTOs and shareable resources",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -52,6 +52,23 @@ export class InvoiceCustomerDto extends BaseDTO {
52
52
  address?: string;
53
53
  }
54
54
 
55
+ export class InvoiceItemDto extends BaseDTO {
56
+ @ApiProperty({
57
+ description: "The ID of the biller",
58
+ example: "550e8400-e29b-41d4-a716-446655440000",
59
+ })
60
+ @IsNotEmpty({ message: "Please provide a valid invoice item id" })
61
+ @IsString({ message: "Please select a valid invoice item" })
62
+ id: string;
63
+ @ApiProperty({
64
+ description: "The ID of the biller",
65
+ example: "550e8400-e29b-41d4-a716-446655440000",
66
+ })
67
+ @IsNotEmpty({ message: "Please provide the item quantity" })
68
+ @IsInt({ message: "Please select a valid invoice item" })
69
+ quantity: number;
70
+ }
71
+
55
72
  export class CreateInvoiceDto extends BaseDTO {
56
73
  @ApiProperty({
57
74
  description: "The ID of the biller",
@@ -76,7 +93,7 @@ export class CreateInvoiceDto extends BaseDTO {
76
93
  })
77
94
  @IsNotEmpty({ message: "Please provide items for this invoice" })
78
95
  @IsArray({ message: "Please provide a list of items for this invoice" })
79
- items: string[];
96
+ items: InvoiceItemDto[];
80
97
 
81
98
  @ApiProperty({
82
99
  description: "The discount value applied to the invoice",
@@ -150,12 +167,13 @@ export class UpdateInvoiceDto extends BaseDTO {
150
167
 
151
168
  @ApiProperty({
152
169
  description: "List of items",
153
- example: "['550e8400-e29b-41d4-a716-446655440001','550e8400-e29b-41d4-a716-446655440001' ]",
170
+ example:
171
+ "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
154
172
  required: false,
155
173
  })
156
174
  @IsNotEmpty({ message: "Please provide items for this invoice" })
157
175
  @IsArray({ message: "Please provide a list of items for this invoice" })
158
- items?: string[];
176
+ items?: InvoiceItemDto[];
159
177
 
160
178
  @ApiProperty({
161
179
  description: "The ID of the customer",