tt-entities 0.0.41 → 0.0.43

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
 
@@ -9,6 +9,8 @@ export enum PaymentGatewayType {
9
9
  KNET = 'knet', // K-Net — KFH
10
10
  WALLET = 'wallet', // Apple Pay, Google Pay
11
11
  BANK = 'bank', // Bank transfer
12
+ OFFLINE_PAYMENT = 'offline_payment'
13
+
12
14
  }
13
15
 
14
16
  @Table
@@ -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.41",
3
+ "version": "0.0.43",
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",