feat(cart): Shipping methods (#6101)
This commit is contained in:
@@ -94,13 +94,13 @@ export default class LineItem {
|
||||
@Property({ columnType: "jsonb", nullable: true })
|
||||
variant_option_values?: Record<string, unknown> | null
|
||||
|
||||
@Property({ columnType: "boolean", default: true })
|
||||
@Property({ columnType: "boolean" })
|
||||
requires_shipping = true
|
||||
|
||||
@Property({ columnType: "boolean", default: true })
|
||||
@Property({ columnType: "boolean" })
|
||||
is_discountable = true
|
||||
|
||||
@Property({ columnType: "boolean", default: false })
|
||||
@Property({ columnType: "boolean" })
|
||||
is_tax_inclusive = false
|
||||
|
||||
@Property({ columnType: "numeric", nullable: true })
|
||||
|
||||
@@ -16,16 +16,20 @@ import ShippingMethodAdjustmentLine from "./shipping-method-adjustment-line"
|
||||
import ShippingMethodTaxLine from "./shipping-method-tax-line"
|
||||
|
||||
@Entity({ tableName: "cart_shipping_method" })
|
||||
@Check<ShippingMethod>({ expression: (columns) => `${columns.amount} >= 0` })
|
||||
export default class ShippingMethod {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
|
||||
@Property({ columnType: "text" })
|
||||
cart_id: string
|
||||
|
||||
@ManyToOne(() => Cart, {
|
||||
onDelete: "cascade",
|
||||
index: "IDX_shipping_method_cart_id",
|
||||
fieldName: "cart_id",
|
||||
nullable: true,
|
||||
})
|
||||
cart: Cart
|
||||
cart?: Cart | null
|
||||
|
||||
@Property({ columnType: "text" })
|
||||
name: string
|
||||
@@ -34,7 +38,6 @@ export default class ShippingMethod {
|
||||
description?: string | null
|
||||
|
||||
@Property({ columnType: "numeric", serializer: Number })
|
||||
@Check({ expression: "amount >= 0" }) // TODO: Validate that numeric types work with the expression
|
||||
amount: number
|
||||
|
||||
@Property({ columnType: "boolean" })
|
||||
|
||||
Reference in New Issue
Block a user