@medusajs/order 0.1.3-preview-20240618060531 → 0.1.3-preview-20240618120636

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/dist/migrations/Migration20240604100512.js +58 -28
  2. package/dist/migrations/Migration20240604100512.js.map +1 -1
  3. package/dist/models/claim-item-image.js +4 -2
  4. package/dist/models/claim-item-image.js.map +1 -1
  5. package/dist/models/claim-item.d.ts +6 -2
  6. package/dist/models/claim-item.js +33 -4
  7. package/dist/models/claim-item.js.map +1 -1
  8. package/dist/models/claim.d.ts +3 -2
  9. package/dist/models/claim.js +14 -7
  10. package/dist/models/claim.js.map +1 -1
  11. package/dist/models/exchange-item.d.ts +23 -0
  12. package/dist/models/exchange-item.js +138 -0
  13. package/dist/models/exchange-item.js.map +1 -0
  14. package/dist/models/exchange.d.ts +3 -4
  15. package/dist/models/exchange.js +13 -16
  16. package/dist/models/exchange.js.map +1 -1
  17. package/dist/models/index.d.ts +4 -2
  18. package/dist/models/index.js +7 -3
  19. package/dist/models/index.js.map +1 -1
  20. package/dist/models/order-change-action.d.ts +6 -0
  21. package/dist/models/order-change-action.js +56 -0
  22. package/dist/models/order-change-action.js.map +1 -1
  23. package/dist/models/order-change.d.ts +6 -0
  24. package/dist/models/order-change.js +54 -0
  25. package/dist/models/order-change.js.map +1 -1
  26. package/dist/models/order-item.d.ts +0 -9
  27. package/dist/models/order-item.js +0 -76
  28. package/dist/models/order-item.js.map +1 -1
  29. package/dist/models/order-shipping-method.js +2 -0
  30. package/dist/models/order-shipping-method.js.map +1 -1
  31. package/dist/models/return-item.d.ts +28 -0
  32. package/dist/models/return-item.js +170 -0
  33. package/dist/models/return-item.js.map +1 -0
  34. package/dist/models/return.d.ts +2 -0
  35. package/dist/models/return.js +9 -2
  36. package/dist/models/return.js.map +1 -1
  37. package/dist/models/transaction.js +6 -0
  38. package/dist/models/transaction.js.map +1 -1
  39. package/dist/repositories/claim.d.ts +8 -0
  40. package/dist/repositories/claim.js +11 -0
  41. package/dist/repositories/claim.js.map +1 -0
  42. package/dist/repositories/exchange.d.ts +8 -0
  43. package/dist/repositories/exchange.js +11 -0
  44. package/dist/repositories/exchange.js.map +1 -0
  45. package/dist/repositories/index.d.ts +1 -0
  46. package/dist/repositories/index.js +3 -1
  47. package/dist/repositories/index.js.map +1 -1
  48. package/dist/services/actions/create-claim.d.ts +2 -0
  49. package/dist/services/actions/create-claim.js +229 -0
  50. package/dist/services/actions/create-claim.js.map +1 -0
  51. package/dist/services/actions/create-exchange.d.ts +2 -0
  52. package/dist/services/actions/create-exchange.js +194 -0
  53. package/dist/services/actions/create-exchange.js.map +1 -0
  54. package/dist/services/actions/create-return.js +55 -34
  55. package/dist/services/actions/create-return.js.map +1 -1
  56. package/dist/services/actions/index.d.ts +2 -0
  57. package/dist/services/actions/index.js +2 -0
  58. package/dist/services/actions/index.js.map +1 -1
  59. package/dist/services/actions/receive-return.js +52 -31
  60. package/dist/services/actions/receive-return.js.map +1 -1
  61. package/dist/services/order-module-service.d.ts +38 -13
  62. package/dist/services/order-module-service.js +220 -10
  63. package/dist/services/order-module-service.js.map +1 -1
  64. package/dist/utils/actions/index.d.ts +1 -0
  65. package/dist/utils/actions/index.js +1 -0
  66. package/dist/utils/actions/index.js.map +1 -1
  67. package/dist/utils/actions/item-add.js +4 -7
  68. package/dist/utils/actions/item-add.js.map +1 -1
  69. package/dist/utils/actions/item-remove.js +4 -4
  70. package/dist/utils/actions/item-remove.js.map +1 -1
  71. package/dist/utils/apply-order-changes.js +14 -13
  72. package/dist/utils/apply-order-changes.js.map +1 -1
  73. package/dist/utils/base-repository-find.js +30 -33
  74. package/dist/utils/base-repository-find.js.map +1 -1
  75. package/dist/utils/calculate-order-change.js +5 -1
  76. package/dist/utils/calculate-order-change.js.map +1 -1
  77. package/dist/utils/transform-order.d.ts +3 -2
  78. package/dist/utils/transform-order.js +84 -17
  79. package/dist/utils/transform-order.js.map +1 -1
  80. package/package.json +5 -5
@@ -21,31 +21,6 @@ class Migration20240604100512 extends migrations_1.Migration {
21
21
 
22
22
 
23
23
 
24
- ALTER TABLE "order_item"
25
- ADD COLUMN if NOT exists "return_id" TEXT NULL;
26
-
27
- ALTER TABLE "order_item"
28
- ADD COLUMN if NOT exists "claim_id" TEXT NULL;
29
-
30
- ALTER TABLE "order_item"
31
- ADD COLUMN if NOT exists "exchange_id" TEXT NULL;
32
-
33
- CREATE INDEX IF NOT EXISTS "IDX_order_item_return_id" ON "order_item" (
34
- return_id
35
- )
36
- WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
37
-
38
- CREATE INDEX IF NOT EXISTS "IDX_order_item_claim_id" ON "order_item" (
39
- claim_id
40
- )
41
- WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
42
-
43
- CREATE INDEX IF NOT EXISTS "IDX_order_item_exchange_id" ON "order_item" (
44
- exchange_id
45
- )
46
- WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
47
-
48
-
49
24
 
50
25
  ALTER TABLE "order_transaction"
51
26
  ADD COLUMN if NOT exists "return_id" TEXT NULL;
@@ -207,6 +182,36 @@ class Migration20240604100512 extends migrations_1.Migration {
207
182
  WHERE deleted_at IS NOT NULL;
208
183
 
209
184
 
185
+ CREATE TABLE IF NOT EXISTS "return_item" (
186
+ "id" TEXT NOT NULL,
187
+ "return_id" TEXT NOT NULL,
188
+ "reason_id" TEXT NULL,
189
+ "item_id" TEXT NOT NULL,
190
+ "quantity" NUMERIC NOT NULL,
191
+ "raw_quantity" JSONB NOT NULL,
192
+ "received_quantity" NUMERIC NOT NULL DEFAULT 0,
193
+ "raw_received_quantity" JSONB NOT NULL,
194
+ "note" TEXT NULL,
195
+ "metadata" JSONB NULL,
196
+ "created_at" timestamptz NOT NULL DEFAULT now(),
197
+ "updated_at" timestamptz NOT NULL DEFAULT now(),
198
+ "deleted_at" timestamptz NULL,
199
+ CONSTRAINT "return_item_pkey" PRIMARY KEY ("id")
200
+ );
201
+
202
+ CREATE INDEX IF NOT EXISTS "IDX_return_item_deleted_at" ON "return_item" ("deleted_at")
203
+ WHERE deleted_at IS NOT NULL;
204
+
205
+ CREATE INDEX IF NOT EXISTS "IDX_return_item_return_id" ON "return_item" ("return_id")
206
+ WHERE deleted_at IS NOT NULL;
207
+
208
+ CREATE INDEX IF NOT EXISTS "IDX_return_item_item_id" ON "return_item" ("item_id")
209
+ WHERE deleted_at IS NOT NULL;
210
+
211
+ CREATE INDEX IF NOT EXISTS "IDX_return_item_reason_id" ON "return_item" ("reason_id")
212
+ WHERE deleted_at IS NOT NULL;
213
+
214
+
210
215
 
211
216
  CREATE TABLE IF NOT EXISTS "order_exchange" (
212
217
  "id" TEXT NOT NULL,
@@ -215,8 +220,6 @@ class Migration20240604100512 extends migrations_1.Migration {
215
220
  "order_version" INTEGER NOT NULL,
216
221
  "display_id" SERIAL,
217
222
  "no_notification" BOOLEAN NULL,
218
- "refund_amount" NUMERIC NULL,
219
- "raw_refund_amount" JSONB NULL,
220
223
  "allow_backorder" BOOLEAN NOT NULL DEFAULT FALSE,
221
224
  "difference_due" NUMERIC NULL,
222
225
  "raw_difference_due" JSONB NULL,
@@ -241,6 +244,30 @@ class Migration20240604100512 extends migrations_1.Migration {
241
244
  WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
242
245
 
243
246
 
247
+ CREATE TABLE IF NOT EXISTS "order_exchange_item" (
248
+ "id" TEXT NOT NULL,
249
+ "exchange_id" TEXT NOT NULL,
250
+ "item_id" TEXT NOT NULL,
251
+ "quantity" NUMERIC NOT NULL,
252
+ "raw_quantity" JSONB NOT NULL,
253
+ "note" TEXT NULL,
254
+ "metadata" JSONB NULL,
255
+ "created_at" timestamptz NOT NULL DEFAULT now(),
256
+ "updated_at" timestamptz NOT NULL DEFAULT now(),
257
+ "deleted_at" timestamptz NULL,
258
+ CONSTRAINT "order_exchange_item_pkey" PRIMARY KEY ("id")
259
+ );
260
+
261
+ CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_deleted_at" ON "order_exchange_item" ("deleted_at")
262
+ WHERE deleted_at IS NOT NULL;
263
+
264
+ CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_exchange_id" ON "order_exchange_item" ("exchange_id")
265
+ WHERE deleted_at IS NOT NULL;
266
+
267
+ CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_item_id" ON "order_exchange_item" ("item_id")
268
+ WHERE deleted_at IS NOT NULL;
269
+
270
+
244
271
 
245
272
  CREATE TYPE order_claim_type_enum AS ENUM (
246
273
  'refund',
@@ -290,7 +317,10 @@ class Migration20240604100512 extends migrations_1.Migration {
290
317
  "id" TEXT NOT NULL,
291
318
  "claim_id" TEXT NOT NULL,
292
319
  "item_id" TEXT NOT NULL,
293
- "reason" claim_reason_enum NOT NULL,
320
+ "is_additional_item" BOOLEAN NOT NULL DEFAULT FALSE,
321
+ "reason" claim_reason_enum NULL,
322
+ "quantity" NUMERIC NOT NULL,
323
+ "raw_quantity" JSONB NOT NULL,
294
324
  "note" TEXT NULL,
295
325
  "metadata" JSONB NULL,
296
326
  "created_at" timestamptz NOT NULL DEFAULT now(),
@@ -1 +1 @@
1
- {"version":3,"file":"Migration20240604100512.js","sourceRoot":"","sources":["../../src/migrations/Migration20240604100512.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkUX,CAAA;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;CACF;AAvUD,0DAuUC"}
1
+ {"version":3,"file":"Migration20240604100512.js","sourceRoot":"","sources":["../../src/migrations/Migration20240604100512.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgWX,CAAA;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;CACF;AArWD,0DAqWC"}
@@ -31,10 +31,12 @@ let ClaimItemImage = class ClaimItemImage {
31
31
  this.deleted_at = null;
32
32
  }
33
33
  onCreate() {
34
- this.id = (0, utils_1.generateEntityId)(this.id, "ordclaimimg");
34
+ this.id = (0, utils_1.generateEntityId)(this.id, "climg");
35
+ this.claim_item_id = this.item?.id;
35
36
  }
36
37
  onInit() {
37
- this.id = (0, utils_1.generateEntityId)(this.id, "ordclaimimg");
38
+ this.id = (0, utils_1.generateEntityId)(this.id, "climg");
39
+ this.claim_item_id = this.item?.id;
38
40
  }
39
41
  };
40
42
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"claim-item-image.js","sourceRoot":"","sources":["../../src/models/claim-item-image.ts"],"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AAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;kDAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,4BAA4B,CAAC,aAAa,EAAE;;kDACf;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;8CAId;AAGD;IADC,IAAA,aAAM,GAAE;;;;4CAIR;AAvDkB,cAAc;IADlC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;GAC3B,cAAc,CAwDlC;kBAxDoB,cAAc"}
@@ -1,4 +1,4 @@
1
- import { DAL } from "@medusajs/types";
1
+ import { BigNumberRawValue, DAL } from "@medusajs/types";
2
2
  import { ClaimReason } from "@medusajs/utils";
3
3
  import { Collection, OptionalProps } from "@mikro-orm/core";
4
4
  import Claim from "./claim";
@@ -9,15 +9,19 @@ export default class OrderClaimItem {
9
9
  [OptionalProps]?: OptionalLineItemProps;
10
10
  id: string;
11
11
  images: Collection<ClaimItemImage, object>;
12
- reason: ClaimReason;
12
+ reason: ClaimReason | null;
13
+ quantity: Number | number;
14
+ raw_quantity: BigNumberRawValue;
13
15
  claim_id: string;
14
16
  claim: Claim;
15
17
  item_id: string;
16
18
  item: LineItem;
19
+ is_additional_item: boolean;
17
20
  note: string;
18
21
  metadata: Record<string, unknown> | null;
19
22
  created_at: Date;
20
23
  updated_at: Date;
24
+ deleted_at: Date | null;
21
25
  onCreate(): void;
22
26
  onInit(): void;
23
27
  }
@@ -20,21 +20,33 @@ const line_item_1 = __importDefault(require("./line-item"));
20
20
  const ClaimIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
21
21
  tableName: "order_claim_item",
22
22
  columns: "claim_id",
23
+ where: "deleted_at IS NOT NULL",
23
24
  });
24
25
  const ItemIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
25
26
  tableName: "order_claim_item",
26
27
  columns: "item_id",
28
+ where: "deleted_at IS NOT NULL",
29
+ });
30
+ const DeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
31
+ tableName: "order_claim_item_image",
32
+ columns: "deleted_at",
33
+ where: "deleted_at IS NOT NULL",
27
34
  });
28
35
  let OrderClaimItem = class OrderClaimItem {
29
36
  constructor() {
30
37
  this.images = new core_1.Collection(this);
38
+ this.reason = null;
39
+ this.is_additional_item = false;
31
40
  this.metadata = null;
41
+ this.deleted_at = null;
32
42
  }
33
43
  onCreate() {
34
- this.id = (0, utils_1.generateEntityId)(this.id, "ordclaimitem");
44
+ this.id = (0, utils_1.generateEntityId)(this.id, "claitem");
45
+ this.claim_id = this.claim?.id;
35
46
  }
36
47
  onInit() {
37
- this.id = (0, utils_1.generateEntityId)(this.id, "ordclaimitem");
48
+ this.id = (0, utils_1.generateEntityId)(this.id, "claitem");
49
+ this.claim_id = this.claim?.id;
38
50
  }
39
51
  };
40
52
  __decorate([
@@ -48,9 +60,17 @@ __decorate([
48
60
  __metadata("design:type", Object)
49
61
  ], OrderClaimItem.prototype, "images", void 0);
50
62
  __decorate([
51
- (0, core_1.Enum)({ items: () => utils_1.ClaimReason }),
52
- __metadata("design:type", String)
63
+ (0, core_1.Enum)({ items: () => utils_1.ClaimReason, nullable: true }),
64
+ __metadata("design:type", Object)
53
65
  ], OrderClaimItem.prototype, "reason", void 0);
66
+ __decorate([
67
+ (0, utils_1.MikroOrmBigNumberProperty)(),
68
+ __metadata("design:type", Number)
69
+ ], OrderClaimItem.prototype, "quantity", void 0);
70
+ __decorate([
71
+ (0, core_1.Property)({ columnType: "jsonb" }),
72
+ __metadata("design:type", Object)
73
+ ], OrderClaimItem.prototype, "raw_quantity", void 0);
54
74
  __decorate([
55
75
  (0, core_1.ManyToOne)(() => claim_1.default, {
56
76
  columnType: "text",
@@ -83,6 +103,10 @@ __decorate([
83
103
  }),
84
104
  __metadata("design:type", line_item_1.default)
85
105
  ], OrderClaimItem.prototype, "item", void 0);
106
+ __decorate([
107
+ (0, core_1.Property)({ columnType: "boolean", default: false }),
108
+ __metadata("design:type", Boolean)
109
+ ], OrderClaimItem.prototype, "is_additional_item", void 0);
86
110
  __decorate([
87
111
  (0, core_1.Property)({ columnType: "text", nullable: true }),
88
112
  __metadata("design:type", String)
@@ -108,6 +132,11 @@ __decorate([
108
132
  }),
109
133
  __metadata("design:type", Date)
110
134
  ], OrderClaimItem.prototype, "updated_at", void 0);
135
+ __decorate([
136
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
137
+ DeletedAtIndex.MikroORMIndex(),
138
+ __metadata("design:type", Object)
139
+ ], OrderClaimItem.prototype, "deleted_at", void 0);
111
140
  __decorate([
112
141
  (0, core_1.BeforeCreate)(),
113
142
  __metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"claim-item.js","sourceRoot":"","sources":["../../src/models/claim-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2CAIwB;AACxB,0CAYwB;AACxB,oDAA2B;AAC3B,0EAA+C;AAC/C,4DAAkC;AAIlC,MAAM,YAAY,GAAG,IAAA,sCAA8B,EAAC;IAClD,SAAS,EAAE,kBAAkB;IAC7B,OAAO,EAAE,UAAU;CACpB,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,IAAA,sCAA8B,EAAC;IACjD,SAAS,EAAE,kBAAkB;IAC7B,OAAO,EAAE,SAAS;CACnB,CAAC,CAAA;AAGa,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QASb,WAAM,GAAG,IAAI,iBAAU,CAAiB,IAAI,CAAC,CAAA;QAqC7C,aAAQ,GAAmC,IAAI,CAAA;IA0BjD,CAAC;IARC,QAAQ;QACN,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,E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EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;kDAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,cAAc,CAAC,aAAa,EAAE;;kDACD;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;8CAId;AAGD;IADC,IAAA,aAAM,GAAE;;;;4CAIR;AAtFkB,cAAc;IADlC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;GACrB,cAAc,CAuFlC;kBAvFoB,cAAc"}
@@ -3,9 +3,9 @@ import { BigNumber, ClaimType } from "@medusajs/utils";
3
3
  import { Collection, OptionalProps } from "@mikro-orm/core";
4
4
  import ClaimItem from "./claim-item";
5
5
  import Order from "./order";
6
- import OrderItem from "./order-item";
7
6
  import OrderShippingMethod from "./order-shipping-method";
8
7
  import Return from "./return";
8
+ import Transaction from "./transaction";
9
9
  type OptionalOrderClaimProps = DAL.EntityDateColumns;
10
10
  export default class OrderClaim {
11
11
  [OptionalProps]?: OptionalOrderClaimProps;
@@ -20,9 +20,10 @@ export default class OrderClaim {
20
20
  no_notification: boolean | null;
21
21
  refund_amount: BigNumber | number;
22
22
  raw_refund_amount: BigNumberRawValue;
23
- items: Collection<OrderItem, object>;
23
+ additional_items: Collection<ClaimItem, object>;
24
24
  claim_items: Collection<ClaimItem, object>;
25
25
  shipping_methods: Collection<OrderShippingMethod, object>;
26
+ transactions: Collection<Transaction, object>;
26
27
  metadata: Record<string, unknown> | null;
27
28
  created_at: Date;
28
29
  updated_at: Date;
@@ -16,9 +16,9 @@ const utils_1 = require("@medusajs/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
17
  const claim_item_1 = __importDefault(require("./claim-item"));
18
18
  const order_1 = __importDefault(require("./order"));
19
- const order_item_1 = __importDefault(require("./order-item"));
20
19
  const order_shipping_method_1 = __importDefault(require("./order-shipping-method"));
21
20
  const return_1 = __importDefault(require("./return"));
21
+ const transaction_1 = __importDefault(require("./transaction"));
22
22
  const DisplayIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
23
23
  tableName: "order_claim",
24
24
  columns: "display_id",
@@ -43,18 +43,19 @@ let OrderClaim = class OrderClaim {
43
43
  constructor() {
44
44
  this.return_id = null;
45
45
  this.no_notification = null;
46
- this.items = new core_1.Collection(this);
46
+ this.additional_items = new core_1.Collection(this);
47
47
  this.claim_items = new core_1.Collection(this);
48
48
  this.shipping_methods = new core_1.Collection(this);
49
+ this.transactions = new core_1.Collection(this);
49
50
  this.metadata = null;
50
51
  this.deleted_at = null;
51
52
  this.canceled_at = null;
52
53
  }
53
54
  onCreate() {
54
- this.id = (0, utils_1.generateEntityId)(this.id, "ordclaim");
55
+ this.id = (0, utils_1.generateEntityId)(this.id, "claim");
55
56
  }
56
57
  onInit() {
57
- this.id = (0, utils_1.generateEntityId)(this.id, "ordclaim");
58
+ this.id = (0, utils_1.generateEntityId)(this.id, "claim");
58
59
  }
59
60
  };
60
61
  __decorate([
@@ -123,13 +124,13 @@ __decorate([
123
124
  __metadata("design:type", Object)
124
125
  ], OrderClaim.prototype, "raw_refund_amount", void 0);
125
126
  __decorate([
126
- (0, core_1.OneToMany)(() => order_item_1.default, (itemDetail) => itemDetail.claim, {
127
+ (0, core_1.OneToMany)(() => claim_item_1.default, (item) => item.claim, {
127
128
  cascade: [core_1.Cascade.PERSIST],
128
129
  }),
129
130
  __metadata("design:type", Object)
130
- ], OrderClaim.prototype, "items", void 0);
131
+ ], OrderClaim.prototype, "additional_items", void 0);
131
132
  __decorate([
132
- (0, core_1.OneToMany)(() => claim_item_1.default, (itemDetail) => itemDetail.claim, {
133
+ (0, core_1.OneToMany)(() => claim_item_1.default, (item) => item.claim, {
133
134
  cascade: [core_1.Cascade.PERSIST],
134
135
  }),
135
136
  __metadata("design:type", Object)
@@ -140,6 +141,12 @@ __decorate([
140
141
  }),
141
142
  __metadata("design:type", Object)
142
143
  ], OrderClaim.prototype, "shipping_methods", void 0);
144
+ __decorate([
145
+ (0, core_1.OneToMany)(() => transaction_1.default, (transaction) => transaction.claim, {
146
+ cascade: [core_1.Cascade.PERSIST],
147
+ }),
148
+ __metadata("design:type", Object)
149
+ ], OrderClaim.prototype, "transactions", void 0);
143
150
  __decorate([
144
151
  (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
145
152
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/models/claim.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2CAMwB;AACxB,0CAawB;AACxB,8DAAoC;AACpC,oDAA2B;AAC3B,8DAAoC;AACpC,oFAAyD;AACzD,sDAA6B;AAI7B,MAAM,cAAc,GAAG,IAAA,sCAA8B,EAAC;IACpD,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,wBAAwB,GAAG,IAAA,sCAA8B,EAAC;IAC9D,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,IAAA,sCAA8B,EAAC;IAClD,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,aAAa,GAAG,IAAA,sCAA8B,EAAC;IACnD,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,kDAAkD;CAC1D,CAAC,CAAA;AAGa,IAAM,UAAU,GAAhB,MAAM,UAAU;IAAhB;QAgCb,cAAS,GAAkB,IAAI,CAAA;QAe/B,oBAAe,GAAmB,IAAI,CAAA;QAatC,UAAK,GAAG,IAAI,iBAAU,CAAY,IAAI,CAAC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BACU,IAAI;8CAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,wBAAwB,CAAC,aAAa,EAAE;;8CACX;AAG9B;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACzB;AAG/B;IADC,IAAA,mBAAY,GAAE;;;;0CAGd;AAGD;IADC,IAAA,aAAM,GAAE;;;;wCAGR;AAlHkB,UAAU;IAD9B,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;GAChB,UAAU,CAmH9B;kBAnHoB,UAAU"}
@@ -0,0 +1,23 @@
1
+ import { BigNumberRawValue, DAL } from "@medusajs/types";
2
+ import { OptionalProps } from "@mikro-orm/core";
3
+ import Exchange from "./exchange";
4
+ import LineItem from "./line-item";
5
+ type OptionalLineItemProps = DAL.EntityDateColumns;
6
+ export default class OrderExchangeItem {
7
+ [OptionalProps]?: OptionalLineItemProps;
8
+ id: string;
9
+ quantity: Number | number;
10
+ raw_quantity: BigNumberRawValue;
11
+ exchange_id: string;
12
+ exchange: Exchange;
13
+ item_id: string;
14
+ item: LineItem;
15
+ note: string;
16
+ metadata: Record<string, unknown> | null;
17
+ created_at: Date;
18
+ updated_at: Date;
19
+ deleted_at: Date | null;
20
+ onCreate(): void;
21
+ onInit(): void;
22
+ }
23
+ export {};
@@ -0,0 +1,138 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const utils_1 = require("@medusajs/utils");
16
+ const core_1 = require("@mikro-orm/core");
17
+ const exchange_1 = __importDefault(require("./exchange"));
18
+ const line_item_1 = __importDefault(require("./line-item"));
19
+ const ExchangeIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
20
+ tableName: "order_exchange_item",
21
+ columns: "exchange_id",
22
+ where: "deleted_at IS NOT NULL",
23
+ });
24
+ const ItemIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
25
+ tableName: "order_exchange_item",
26
+ columns: "item_id",
27
+ where: "deleted_at IS NOT NULL",
28
+ });
29
+ const DeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
30
+ tableName: "order_claim_item_image",
31
+ columns: "deleted_at",
32
+ where: "deleted_at IS NOT NULL",
33
+ });
34
+ let OrderExchangeItem = class OrderExchangeItem {
35
+ constructor() {
36
+ this.metadata = null;
37
+ this.deleted_at = null;
38
+ }
39
+ onCreate() {
40
+ this.id = (0, utils_1.generateEntityId)(this.id, "oexcitem");
41
+ this.exchange_id = this.exchange?.id;
42
+ }
43
+ onInit() {
44
+ this.id = (0, utils_1.generateEntityId)(this.id, "oexcitem");
45
+ this.exchange_id = this.exchange?.id;
46
+ }
47
+ };
48
+ __decorate([
49
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
50
+ __metadata("design:type", String)
51
+ ], OrderExchangeItem.prototype, "id", void 0);
52
+ __decorate([
53
+ (0, utils_1.MikroOrmBigNumberProperty)(),
54
+ __metadata("design:type", Number)
55
+ ], OrderExchangeItem.prototype, "quantity", void 0);
56
+ __decorate([
57
+ (0, core_1.Property)({ columnType: "jsonb" }),
58
+ __metadata("design:type", Object)
59
+ ], OrderExchangeItem.prototype, "raw_quantity", void 0);
60
+ __decorate([
61
+ (0, core_1.ManyToOne)(() => exchange_1.default, {
62
+ columnType: "text",
63
+ fieldName: "exchange_id",
64
+ mapToPk: true,
65
+ onDelete: "cascade",
66
+ }),
67
+ ExchangeIdIndex.MikroORMIndex(),
68
+ __metadata("design:type", String)
69
+ ], OrderExchangeItem.prototype, "exchange_id", void 0);
70
+ __decorate([
71
+ (0, core_1.ManyToOne)(() => exchange_1.default, {
72
+ persist: false,
73
+ }),
74
+ __metadata("design:type", exchange_1.default)
75
+ ], OrderExchangeItem.prototype, "exchange", void 0);
76
+ __decorate([
77
+ (0, core_1.ManyToOne)({
78
+ entity: () => line_item_1.default,
79
+ fieldName: "item_id",
80
+ mapToPk: true,
81
+ columnType: "text",
82
+ }),
83
+ ItemIdIndex.MikroORMIndex(),
84
+ __metadata("design:type", String)
85
+ ], OrderExchangeItem.prototype, "item_id", void 0);
86
+ __decorate([
87
+ (0, core_1.ManyToOne)(() => line_item_1.default, {
88
+ persist: false,
89
+ }),
90
+ __metadata("design:type", line_item_1.default)
91
+ ], OrderExchangeItem.prototype, "item", void 0);
92
+ __decorate([
93
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
94
+ __metadata("design:type", String)
95
+ ], OrderExchangeItem.prototype, "note", void 0);
96
+ __decorate([
97
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
98
+ __metadata("design:type", Object)
99
+ ], OrderExchangeItem.prototype, "metadata", void 0);
100
+ __decorate([
101
+ (0, core_1.Property)({
102
+ onCreate: () => new Date(),
103
+ columnType: "timestamptz",
104
+ defaultRaw: "now()",
105
+ }),
106
+ __metadata("design:type", Date)
107
+ ], OrderExchangeItem.prototype, "created_at", void 0);
108
+ __decorate([
109
+ (0, core_1.Property)({
110
+ onCreate: () => new Date(),
111
+ onUpdate: () => new Date(),
112
+ columnType: "timestamptz",
113
+ defaultRaw: "now()",
114
+ }),
115
+ __metadata("design:type", Date)
116
+ ], OrderExchangeItem.prototype, "updated_at", void 0);
117
+ __decorate([
118
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
119
+ DeletedAtIndex.MikroORMIndex(),
120
+ __metadata("design:type", Object)
121
+ ], OrderExchangeItem.prototype, "deleted_at", void 0);
122
+ __decorate([
123
+ (0, core_1.BeforeCreate)(),
124
+ __metadata("design:type", Function),
125
+ __metadata("design:paramtypes", []),
126
+ __metadata("design:returntype", void 0)
127
+ ], OrderExchangeItem.prototype, "onCreate", null);
128
+ __decorate([
129
+ (0, core_1.OnInit)(),
130
+ __metadata("design:type", Function),
131
+ __metadata("design:paramtypes", []),
132
+ __metadata("design:returntype", void 0)
133
+ ], OrderExchangeItem.prototype, "onInit", null);
134
+ OrderExchangeItem = __decorate([
135
+ (0, core_1.Entity)({ tableName: "order_exchange_item" })
136
+ ], OrderExchangeItem);
137
+ exports.default = OrderExchangeItem;
138
+ //# sourceMappingURL=exchange-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange-item.js","sourceRoot":"","sources":["../../src/models/exchange-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2CAIwB;AACxB,0CAQwB;AACxB,0DAAiC;AACjC,4DAAkC;AAIlC,MAAM,eAAe,GAAG,IAAA,sCAA8B,EAAC;IACrD,SAAS,EAAE,qBAAqB;IAChC,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,IAAA,sCAA8B,EAAC;IACjD,SAAS,EAAE,qBAAqB;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,cAAc,GAAG,IAAA,sCAA8B,EAAC;IACpD,SAAS,EAAE,wBAAwB;IACnC,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAGa,IAAM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f;IAHC,IAAA,gBAAS,EAAC,GAAG,EAAE,CAAC,mBAAQ,EAAE;QACzB,OAAO,EAAE,KAAK;KACf,CAAC;8BACI,mBAAQ;+CAAA;AAGd;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACrC;AAGZ;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACH;AAO/C;IALC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;qDAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;qDAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,cAAc,CAAC,aAAa,EAAE;;qDACD;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;iDAId;AAGD;IADC,IAAA,aAAM,GAAE;;;;+CAIR;AA3EkB,iBAAiB;IADrC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;GACxB,iBAAiB,CA4ErC;kBA5EoB,iBAAiB"}
@@ -1,8 +1,8 @@
1
1
  import { BigNumberRawValue, DAL } from "@medusajs/types";
2
2
  import { BigNumber } from "@medusajs/utils";
3
3
  import { Collection, OptionalProps } from "@mikro-orm/core";
4
+ import { ExchangeItem, Transaction } from ".";
4
5
  import Order from "./order";
5
- import OrderItem from "./order-item";
6
6
  import OrderShippingMethod from "./order-shipping-method";
7
7
  import Return from "./return";
8
8
  type OptionalOrderExchangeProps = DAL.EntityDateColumns;
@@ -16,13 +16,12 @@ export default class OrderExchange {
16
16
  order_version: number;
17
17
  display_id: number;
18
18
  no_notification: boolean | null;
19
- refund_amount: BigNumber | number;
20
- raw_refund_amount: BigNumberRawValue;
21
19
  difference_due: BigNumber | number;
22
20
  raw_difference_due: BigNumberRawValue;
23
21
  allow_backorder: boolean;
24
- items: Collection<OrderItem, object>;
22
+ additional_items: Collection<ExchangeItem, object>;
25
23
  shipping_methods: Collection<OrderShippingMethod, object>;
24
+ transactions: Collection<Transaction, object>;
26
25
  metadata: Record<string, unknown> | null;
27
26
  created_at: Date;
28
27
  updated_at: Date;
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const utils_1 = require("@medusajs/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
+ const _models_1 = require(".");
17
18
  const order_1 = __importDefault(require("./order"));
18
- const order_item_1 = __importDefault(require("./order-item"));
19
19
  const order_shipping_method_1 = __importDefault(require("./order-shipping-method"));
20
20
  const return_1 = __importDefault(require("./return"));
21
21
  const DisplayIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
@@ -43,17 +43,18 @@ let OrderExchange = class OrderExchange {
43
43
  this.return_id = null;
44
44
  this.no_notification = null;
45
45
  this.allow_backorder = false;
46
- this.items = new core_1.Collection(this);
46
+ this.additional_items = new core_1.Collection(this);
47
47
  this.shipping_methods = new core_1.Collection(this);
48
+ this.transactions = new core_1.Collection(this);
48
49
  this.metadata = null;
49
50
  this.deleted_at = null;
50
51
  this.canceled_at = null;
51
52
  }
52
53
  onCreate() {
53
- this.id = (0, utils_1.generateEntityId)(this.id, "ordexchange");
54
+ this.id = (0, utils_1.generateEntityId)(this.id, "oexc");
54
55
  }
55
56
  onInit() {
56
- this.id = (0, utils_1.generateEntityId)(this.id, "ordexchange");
57
+ this.id = (0, utils_1.generateEntityId)(this.id, "oexc");
57
58
  }
58
59
  };
59
60
  __decorate([
@@ -107,16 +108,6 @@ __decorate([
107
108
  (0, core_1.Property)({ columnType: "boolean", nullable: true }),
108
109
  __metadata("design:type", Object)
109
110
  ], OrderExchange.prototype, "no_notification", void 0);
110
- __decorate([
111
- (0, utils_1.MikroOrmBigNumberProperty)({
112
- nullable: true,
113
- }),
114
- __metadata("design:type", Object)
115
- ], OrderExchange.prototype, "refund_amount", void 0);
116
- __decorate([
117
- (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
118
- __metadata("design:type", Object)
119
- ], OrderExchange.prototype, "raw_refund_amount", void 0);
120
111
  __decorate([
121
112
  (0, utils_1.MikroOrmBigNumberProperty)({
122
113
  nullable: true,
@@ -132,17 +123,23 @@ __decorate([
132
123
  __metadata("design:type", Boolean)
133
124
  ], OrderExchange.prototype, "allow_backorder", void 0);
134
125
  __decorate([
135
- (0, core_1.OneToMany)(() => order_item_1.default, (itemDetail) => itemDetail.exchange, {
126
+ (0, core_1.OneToMany)(() => _models_1.ExchangeItem, (item) => item.exchange, {
136
127
  cascade: [core_1.Cascade.PERSIST],
137
128
  }),
138
129
  __metadata("design:type", Object)
139
- ], OrderExchange.prototype, "items", void 0);
130
+ ], OrderExchange.prototype, "additional_items", void 0);
140
131
  __decorate([
141
132
  (0, core_1.OneToMany)(() => order_shipping_method_1.default, (shippingMethod) => shippingMethod.exchange, {
142
133
  cascade: [core_1.Cascade.PERSIST],
143
134
  }),
144
135
  __metadata("design:type", Object)
145
136
  ], OrderExchange.prototype, "shipping_methods", void 0);
137
+ __decorate([
138
+ (0, core_1.OneToMany)(() => _models_1.Transaction, (transaction) => transaction.exchange, {
139
+ cascade: [core_1.Cascade.PERSIST],
140
+ }),
141
+ __metadata("design:type", Object)
142
+ ], OrderExchange.prototype, "transactions", void 0);
146
143
  __decorate([
147
144
  (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
148
145
  __metadata("design:type", Object)