Files
medusa-store/packages/modules/cart/src/models/shipping-method-adjustment.ts
Harminder Virk 0a16efa426 refactor: migrate cart module to DML (#10385)
FIXES: FRMW-2815

This PR has no breaking changes
2024-12-05 12:30:50 +00:00

37 lines
1.0 KiB
TypeScript

import { model } from "@medusajs/framework/utils"
import ShippingMethod from "./shipping-method"
const ShippingMethodAdjustment = model
.define(
{
name: "ShippingMethodAdjustment",
tableName: "cart_shipping_method_adjustment",
},
{
id: model.id({ prefix: "casmadj" }).primaryKey(),
description: model.text().nullable(),
code: model.text().nullable(),
amount: model.bigNumber(),
provider_id: model.text().nullable(),
metadata: model.json().nullable(),
promotion_id: model.text().nullable(),
shipping_method: model.belongsTo(() => ShippingMethod, {
mappedBy: "adjustments",
}),
}
)
.indexes([
{
name: "IDX_shipping_method_adjustment_promotion_id",
on: ["promotion_id"],
where: "deleted_at IS NULL AND promotion_id IS NOT NULL",
},
{
name: "IDX_adjustment_shipping_method_id",
on: ["shipping_method_id"],
where: "deleted_at IS NULL",
},
])
export default ShippingMethodAdjustment