From b02e6080c5828da33b09dca6b93e7f47f38abda8 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 12 Dec 2024 12:44:26 +0200 Subject: [PATCH] docs: document float property (for v2.1.2) --- .../data-models/property-types/page.mdx | 39 +++++++++++++++++++ www/apps/book/generated/edit-dates.mjs | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/www/apps/book/app/learn/fundamentals/data-models/property-types/page.mdx b/www/apps/book/app/learn/fundamentals/data-models/property-types/page.mdx index 91a1c975c6c55..9acda85bf9cfb 100644 --- a/www/apps/book/app/learn/fundamentals/data-models/property-types/page.mdx +++ b/www/apps/book/app/learn/fundamentals/data-models/property-types/page.mdx @@ -69,10 +69,49 @@ export default MyCustom --- +## float + + + +This property is only available after [Medusa v2.1.2](https://github.com/medusajs/medusa/releases/tag/v2.1.2). + + + +The `float` method defines a number property that allows for values with decimal places. + + + +Use this property type when it's less important to have high precision for numbers with large decimal places. Alternatively, for higher percision, use the [bigNumber property](#bignumber). + + + +For example: + +export const floatHighlights = [["4", "float", "Define a `float` property."]] + +```ts highlights={floatHighlights} +import { model } from "@medusajs/framework/utils" + +const MyCustom = model.define("my_custom", { + rating: model.float(), + // ... +}) + +export default MyCustom +``` + +--- + ## bigNumber The `bigNumber` method defines a number property that expects large numbers, such as prices. + + +Use this property type when it's important to have high precision for numbers with large decimal places. Alternatively, for less percision, use the [float property](#float). + + + For example: export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]] diff --git a/www/apps/book/generated/edit-dates.mjs b/www/apps/book/generated/edit-dates.mjs index afcf9fc0afeb2..097e8963b620c 100644 --- a/www/apps/book/generated/edit-dates.mjs +++ b/www/apps/book/generated/edit-dates.mjs @@ -58,7 +58,7 @@ export const generatedEditDates = { "app/learn/fundamentals/data-models/configure-properties/page.mdx": "2024-10-21T13:30:21.368Z", "app/learn/fundamentals/data-models/index/page.mdx": "2024-10-21T13:30:21.368Z", "app/learn/fundamentals/custom-cli-scripts/page.mdx": "2024-10-23T07:08:55.898Z", - "app/learn/fundamentals/data-models/property-types/page.mdx": "2024-12-09T14:39:01.906Z", + "app/learn/fundamentals/data-models/property-types/page.mdx": "2024-12-12T10:41:32.999Z", "app/learn/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-12-09T15:34:08.049Z", "app/learn/debugging-and-testing/testing-tools/integration-tests/page.mdx": "2024-12-09T15:52:01.019Z", "app/learn/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-12-09T15:51:15.422Z",