resurgence-data 1.1.16 → 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.
@@ -178,6 +178,7 @@ export declare class CreateCustomerDto extends BaseDTO {
178
178
  name: string;
179
179
  emailAddress?: string;
180
180
  phoneNumber?: string;
181
+ address?: string;
181
182
  }
182
183
  export declare class UpdateCustomerDto extends BaseDTO {
183
184
  id: string;
@@ -185,6 +186,7 @@ export declare class UpdateCustomerDto extends BaseDTO {
185
186
  name?: string;
186
187
  emailAddress?: string;
187
188
  phoneNumber?: string;
189
+ address?: string;
188
190
  }
189
191
  export declare class BillerItemCategoryDto extends BaseDTO {
190
192
  name: string;
@@ -1124,6 +1124,16 @@ __decorate([
1124
1124
  (0, class_validator_1.IsOptional)(),
1125
1125
  __metadata("design:type", String)
1126
1126
  ], CreateCustomerDto.prototype, "phoneNumber", void 0);
1127
+ __decorate([
1128
+ (0, swagger_1.ApiProperty)({
1129
+ description: "Address of the customer",
1130
+ example: "12 Fremont lane, New York",
1131
+ required: false,
1132
+ }),
1133
+ (0, class_validator_1.IsString)({ message: "Address must be a valid string" }),
1134
+ (0, class_validator_1.IsOptional)(),
1135
+ __metadata("design:type", String)
1136
+ ], CreateCustomerDto.prototype, "address", void 0);
1127
1137
  class UpdateCustomerDto extends dto_type_1.BaseDTO {
1128
1138
  }
1129
1139
  exports.UpdateCustomerDto = UpdateCustomerDto;
@@ -1177,6 +1187,16 @@ __decorate([
1177
1187
  (0, class_validator_1.IsOptional)(),
1178
1188
  __metadata("design:type", String)
1179
1189
  ], UpdateCustomerDto.prototype, "phoneNumber", void 0);
1190
+ __decorate([
1191
+ (0, swagger_1.ApiProperty)({
1192
+ description: "Address of the customer",
1193
+ example: "12 Fremont lane, New York",
1194
+ required: false,
1195
+ }),
1196
+ (0, class_validator_1.IsString)({ message: "Address must be a valid string" }),
1197
+ (0, class_validator_1.IsOptional)(),
1198
+ __metadata("design:type", String)
1199
+ ], UpdateCustomerDto.prototype, "address", void 0);
1180
1200
  class BillerItemCategoryDto extends dto_type_1.BaseDTO {
1181
1201
  }
1182
1202
  exports.BillerItemCategoryDto = BillerItemCategoryDto;
@@ -5,22 +5,26 @@ 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;
15
19
  discountType: string;
16
20
  dueDate: string;
17
- status: string;
21
+ status?: string | "PENDING";
18
22
  customer?: InvoiceCustomerDto;
19
23
  }
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;
@@ -102,7 +123,8 @@ __decorate([
102
123
  description: "Total for invoice",
103
124
  example: 20030,
104
125
  }),
105
- (0, class_validator_1.IsInt)({ message: "Discount value must be a valid number" }),
126
+ (0, class_validator_1.IsInt)({ message: "Total invoice value must be a valid number" }),
127
+ (0, class_validator_1.IsOptional)(),
106
128
  __metadata("design:type", Number)
107
129
  ], CreateInvoiceDto.prototype, "total", void 0);
108
130
  __decorate([
@@ -110,7 +132,7 @@ __decorate([
110
132
  description: "Total for invoice service charges",
111
133
  example: 1000,
112
134
  }),
113
- (0, class_validator_1.IsNumber)(undefined, { message: "Discount value must be a valid number" }),
135
+ (0, class_validator_1.IsNumber)(undefined, { message: "Service fee total value must be a valid number" }),
114
136
  __metadata("design:type", Number)
115
137
  ], CreateInvoiceDto.prototype, "totalService", void 0);
116
138
  __decorate([
@@ -127,8 +149,8 @@ __decorate([
127
149
  description: "The due date for the invoice",
128
150
  example: "2025-01-31T23:59:59Z",
129
151
  }),
130
- (0, class_validator_1.IsNotEmpty)({ message: "Due date must not be empty" }),
131
- (0, class_validator_1.IsDateString)({}, { message: "Due date must be a valid ISO 8601 date string" }),
152
+ (0, class_validator_1.IsISO8601)({}, { message: "Due date must be a valid ISO 8601 date string" }),
153
+ (0, class_validator_1.IsOptional)(),
132
154
  __metadata("design:type", String)
133
155
  ], CreateInvoiceDto.prototype, "dueDate", void 0);
134
156
  __decorate([
@@ -136,7 +158,7 @@ __decorate([
136
158
  description: "The status of the invoice",
137
159
  example: "PENDING",
138
160
  }),
139
- (0, class_validator_1.IsNotEmpty)({ message: "Status must not be empty" }),
161
+ (0, class_validator_1.IsOptional)(),
140
162
  (0, class_validator_1.IsEnum)(["PENDING", "PAID", "CANCELLED"], { message: "Status must be PENDING, PAID, or CANCELLED" }),
141
163
  __metadata("design:type", String)
142
164
  ], CreateInvoiceDto.prototype, "status", void 0);
@@ -172,7 +194,7 @@ __decorate([
172
194
  __decorate([
173
195
  (0, swagger_1.ApiProperty)({
174
196
  description: "List of items",
175
- 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}]",
176
198
  required: false,
177
199
  }),
178
200
  (0, class_validator_1.IsNotEmpty)({ message: "Please provide items for this invoice" }),
@@ -213,9 +235,8 @@ __decorate([
213
235
  (0, swagger_1.ApiProperty)({
214
236
  description: "The due date for the invoice",
215
237
  example: "2025-01-31T23:59:59Z",
216
- required: false,
217
238
  }),
218
- (0, class_validator_1.IsDateString)({}, { message: "Due date must be a valid ISO 8601 date string" }),
239
+ (0, class_validator_1.IsISO8601)({}, { message: "Due date must be a valid ISO 8601 date string" }),
219
240
  (0, class_validator_1.IsOptional)(),
220
241
  __metadata("design:type", String)
221
242
  ], UpdateInvoiceDto.prototype, "dueDate", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "DTOs and shareable resources",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -999,6 +999,15 @@ export class CreateCustomerDto extends BaseDTO {
999
999
  @IsString({ message: "Phone number must be a valid string" })
1000
1000
  @IsOptional()
1001
1001
  phoneNumber?: string;
1002
+
1003
+ @ApiProperty({
1004
+ description: "Address of the customer",
1005
+ example: "12 Fremont lane, New York",
1006
+ required: false,
1007
+ })
1008
+ @IsString({ message: "Address must be a valid string" })
1009
+ @IsOptional()
1010
+ address?: string;
1002
1011
  }
1003
1012
 
1004
1013
  export class UpdateCustomerDto extends BaseDTO {
@@ -1046,6 +1055,15 @@ export class UpdateCustomerDto extends BaseDTO {
1046
1055
  @IsString({ message: "Phone number must be a valid string" })
1047
1056
  @IsOptional()
1048
1057
  phoneNumber?: string;
1058
+
1059
+ @ApiProperty({
1060
+ description: "Address of the customer",
1061
+ example: "12 Fremont lane, New York",
1062
+ required: false,
1063
+ })
1064
+ @IsString({ message: "Address must be a valid string" })
1065
+ @IsOptional()
1066
+ address?: string;
1049
1067
  }
1050
1068
 
1051
1069
  export class BillerItemCategoryDto extends BaseDTO {
@@ -9,6 +9,7 @@ import {
9
9
  IsDateString,
10
10
  IsOptional,
11
11
  Length,
12
+ IsISO8601,
12
13
  } from "class-validator";
13
14
  import { BaseDTO } from "../types/dto.type";
14
15
 
@@ -51,6 +52,23 @@ export class InvoiceCustomerDto extends BaseDTO {
51
52
  address?: string;
52
53
  }
53
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
+
54
72
  export class CreateInvoiceDto extends BaseDTO {
55
73
  @ApiProperty({
56
74
  description: "The ID of the biller",
@@ -75,7 +93,7 @@ export class CreateInvoiceDto extends BaseDTO {
75
93
  })
76
94
  @IsNotEmpty({ message: "Please provide items for this invoice" })
77
95
  @IsArray({ message: "Please provide a list of items for this invoice" })
78
- items: string[];
96
+ items: InvoiceItemDto[];
79
97
 
80
98
  @ApiProperty({
81
99
  description: "The discount value applied to the invoice",
@@ -88,13 +106,14 @@ export class CreateInvoiceDto extends BaseDTO {
88
106
  description: "Total for invoice",
89
107
  example: 20030,
90
108
  })
91
- @IsInt({ message: "Discount value must be a valid number" })
109
+ @IsInt({ message: "Total invoice value must be a valid number" })
110
+ @IsOptional()
92
111
  total?: number;
93
112
  @ApiProperty({
94
113
  description: "Total for invoice service charges",
95
114
  example: 1000,
96
115
  })
97
- @IsNumber(undefined, { message: "Discount value must be a valid number" })
116
+ @IsNumber(undefined, { message: "Service fee total value must be a valid number" })
98
117
  totalService?: number;
99
118
 
100
119
  @ApiProperty({
@@ -109,17 +128,17 @@ export class CreateInvoiceDto extends BaseDTO {
109
128
  description: "The due date for the invoice",
110
129
  example: "2025-01-31T23:59:59Z",
111
130
  })
112
- @IsNotEmpty({ message: "Due date must not be empty" })
113
- @IsDateString({}, { message: "Due date must be a valid ISO 8601 date string" })
131
+ @IsISO8601({}, { message: "Due date must be a valid ISO 8601 date string" })
132
+ @IsOptional()
114
133
  dueDate: string;
115
134
 
116
135
  @ApiProperty({
117
136
  description: "The status of the invoice",
118
137
  example: "PENDING",
119
138
  })
120
- @IsNotEmpty({ message: "Status must not be empty" })
139
+ @IsOptional()
121
140
  @IsEnum(["PENDING", "PAID", "CANCELLED"], { message: "Status must be PENDING, PAID, or CANCELLED" })
122
- status: string;
141
+ status?: string | "PENDING";
123
142
 
124
143
  @ApiProperty({
125
144
  description: "The customer details",
@@ -148,12 +167,13 @@ export class UpdateInvoiceDto extends BaseDTO {
148
167
 
149
168
  @ApiProperty({
150
169
  description: "List of items",
151
- 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}]",
152
172
  required: false,
153
173
  })
154
174
  @IsNotEmpty({ message: "Please provide items for this invoice" })
155
175
  @IsArray({ message: "Please provide a list of items for this invoice" })
156
- items?: string[];
176
+ items?: InvoiceItemDto[];
157
177
 
158
178
  @ApiProperty({
159
179
  description: "The ID of the customer",
@@ -185,9 +205,8 @@ export class UpdateInvoiceDto extends BaseDTO {
185
205
  @ApiProperty({
186
206
  description: "The due date for the invoice",
187
207
  example: "2025-01-31T23:59:59Z",
188
- required: false,
189
208
  })
190
- @IsDateString({}, { message: "Due date must be a valid ISO 8601 date string" })
209
+ @IsISO8601({}, { message: "Due date must be a valid ISO 8601 date string" })
191
210
  @IsOptional()
192
211
  dueDate?: string;
193
212