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:
Stevche Radevski
2024-02-29 15:09:59 +00:00
committed by GitHub
parent 06f706a51a
commit dc025302a1
102 changed files with 1502 additions and 2128 deletions
-16
View File
@@ -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
}
-2
View File
@@ -1,4 +1,2 @@
export { default as Country } from "./country"
export { default as Currency } from "./currency"
export { default as Region } from "./region"
+1 -12
View File
@@ -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)