feat(pricing, utils, types): adds money amount to pricing module (#4909)

What:

- Adds money amount service / repo / model
- Adds money amount to entry service
- Adds tests for services
- Refreshes schema
- Update joiner config to include money amounts


RESOLVES CORE-1478
RESOLVES CORE-1479

Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Riqwan Thamir
2023-08-31 13:03:10 +00:00
committed by GitHub
co-authored by Shahed Nasser Carlos R. L. Rodrigues
parent 0627d06f72
commit fcb6b4f510
27 changed files with 1481 additions and 112 deletions
+1
View File
@@ -1 +1,2 @@
export { default as Currency } from "./currency"
export { default as MoneyAmount } from "./money-amount"
@@ -0,0 +1,42 @@
import { generateEntityId } from "@medusajs/utils"
import {
BeforeCreate,
Entity,
ManyToOne,
PrimaryKey,
Property,
} from "@mikro-orm/core"
import Currency from "./currency"
@Entity()
class MoneyAmount {
@PrimaryKey({ columnType: "text" })
id!: string
@Property({ columnType: "text", nullable: true })
currency_code?: string
@ManyToOne(() => Currency, {
nullable: true,
index: "IDX_money_amount_currency_code",
fieldName: "currency_code",
})
currency?: Currency
@Property({ columnType: "numeric", nullable: true })
amount?: number
@Property({ columnType: "numeric", nullable: true })
min_quantity?: number | null
@Property({ columnType: "numeric", nullable: true })
max_quantity?: number | null
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "ma")
}
}
export default MoneyAmount