@pedro.araujo/ml-architecture-shared 0.1.44 → 0.1.46

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.
package/dist/index.d.ts CHANGED
@@ -32,8 +32,8 @@ export * from "./bid/get-bids-by-auction-session-request.dto.js";
32
32
  export * from "./bid/get-bids-by-auction-session-request.schema.js";
33
33
  export * from "./bid/update-bid-request.dto.js";
34
34
  export * from "./bid/update-bid-request.schema.js";
35
- export * from "./item-financial-event/create-financial-event-request.dto.js";
36
- export * from "./item-financial-event/create-financial-event-request.schema.js";
35
+ export * from "./item-financial-event/create-item-financial-event-request.dto.js";
36
+ export * from "./item-financial-event/create-item-financial-event-request.schema.js";
37
37
  export * from "./item-financial-event/item-financial-event-type.enum.js";
38
38
  export * from "./item-financial-event/payment-type.enum.js";
39
39
  export * from "./item-note/create-item-note-request.dto.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mDAAmD,CAAC;AAClE,cAAc,sDAAsD,CAAC;AACrE,cAAc,iDAAiD,CAAC;AAChE,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AAEjE,cAAc,2DAA2D,CAAC;AAE1E,cAAc,uDAAuD,CAAC;AAEtE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,gEAAgE,CAAC;AAE/E,cAAc,mDAAmD,CAAC;AAElE,cAAc,iEAAiE,CAAC;AAE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";
32
32
  export * from "./bid/get-bids-by-auction-session-request.schema.js";
33
33
  export * from "./bid/update-bid-request.dto.js";
34
34
  export * from "./bid/update-bid-request.schema.js";
35
- export * from "./item-financial-event/create-financial-event-request.dto.js";
36
- export * from "./item-financial-event/create-financial-event-request.schema.js";
35
+ export * from "./item-financial-event/create-item-financial-event-request.dto.js";
36
+ export * from "./item-financial-event/create-item-financial-event-request.schema.js";
37
37
  export * from "./item-financial-event/item-financial-event-type.enum.js";
38
38
  export * from "./item-financial-event/payment-type.enum.js";
39
39
  export * from "./item-note/create-item-note-request.dto.js";
@@ -0,0 +1,13 @@
1
+ import { ItemFinancialEventType } from "./item-financial-event-type.enum.js";
2
+ import { PaymentType } from "./payment-type.enum.js";
3
+ export interface CreateItemFinancialEventRequestDTO {
4
+ auctionItemId: number;
5
+ eventType: ItemFinancialEventType;
6
+ occurredAt: string;
7
+ paymentType: PaymentType;
8
+ totalAmount: number;
9
+ downPayment?: number;
10
+ installmentsQty?: number;
11
+ note?: string;
12
+ }
13
+ //# sourceMappingURL=create-item-financial-event-request.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-item-financial-event-request.dto.d.ts","sourceRoot":"","sources":["../../src/item-financial-event/create-item-financial-event-request.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,WAAW,kCAAkC;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,sBAAsB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ import { CreateItemFinancialEventRequestDTO } from "./create-item-financial-event-request.dto.js";
3
+ export declare const CreateItemFinancialEventRequestSchema: z.ZodType<CreateItemFinancialEventRequestDTO>;
4
+ //# sourceMappingURL=create-item-financial-event-request.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-item-financial-event-request.schema.d.ts","sourceRoot":"","sources":["../../src/item-financial-event/create-item-financial-event-request.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAElG,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,OAAO,CAAC,kCAAkC,CA4D5F,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ import { ItemFinancialEventType } from "./item-financial-event-type.enum.js";
3
+ import { PaymentType } from "./payment-type.enum.js";
4
+ export const CreateItemFinancialEventRequestSchema = z.object({
5
+ auctionItemId: z.coerce.number().int().positive(),
6
+ eventType: z.enum(ItemFinancialEventType),
7
+ occurredAt: z.iso.datetime(),
8
+ paymentType: z.enum(PaymentType),
9
+ totalAmount: z.coerce.number().positive(),
10
+ downPayment: z.coerce.number().positive().optional(),
11
+ installmentsQty: z.coerce.number().int().positive().optional(),
12
+ note: z.string().max(1000).optional(),
13
+ })
14
+ .superRefine((data, ctx) => {
15
+ const { paymentType, installmentsQty, downPayment, totalAmount, } = data;
16
+ if (paymentType === PaymentType.INSTALLMENT) {
17
+ if (!installmentsQty) {
18
+ ctx.addIssue({
19
+ path: ["installmentsQty"],
20
+ message: "Quantidade de parcelas é obrigatória para pagamento parcelado",
21
+ code: z.ZodIssueCode.custom,
22
+ });
23
+ }
24
+ else if (installmentsQty < 1) {
25
+ ctx.addIssue({
26
+ path: ["installmentsQty"],
27
+ message: "Pagamento parcelado deve ter no mínimo 1 parcela",
28
+ code: z.ZodIssueCode.custom,
29
+ });
30
+ }
31
+ }
32
+ if (paymentType !== PaymentType.INSTALLMENT && installmentsQty) {
33
+ ctx.addIssue({
34
+ path: ["installmentsQty"],
35
+ message: "parcelas só são permitidas para pagamento parcelado",
36
+ code: z.ZodIssueCode.custom,
37
+ });
38
+ }
39
+ if (downPayment !== undefined) {
40
+ if (paymentType !== PaymentType.INSTALLMENT) {
41
+ ctx.addIssue({
42
+ path: ["downPayment"],
43
+ message: "entrada só é permitida para pagamento parcelado",
44
+ code: z.ZodIssueCode.custom,
45
+ });
46
+ }
47
+ if (downPayment >= totalAmount) {
48
+ ctx.addIssue({
49
+ path: ["downPayment"],
50
+ message: "entrada deve ser menor que o valor total",
51
+ code: z.ZodIssueCode.custom,
52
+ });
53
+ }
54
+ }
55
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedro.araujo/ml-architecture-shared",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",