Files
medusa-store/packages/modules/pricing/src/models/price-preference.ts
Harminder Virk 913cf15e2b refactor: migrate pricing entities to DML models (#10335)
Fixes: FRMW-2810

## Breaking changes
There is only one breaking change

- The `min_quantity` and `max_quantity` properties are now consistently typed as numbers. Earlier, it was [typed as numbers](https://github.com/medusajs/medusa/blob/develop/integration-tests/http/__tests__/price-list/admin/price-list.spec.ts#L68-L69) in some API responses and as [string in others](https://github.com/medusajs/medusa/blob/develop/integration-tests/http/__tests__/price-list/admin/price-list.spec.ts#L186-L187). I did not go to the bottom of this inconsistency, but the tests reveals them.

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-12-02 09:44:41 +00:00

20 lines
493 B
TypeScript

import { model } from "@medusajs/framework/utils"
const PricePreference = model
.define("PricePreference", {
id: model.id({ prefix: "prpref" }).primaryKey(),
attribute: model.text(),
value: model.text().nullable(),
is_tax_inclusive: model.boolean().default(false),
})
.indexes([
{
name: "IDX_price_preference_attribute_value",
on: ["attribute", "value"],
unique: true,
where: "deleted_at IS NULL",
},
])
export default PricePreference