Skip to content

Commit

Permalink
docs: document float property (for v2.1.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser committed Dec 12, 2024
1 parent e021c92 commit b02e608
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,49 @@ export default MyCustom

---

## float

<Note>

This property is only available after [Medusa v2.1.2](https://github.com/medusajs/medusa/releases/tag/v2.1.2).

</Note>

The `float` method defines a number property that allows for values with decimal places.

<Note title="Tip">

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).

</Note>

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.

<Note title="Tip">

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).

</Note>

For example:

export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]]
Expand Down
2 changes: 1 addition & 1 deletion www/apps/book/generated/edit-dates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b02e608

Please sign in to comment.