feat: event aggregator (#6218)
What: - Event Aggregator Util - Preparation for normalizing event in a new format (backward compatible with the current format) - GQL Schema to joiner config and some Entities configured - Link modules emmiting events
This commit is contained in:
@@ -6,9 +6,11 @@ import {
|
||||
DeleteDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
OneToMany,
|
||||
PrimaryColumn,
|
||||
UpdateDateColumn,
|
||||
} from "typeorm"
|
||||
import { InventoryLevel } from "./inventory-level"
|
||||
|
||||
@Entity()
|
||||
export class InventoryItem {
|
||||
@@ -67,6 +69,12 @@ export class InventoryItem {
|
||||
@Column({ type: "jsonb", nullable: true })
|
||||
metadata: Record<string, unknown> | null
|
||||
|
||||
@OneToMany(
|
||||
() => InventoryLevel,
|
||||
(inventoryLevel) => inventoryLevel.inventory_item
|
||||
)
|
||||
inventory_levels!: InventoryLevel[]
|
||||
|
||||
@BeforeInsert()
|
||||
private beforeInsert(): void {
|
||||
this.id = generateEntityId(this.id, "iitem")
|
||||
|
||||
@@ -6,9 +6,12 @@ import {
|
||||
DeleteDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryColumn,
|
||||
UpdateDateColumn,
|
||||
} from "typeorm"
|
||||
import { InventoryItem } from "./inventory-item"
|
||||
|
||||
@Entity()
|
||||
@Index(["inventory_item_id", "location_id"], { unique: true })
|
||||
@@ -45,6 +48,10 @@ export class InventoryLevel {
|
||||
@Column({ type: "jsonb", nullable: true })
|
||||
metadata: Record<string, unknown> | null
|
||||
|
||||
@ManyToOne(() => InventoryItem)
|
||||
@JoinColumn({ name: "inventory_item_id" })
|
||||
inventory_item: InventoryItem
|
||||
|
||||
@BeforeInsert()
|
||||
private beforeInsert(): void {
|
||||
this.id = generateEntityId(this.id, "ilev")
|
||||
|
||||
Reference in New Issue
Block a user