feat: Add currency module and remove currency models from region and pricing modules (#6536)
What: - Creates a new currency module - Removes currency model from the pricing module - Removes currency model from region module
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import { Entity, PrimaryKey, Property } from "@mikro-orm/core"
|
||||
|
||||
@Entity({ tableName: "region_currency" })
|
||||
export default class Currency {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
code: string
|
||||
|
||||
@Property({ columnType: "text" })
|
||||
symbol: string
|
||||
|
||||
@Property({ columnType: "text" })
|
||||
symbol_native: string
|
||||
|
||||
@Property({ columnType: "text" })
|
||||
name: string
|
||||
}
|
||||
@@ -1,4 +1,2 @@
|
||||
export { default as Country } from "./country"
|
||||
export { default as Currency } from "./currency"
|
||||
export { default as Region } from "./region"
|
||||
|
||||
|
||||
@@ -14,12 +14,8 @@ import {
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import Country from "./country"
|
||||
import Currency from "./currency"
|
||||
|
||||
type RegionOptionalProps =
|
||||
| "currency"
|
||||
| "countries"
|
||||
| DAL.SoftDeletableEntityDateColumns
|
||||
type RegionOptionalProps = "countries" | DAL.SoftDeletableEntityDateColumns
|
||||
|
||||
@Entity({ tableName: "region" })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
@@ -35,13 +31,6 @@ export default class Region {
|
||||
@Property({ columnType: "text" })
|
||||
currency_code: string
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => Currency,
|
||||
index: "IDX_region_currency_code",
|
||||
nullable: true,
|
||||
})
|
||||
currency?: Currency
|
||||
|
||||
@OneToMany(() => Country, (country) => country.region)
|
||||
countries = new Collection<Country>(this)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user