tt-entities 0.0.50 → 0.0.52

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.
@@ -3,10 +3,12 @@ import {
3
3
  Column,
4
4
  Model,
5
5
  ForeignKey,
6
+ BelongsTo,
6
7
  DataType,
7
8
  } from 'sequelize-typescript';
8
9
  import { Product } from './product.entity';
9
10
  import { Store } from './store.entity';
11
+ import { ProductVariant } from './product-variant.entity';
10
12
  import { Status } from '../utils/enums/status';
11
13
 
12
14
  @Table
@@ -19,11 +21,23 @@ export class ProductStore extends Model {
19
21
  @Column({ allowNull: false })
20
22
  declare storeId: number;
21
23
 
22
- // Store-specific regular price — null means use product.defaultPrice
24
+ // ── Variant dimension ──────────────────────────────────────────────────────
25
+ // null = this pricing row is the product-level fallback
26
+ // (used when product.hasVariants = false, OR as fallback for any
27
+ // variant that does NOT have its own specific pricing row)
28
+ // set = this pricing row applies to ONE specific variant only
29
+ // (used when product.hasVariants = true — set a different price
30
+ // for each variant e.g. 50ml=5.000, 100ml=8.000, 200ml=12.000)
31
+ @ForeignKey(() => ProductVariant)
32
+ @Column({ allowNull: true })
33
+ declare productVariantId?: number;
34
+
35
+ // Store-specific regular price
36
+ // null = use variant.priceOverride, then product.defaultPrice
23
37
  @Column({ type: DataType.DECIMAL(10, 3), allowNull: true })
24
38
  declare price?: number;
25
39
 
26
- // Sale price — only active when today is between saleStartDate and saleEndDate
40
+ // Sale price — only active when today is within saleStartDate saleEndDate
27
41
  @Column({ type: DataType.DECIMAL(10, 3), allowNull: true })
28
42
  declare salePrice?: number;
29
43
 
@@ -38,4 +52,15 @@ export class ProductStore extends Model {
38
52
  defaultValue: Status.ACTIVE,
39
53
  })
40
54
  declare status: Status;
55
+
56
+ // ─── Associations ──────────────────────────────────────────────────────────
57
+
58
+ @BelongsTo(() => Product)
59
+ declare product: Product;
60
+
61
+ @BelongsTo(() => Store)
62
+ declare store: Store;
63
+
64
+ @BelongsTo(() => ProductVariant)
65
+ declare variant?: ProductVariant;
41
66
  }
@@ -63,6 +63,9 @@ export class UserAddress extends Model {
63
63
  @Column({ type: DataType.DECIMAL(9, 6), allowNull: true })
64
64
  declare longitude?: number;
65
65
 
66
+ @Column({ type: DataType.TEXT, allowNull: true })
67
+ declare mapImage?: string;
68
+
66
69
  @Column({ allowNull: false, defaultValue: false })
67
70
  declare isDefault: boolean;
68
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-entities",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
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",