chore: Move customer + customer group integration tests and fixes issues (#7577)

* chore: Move customer + customer group and fixes issues

* remove /customer sendpoint
This commit is contained in:
Oli Juhl
2024-06-03 10:52:32 +02:00
committed by GitHub
parent 9608bf06ef
commit 65d3222973
14 changed files with 804 additions and 1269 deletions

View File

@@ -1,21 +1,33 @@
import { DAL } from "@medusajs/types"
import { DALUtils, Searchable, generateEntityId } from "@medusajs/utils"
import {
DALUtils,
Searchable,
createPsqlIndexStatementHelper,
generateEntityId,
} from "@medusajs/utils"
import {
BeforeCreate,
Collection,
Entity,
Filter,
ManyToMany,
OnInit,
OptionalProps,
PrimaryKey,
Property,
ManyToMany,
Collection,
Filter,
} from "@mikro-orm/core"
import Customer from "./customer"
import CustomerGroupCustomer from "./customer-group-customer"
type OptionalGroupProps = DAL.SoftDeletableEntityDateColumns // TODO: To be revisited when more clear
const CustomerGroupUniqueName = createPsqlIndexStatementHelper({
tableName: "customer_group",
columns: ["name"],
unique: true,
where: "deleted_at IS NULL",
})
@Entity({ tableName: "customer_group" })
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class CustomerGroup {
@@ -25,8 +37,9 @@ export default class CustomerGroup {
id!: string
@Searchable()
@Property({ columnType: "text", nullable: true })
name: string | null = null
@CustomerGroupUniqueName.MikroORMIndex()
@Property({ columnType: "text" })
name: string
@ManyToMany({
entity: () => Customer,