Skip to content

Commit

Permalink
refactor: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 10, 2024
1 parent ba9528a commit a5dd70d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 305 deletions.
15 changes: 0 additions & 15 deletions packages/modules/tax/src/models/tax-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,3 @@ const TaxProvider = model.define("TaxProvider", {
})

export default TaxProvider

// const TABLE_NAME = "tax_provider"
// @Entity({ tableName: TABLE_NAME })
// export default class TaxProvider {
// [OptionalProps]?: "is_enabled"

// @PrimaryKey({ columnType: "text" })
// id: string

// @Property({
// default: true,
// columnType: "boolean",
// })
// is_enabled: boolean = true
// }
97 changes: 0 additions & 97 deletions packages/modules/tax/src/models/tax-rate-rule.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
import { model } from "@medusajs/framework/utils"
import TaxRate from "./tax-rate"

// const TABLE_NAME = "tax_rate_rule"

// const taxRateIdIndexName = "IDX_tax_rate_rule_tax_rate_id"
// const taxRateIdIndexStatement = createPsqlIndexStatementHelper({
// name: taxRateIdIndexName,
// tableName: TABLE_NAME,
// columns: "tax_rate_id",
// where: "deleted_at IS NULL",
// })
// const deletedAtIndexStatement = createPsqlIndexStatementHelper({
// tableName: TABLE_NAME,
// columns: "deleted_at",
// where: "deleted_at IS NOT NULL",
// })

// const referenceIdIndexName = "IDX_tax_rate_rule_reference_id"
// const referenceIdIndexStatement = createPsqlIndexStatementHelper({
// name: referenceIdIndexName,
// tableName: TABLE_NAME,
// columns: "reference_id",
// where: "deleted_at IS NULL",
// })

// export const uniqueRateReferenceIndexName =
// "IDX_tax_rate_rule_unique_rate_reference"
// const uniqueRateReferenceIndexStatement = createPsqlIndexStatementHelper({
// name: uniqueRateReferenceIndexName,
// tableName: TABLE_NAME,
// columns: ["tax_rate_id", "reference_id"],
// unique: true,
// where: "deleted_at IS NULL",
// })

const TaxRateRule = model
.define("TaxRateRule", {
id: model.id({ prefix: "txrule" }).primaryKey(),
Expand All @@ -60,67 +27,3 @@ const TaxRateRule = model
])

export default TaxRateRule

// @Entity({ tableName: TABLE_NAME })
// @Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
// @uniqueRateReferenceIndexStatement.MikroORMIndex()
// export default class TaxRateRule {
// [OptionalProps]?: OptionalRuleProps

// @PrimaryKey({ columnType: "text" })
// id!: string

// @ManyToOne(() => TaxRate, {
// type: "text",
// fieldName: "tax_rate_id",
// mapToPk: true,
// onDelete: "cascade",
// })
// @taxRateIdIndexStatement.MikroORMIndex()
// tax_rate_id: string

// @Property({ columnType: "text" })
// @referenceIdIndexStatement.MikroORMIndex()
// reference_id: string

// @Property({ columnType: "text" })
// reference: string

// @ManyToOne(() => TaxRate, { persist: false })
// tax_rate: Rel<TaxRate>

// @Property({ columnType: "jsonb", nullable: true })
// metadata: Record<string, unknown> | null = null

// @Property({
// onCreate: () => new Date(),
// columnType: "timestamptz",
// defaultRaw: "now()",
// })
// created_at: Date

// @Property({
// onCreate: () => new Date(),
// onUpdate: () => new Date(),
// columnType: "timestamptz",
// defaultRaw: "now()",
// })
// updated_at: Date

// @Property({ columnType: "text", nullable: true })
// created_by: string | null = null

// @deletedAtIndexStatement.MikroORMIndex()
// @Property({ columnType: "timestamptz", nullable: true })
// deleted_at: Date | null = null

// @BeforeCreate()
// onCreate() {
// this.id = generateEntityId(this.id, "txrule")
// }

// @OnInit()
// onInit() {
// this.id = generateEntityId(this.id, "txrule")
// }
// }
89 changes: 0 additions & 89 deletions packages/modules/tax/src/models/tax-rate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@ import { model } from "@medusajs/framework/utils"
import TaxRateRule from "./tax-rate-rule"
import TaxRegion from "./tax-region"

// type OptionalTaxRateProps = DAL.SoftDeletableModelDateColumns

// const TABLE_NAME = "tax_rate"

// export const singleDefaultRegionIndexName = "IDX_single_default_region"
// const singleDefaultRegionIndexStatement = createPsqlIndexStatementHelper({
// name: singleDefaultRegionIndexName,
// tableName: TABLE_NAME,
// columns: "tax_region_id",
// unique: true,
// where: "is_default = true AND deleted_at IS NULL",
// })

// const taxRegionIdIndexName = "IDX_tax_rate_tax_region_id"
// const taxRegionIdIndexStatement = createPsqlIndexStatementHelper({
// name: taxRegionIdIndexName,
// tableName: TABLE_NAME,
// columns: "tax_region_id",
// where: "deleted_at IS NULL",
// })
// const deletedAtIndexStatement = createPsqlIndexStatementHelper({
// tableName: TABLE_NAME,
// columns: "deleted_at",
// where: "deleted_at IS NOT NULL",
// })

const TaxRate = model
.define("TaxRate", {
id: model.id({ prefix: "txr" }).primaryKey(),
Expand Down Expand Up @@ -63,66 +37,3 @@ const TaxRate = model
})

export default TaxRate

// @singleDefaultRegionIndexStatement.MikroORMIndex()
// @Entity({ tableName: TABLE_NAME })
// @Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
// export default class TaxRate {
// [OptionalProps]?: OptionalTaxRateProps
// @PrimaryKey({ columnType: "text" })
// id!: string
// @Property({ columnType: "real", nullable: true })
// rate: number | null = null
// @Searchable()
// @Property({ columnType: "text" })
// code: string
// @Searchable()
// @Property({ columnType: "text" })
// name: string
// @Property({ columnType: "bool", default: false })
// is_default: boolean = false
// @Property({ columnType: "bool", default: false })
// is_combinable: boolean = false
// @ManyToOne(() => TaxRegion, {
// columnType: "text",
// fieldName: "tax_region_id",
// mapToPk: true,
// onDelete: "cascade",
// })
// @taxRegionIdIndexStatement.MikroORMIndex()
// tax_region_id: string
// @ManyToOne({ entity: () => TaxRegion, persist: false })
// tax_region: Rel<TaxRegion>
// @OneToMany(() => TaxRateRule, (rule) => rule.tax_rate, {
// cascade: ["soft-remove" as Cascade],
// })
// rules = new Collection<Rel<TaxRateRule>>(this)
// @Property({ columnType: "jsonb", nullable: true })
// metadata: Record<string, unknown> | null = null
// @Property({
// onCreate: () => new Date(),
// columnType: "timestamptz",
// defaultRaw: "now()",
// })
// created_at: Date
// @Property({
// onCreate: () => new Date(),
// onUpdate: () => new Date(),
// columnType: "timestamptz",
// defaultRaw: "now()",
// })
// updated_at: Date
// @Property({ columnType: "text", nullable: true })
// created_by: string | null = null
// @deletedAtIndexStatement.MikroORMIndex()
// @Property({ columnType: "timestamptz", nullable: true })
// deleted_at: Date | null = null
// @BeforeCreate()
// onCreate() {
// this.id = generateEntityId(this.id, "txr")
// }
// @OnInit()
// onInit() {
// this.id = generateEntityId(this.id, "txr")
// }
// }
104 changes: 0 additions & 104 deletions packages/modules/tax/src/models/tax-region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@ import { model } from "@medusajs/framework/utils"
import TaxProvider from "./tax-provider"
import TaxRate from "./tax-rate"

// export const countryCodeNullProvinceIndexName =
// "IDX_tax_region_unique_country_nullable_province"
// export const countryCodeProvinceIndexName =
// "IDX_tax_region_unique_country_province"
// const countryCodeProvinceIndexStatement = createPsqlIndexStatementHelper({
// name: countryCodeProvinceIndexName,
// tableName: TABLE_NAME,
// columns: ["country_code", "province_code"],
// unique: true,
// where: "deleted_at IS NULL",
// })
// const deletedAtIndexStatement = createPsqlIndexStatementHelper({
// tableName: TABLE_NAME,
// columns: "deleted_at",
// where: "deleted_at IS NOT NULL",
// })

// const countryCodeNullableProvinceIndexStatement =
// createPsqlIndexStatementHelper({
// name: "IDX_tax_region_unique_country_nullable_province",
// tableName: TABLE_NAME,
// columns: ["country_code"],
// unique: true,
// where: "province_code IS NULL AND deleted_at IS NULL",
// })

export const taxRegionProviderTopLevelCheckName =
"CK_tax_region_provider_top_level"
export const taxRegionCountryTopLevelCheckName =
Expand Down Expand Up @@ -84,82 +58,4 @@ const TaxRegion = model
.cascades({
delete: ["children", "tax_rates"],
})

// @Check({
// name: taxRegionProviderTopLevelCheckName,
// expression: `parent_id IS NULL OR provider_id IS NULL`,
// })
// @Check({
// name: taxRegionCountryTopLevelCheckName,
// expression: `parent_id IS NULL OR province_code IS NOT NULL`,
// })
// @countryCodeNullableProvinceIndexStatement.MikroORMIndex()
// @countryCodeProvinceIndexStatement.MikroORMIndex()
// @Entity({ tableName: TABLE_NAME })
// @Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
// export default class TaxRegion {
// [OptionalProps]?: OptionalTaxRegionProps
// @PrimaryKey({ columnType: "text" })
// id!: string
// @ManyToOne(() => TaxProvider, {
// fieldName: "provider_id",
// mapToPk: true,
// nullable: true,
// })
// provider_id: string | null = null
// @ManyToOne(() => TaxProvider, { persist: false })
// provider: Rel<TaxProvider>
// @Searchable()
// @Property({ columnType: "text" })
// country_code: string
// @Searchable()
// @Property({ columnType: "text", nullable: true })
// province_code: string | null = null
// @ManyToOne(() => TaxRegion, {
// index: "IDX_tax_region_parent_id",
// fieldName: "parent_id",
// onDelete: "cascade",
// mapToPk: true,
// nullable: true,
// })
// parent_id: string | null = null
// @ManyToOne(() => TaxRegion, { persist: false })
// parent: Rel<TaxRegion>
// @OneToMany(() => TaxRate, (label) => label.tax_region, {
// cascade: ["soft-remove" as Cascade],
// })
// tax_rates = new Collection<TaxRate>(this)
// @OneToMany(() => TaxRegion, (label) => label.parent, {
// cascade: ["soft-remove" as Cascade],
// })
// children = new Collection<Rel<TaxRegion>>(this)
// @Property({ columnType: "jsonb", nullable: true })
// metadata: Record<string, unknown> | null = null
// @Property({
// onCreate: () => new Date(),
// columnType: "timestamptz",
// defaultRaw: "now()",
// })
// created_at: Date
// @Property({
// onCreate: () => new Date(),
// onUpdate: () => new Date(),
// columnType: "timestamptz",
// defaultRaw: "now()",
// })
// updated_at: Date
// @Property({ columnType: "text", nullable: true })
// created_by: string | null = null
// @deletedAtIndexStatement.MikroORMIndex()
// @Property({ columnType: "timestamptz", nullable: true })
// deleted_at: Date | null = null
// @BeforeCreate()
// onCreate() {
// this.id = generateEntityId(this.id, "txreg")
// }
// @OnInit()
// onInit() {
// this.id = generateEntityId(this.id, "txreg")
// }
// }
export default TaxRegion

0 comments on commit a5dd70d

Please sign in to comment.