breaking: rename package names to be consistent and under @medusajs scope (#9580)

This commit is contained in:
Harminder Virk
2024-10-16 22:28:09 +05:30
committed by GitHub
parent cc1a25abb2
commit 68560787e5
289 changed files with 483 additions and 474 deletions
@@ -0,0 +1,2 @@
export * from "./stock-location"
export * from "./stock-location-address"
@@ -0,0 +1,79 @@
import {
BeforeCreate,
Entity,
OnInit,
PrimaryKey,
Property,
} from "@mikro-orm/core"
import {
createPsqlIndexStatementHelper,
generateEntityId,
} from "@medusajs/framework/utils"
const StockLocationAddressDeletedAtIndex = createPsqlIndexStatementHelper({
tableName: "stock_location_address",
columns: "deleted_at",
where: "deleted_at IS NOT NULL",
})
@Entity()
export class StockLocationAddress {
@PrimaryKey({ columnType: "text" })
id: string
@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
@StockLocationAddressDeletedAtIndex.MikroORMIndex()
@Property({ columnType: "timestamptz", nullable: true })
deleted_at: Date | null = null
@Property({ columnType: "text" })
address_1: string
@Property({ columnType: "text", nullable: true })
address_2: string | null
@Property({ columnType: "text", nullable: true })
company: string | null
@Property({ columnType: "text", nullable: true })
city: string | null
@Property({ columnType: "text" })
country_code: string
@Property({ columnType: "text", nullable: true })
phone: string | null
@Property({ columnType: "text", nullable: true })
province: string | null
@Property({ columnType: "text", nullable: true })
postal_code: string | null
@Property({ columnType: "jsonb", nullable: true })
metadata: Record<string, unknown> | null
@BeforeCreate()
beforeCreate(): void {
this.id = generateEntityId(this.id, "laddr")
}
@OnInit()
onInit(): void {
this.id = generateEntityId(this.id, "laddr")
}
}
@@ -0,0 +1,80 @@
import {
DALUtils,
Searchable,
createPsqlIndexStatementHelper,
generateEntityId,
} from "@medusajs/framework/utils"
import {
BeforeCreate,
Entity,
Filter,
ManyToOne,
OnInit,
PrimaryKey,
Property,
} from "@mikro-orm/core"
import { StockLocationAddress } from "./stock-location-address"
const StockLocationDeletedAtIndex = createPsqlIndexStatementHelper({
tableName: "stock_location",
columns: "deleted_at",
where: "deleted_at IS NOT NULL",
})
@Entity()
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export class StockLocation {
@PrimaryKey({ columnType: "text" })
id: string
@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
@StockLocationDeletedAtIndex.MikroORMIndex()
@Property({ columnType: "timestamptz", nullable: true })
deleted_at: Date | null = null
@Searchable()
@Property({ columnType: "text" })
name: string
@ManyToOne(() => StockLocationAddress, {
fieldName: "address_id",
type: "text",
mapToPk: true,
nullable: true,
onDelete: "cascade",
})
address_id: string | null
@ManyToOne(() => StockLocationAddress, {
nullable: true,
})
address: StockLocationAddress | null
@Property({ columnType: "jsonb", nullable: true })
metadata: Record<string, unknown> | null
@BeforeCreate()
beforeCreate(): void {
this.id = generateEntityId(this.id, "sloc")
}
@OnInit()
onInit(): void {
this.id = generateEntityId(this.id, "sloc")
}
}