tt-entities 0.0.42 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,11 +5,14 @@ import {
5
5
  HasMany,
6
6
  BelongsToMany,
7
7
  DataType,
8
+ BelongsTo,
9
+ ForeignKey,
8
10
  } from 'sequelize-typescript';
9
11
  import { InventoryStock } from './inventory-stock.entity';
10
12
  import { StoreInventory } from './store-inventory.entity';
11
13
  import { Store } from './store.entity';
12
14
  import { Status } from '../utils/enums/status';
15
+ import { Country } from './country.entity';
13
16
 
14
17
  @Table
15
18
  export class Inventory extends Model {
@@ -37,8 +40,15 @@ export class Inventory extends Model {
37
40
  })
38
41
  declare status: Status;
39
42
 
43
+ @ForeignKey(() => Country)
44
+ @Column({ allowNull: true })
45
+ countryId: number;
46
+
40
47
  // ─── Associations ─────────────────────────────────────────────────────────────
41
48
 
49
+ @BelongsTo(() => Country)
50
+ country: Country;
51
+
42
52
  @HasMany(() => InventoryStock)
43
53
  declare stocks: InventoryStock[];
44
54
 
@@ -67,6 +67,12 @@ export class PurchaseOrder extends Model {
67
67
  @Column({ allowNull: true })
68
68
  declare sentBy?: number;
69
69
 
70
+ @Column({
71
+ type: DataType.ENUM('order_fulfillment', 'stock_replenishment'),
72
+ defaultValue: 'order_fulfillment',
73
+ })
74
+ declare poType: string;
75
+
70
76
  // ─── Associations ─────────────────────────────────────────────────────────────
71
77
 
72
78
  @BelongsTo(() => Vendor)
@@ -4,6 +4,7 @@ import {
4
4
  Model,
5
5
  ForeignKey,
6
6
  DataType,
7
+ BelongsTo,
7
8
  } from 'sequelize-typescript';
8
9
  import { Store } from './store.entity';
9
10
  import { Inventory } from './inventory.entity';
@@ -21,4 +22,10 @@ export class StoreInventory extends Model {
21
22
  // Priority — lower number = preferred inventory for this store
22
23
  @Column({ defaultValue: 1 })
23
24
  declare priority: number;
25
+
26
+ @BelongsTo(() => Inventory) // ← add this association
27
+ inventory: Inventory;
28
+
29
+ @BelongsTo(() => Store) // ← add this association
30
+ store: Store;
24
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-entities",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "Tatayab entities library",
5
5
  "main": "dist/libs/tatayab-entities-library/index.js",
6
6
  "types": "dist/libs/tatayab-entities-library/index.d.ts",