|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
import { OrderShippingMethodAdjustment } from "./shipping-method-adjustment" |
|
3
|
import { OrderShippingMethodTaxLine } from "./shipping-method-tax-line" |
|
4
|
|
|
5
|
const _OrderShippingMethod = model |
|
6
|
.define("OrderShippingMethod", { |
|
7
|
id: model.id({ prefix: "ordsm" }).primaryKey(), |
|
8
|
name: model.text(), |
|
9
|
description: model.json().nullable(), |
|
10
|
amount: model.bigNumber(), |
|
11
|
is_tax_inclusive: model.boolean().default(false), |
|
12
|
is_custom_amount: model.boolean().default(false), |
|
13
|
shipping_option_id: model.text().nullable(), |
|
14
|
data: model.json().nullable(), |
|
15
|
metadata: model.json().nullable(), |
|
16
|
tax_lines: model.hasMany<() => typeof OrderShippingMethodTaxLine>( |
|
17
|
() => OrderShippingMethodTaxLine, |
|
18
|
{ |
|
19
|
mappedBy: "shipping_method", |
|
20
|
} |
|
21
|
), |
|
22
|
adjustments: model.hasMany<() => typeof OrderShippingMethodAdjustment>( |
|
23
|
() => OrderShippingMethodAdjustment, |
|
24
|
{ |
|
25
|
mappedBy: "shipping_method", |
|
26
|
} |
|
27
|
), |
|
28
|
}) |
|
29
|
.cascades({ |
|
30
|
delete: ["tax_lines", "adjustments"], |
|
31
|
}) |
|
32
|
.indexes([ |
|
33
|
{ |
|
34
|
name: "IDX_order_shipping_method_shipping_option_id", |
|
35
|
on: ["shipping_option_id"], |
|
36
|
unique: false, |
|
37
|
}, |
|
38
|
]) |
|
39
|
|
|
40
|
export const OrderShippingMethod = _OrderShippingMethod |