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.
- package/dist/libs/tatayab-entities-library/entities/product-store.entity.d.ts +7 -0
- package/dist/libs/tatayab-entities-library/entities/product-store.entity.js +18 -0
- package/dist/libs/tatayab-entities-library/entities/product-store.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/entities/user-address.entity.d.ts +1 -0
- package/dist/libs/tatayab-entities-library/entities/user-address.entity.js +4 -0
- package/dist/libs/tatayab-entities-library/entities/user-address.entity.js.map +1 -1
- package/dist/src/main.js +24 -2
- package/libs/tatayab-entities-library/src/entities/product-store.entity.ts +27 -2
- package/libs/tatayab-entities-library/src/entities/user-address.entity.ts +3 -0
- package/package.json +1 -1
|
@@ -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
|
-
//
|
|
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
|
|
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
|
|