Feat: bulk delete customers from customer group (#1097)
* integration testing * customer seeder * initial bulk removal * integraiton testing of deletes * delete fix * not found test * remove unused code * Apply suggestions from code review Co-authored-by: Sebastian Rindom <skrindom@gmail.com> * update integration tests * pr review fixes * update migration * formatting * integration tests for deletion * pr feedback * fix failing integration tests * remove integration tests before merging Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
co-authored by
Sebastian Rindom
parent
c56660fca9
commit
0394be36ef
@@ -23,7 +23,9 @@ export class CustomerGroup {
|
||||
@Column()
|
||||
name: string
|
||||
|
||||
@ManyToMany(() => Customer, { cascade: true })
|
||||
@ManyToMany(() => Customer, (customer) => customer.groups, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinTable({
|
||||
name: "customer_group_customers",
|
||||
joinColumn: {
|
||||
|
||||
@@ -43,10 +43,7 @@ export class Customer {
|
||||
@JoinColumn({ name: "billing_address_id" })
|
||||
billing_address: Address
|
||||
|
||||
@OneToMany(
|
||||
() => Address,
|
||||
(address) => address.customer
|
||||
)
|
||||
@OneToMany(() => Address, (address) => address.customer)
|
||||
shipping_addresses: Address[]
|
||||
|
||||
@Column({ nullable: true, select: false })
|
||||
@@ -58,10 +55,7 @@ export class Customer {
|
||||
@Column({ default: false })
|
||||
has_account: boolean
|
||||
|
||||
@OneToMany(
|
||||
() => Order,
|
||||
(order) => order.customer
|
||||
)
|
||||
@OneToMany(() => Order, (order) => order.customer)
|
||||
orders: Order[]
|
||||
|
||||
@JoinTable({
|
||||
@@ -75,7 +69,7 @@ export class Customer {
|
||||
referencedColumnName: "id",
|
||||
},
|
||||
})
|
||||
@ManyToMany(() => CustomerGroup, { cascade: true })
|
||||
@ManyToMany(() => CustomerGroup, (cg) => cg.customers, { cascade: true })
|
||||
groups: CustomerGroup[]
|
||||
|
||||
@CreateDateColumn({ type: resolveDbType("timestamptz") })
|
||||
|
||||
Reference in New Issue
Block a user