tt-entities 0.1.12 → 0.1.14
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/.claude/settings.local.json +16 -1
- package/dist/libs/tatayab-entities-library/entities/cart-item.entity.d.ts +3 -0
- package/dist/libs/tatayab-entities-library/entities/cart-item.entity.js +10 -0
- package/dist/libs/tatayab-entities-library/entities/cart-item.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/entities/return-request-item.entity.d.ts +1 -0
- package/dist/libs/tatayab-entities-library/entities/return-request-item.entity.js +4 -0
- package/dist/libs/tatayab-entities-library/entities/return-request-item.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-item.entity.d.ts +33 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-item.entity.js +114 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-item.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-prize.entity.d.ts +35 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-prize.entity.js +127 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-prize.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-spin.entity.d.ts +12 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-spin.entity.js +50 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel-spin.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel.entity.d.ts +23 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel.entity.js +77 -0
- package/dist/libs/tatayab-entities-library/entities/spin-wheel.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/index.d.ts +4 -0
- package/dist/libs/tatayab-entities-library/index.js +24 -3
- package/dist/libs/tatayab-entities-library/index.js.map +1 -1
- package/libs/tatayab-entities-library/src/entities/cart-item.entity.ts +10 -0
- package/libs/tatayab-entities-library/src/entities/return-request-item.entity.ts +4 -0
- package/libs/tatayab-entities-library/src/entities/spin-wheel-item.entity.ts +91 -0
- package/libs/tatayab-entities-library/src/entities/spin-wheel-prize.entity.ts +99 -0
- package/libs/tatayab-entities-library/src/entities/spin-wheel-spin.entity.ts +32 -0
- package/libs/tatayab-entities-library/src/entities/spin-wheel.entity.ts +58 -0
- package/libs/tatayab-entities-library/src/index.ts +27 -0
- package/package.json +1 -1
- package/src/database/migrations/20260711130000-add-image-to-return-request-items.js +16 -0
- package/src/database/migrations/20260716100000-create-spin-wheels.js +99 -0
|
@@ -44,7 +44,22 @@
|
|
|
44
44
|
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Backend/tatayab-backend-user status)",
|
|
45
45
|
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard status)",
|
|
46
46
|
"Bash(xargs cat)",
|
|
47
|
-
"mcp__visualize__show_widget"
|
|
47
|
+
"mcp__visualize__show_widget",
|
|
48
|
+
"Bash(git push *)",
|
|
49
|
+
"Bash(mkdir -p /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard/resources/js/pages/orders/return-requests)",
|
|
50
|
+
"Bash(mkdir -p /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard/resources/js/pages/inventory/return-receiving)",
|
|
51
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard diff --stat)",
|
|
52
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard log --oneline -5)",
|
|
53
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard add app/Http/Controllers/Api/ReturnRequestController.php resources/js/pages/orders/all-orders/\\\\[id\\\\]/index.vue)",
|
|
54
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard commit -m ' *)",
|
|
55
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard log --oneline --since=\"2 days ago\" -- resources/js/)",
|
|
56
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard diff 87d1e2a~1..HEAD -- resources/js/)",
|
|
57
|
+
"Bash(git -C /Users/hosam/Documents/TatayabNewEra/Frontend/tatayab-all-dashboard add resources/js/plugins/i18n/locales/en.json resources/js/plugins/i18n/locales/ar.json)",
|
|
58
|
+
"Read(//Users/hosam/Library/Application Support/Claude/local-agent-mode-sessions/skills-plugin/b1f4131d-7e65-4769-900a-bf328f6ab03c/0815d0af-1112-4c02-b704-361c98e5b97b/skills/xlsx/**)",
|
|
59
|
+
"Bash(pip3 install *)",
|
|
60
|
+
"Bash(python3)",
|
|
61
|
+
"Bash(cp /tmp/inventory_update.sql \"/private/tmp/claude-501/-Users-hosam-Documents-TatayabNewEra-DB-tatayab-database-all/6a788c09-9718-4502-8db2-6713ea7c0f06/scratchpad/inventory_stock_update.sql\" && echo \"Copied OK\")",
|
|
62
|
+
"Bash(grep -rn \"saleStartDate\\\\|salePrice\" /Users/hosam/Documents/TatayabNewEra/Backend --include=\"*.ts\" -l 2>/dev/null | grep -v node_modules | grep -v dist | head -5)"
|
|
48
63
|
]
|
|
49
64
|
}
|
|
50
65
|
}
|
|
@@ -4,6 +4,7 @@ import { Product } from './product.entity';
|
|
|
4
4
|
import { ProductVariant } from './product-variant.entity';
|
|
5
5
|
import { Bundle } from './bundle.entity';
|
|
6
6
|
import { CartItemBundleSelection } from './cart-item-bundle-selection.entity';
|
|
7
|
+
import { SpinWheelPrize } from './spin-wheel-prize.entity';
|
|
7
8
|
export declare enum CartItemType {
|
|
8
9
|
PRODUCT = "product",
|
|
9
10
|
BUNDLE = "bundle"
|
|
@@ -17,10 +18,12 @@ export declare class CartItem extends Model {
|
|
|
17
18
|
composedSku?: string;
|
|
18
19
|
quantity: number;
|
|
19
20
|
unitPrice: number;
|
|
21
|
+
spinPrizeId?: number;
|
|
20
22
|
isOutOfStock: boolean;
|
|
21
23
|
cart: Cart;
|
|
22
24
|
product?: Product;
|
|
23
25
|
variant?: ProductVariant;
|
|
24
26
|
bundle?: Bundle;
|
|
25
27
|
bundleSelections: CartItemBundleSelection[];
|
|
28
|
+
spinPrize?: SpinWheelPrize;
|
|
26
29
|
}
|
|
@@ -16,6 +16,7 @@ const product_entity_1 = require("./product.entity");
|
|
|
16
16
|
const product_variant_entity_1 = require("./product-variant.entity");
|
|
17
17
|
const bundle_entity_1 = require("./bundle.entity");
|
|
18
18
|
const cart_item_bundle_selection_entity_1 = require("./cart-item-bundle-selection.entity");
|
|
19
|
+
const spin_wheel_prize_entity_1 = require("./spin-wheel-prize.entity");
|
|
19
20
|
var CartItemType;
|
|
20
21
|
(function (CartItemType) {
|
|
21
22
|
CartItemType["PRODUCT"] = "product";
|
|
@@ -63,6 +64,11 @@ __decorate([
|
|
|
63
64
|
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.DECIMAL(10, 3), allowNull: false }),
|
|
64
65
|
__metadata("design:type", Number)
|
|
65
66
|
], CartItem.prototype, "unitPrice", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, sequelize_typescript_1.ForeignKey)(() => spin_wheel_prize_entity_1.SpinWheelPrize),
|
|
69
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
70
|
+
__metadata("design:type", Number)
|
|
71
|
+
], CartItem.prototype, "spinPrizeId", void 0);
|
|
66
72
|
__decorate([
|
|
67
73
|
(0, sequelize_typescript_1.Column)({ allowNull: false, defaultValue: false }),
|
|
68
74
|
__metadata("design:type", Boolean)
|
|
@@ -87,6 +93,10 @@ __decorate([
|
|
|
87
93
|
(0, sequelize_typescript_1.HasMany)(() => cart_item_bundle_selection_entity_1.CartItemBundleSelection),
|
|
88
94
|
__metadata("design:type", Array)
|
|
89
95
|
], CartItem.prototype, "bundleSelections", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, sequelize_typescript_1.BelongsTo)(() => spin_wheel_prize_entity_1.SpinWheelPrize),
|
|
98
|
+
__metadata("design:type", spin_wheel_prize_entity_1.SpinWheelPrize)
|
|
99
|
+
], CartItem.prototype, "spinPrize", void 0);
|
|
90
100
|
exports.CartItem = CartItem = __decorate([
|
|
91
101
|
sequelize_typescript_1.Table
|
|
92
102
|
], CartItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart-item.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/cart-item.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAG8B;AAC9B,+CAAqC;AACrC,qDAA2C;AAC3C,qEAA0D;AAC1D,mDAAyC;AACzC,2FAA8E;
|
|
1
|
+
{"version":3,"file":"cart-item.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/cart-item.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAG8B;AAC9B,+CAAqC;AACrC,qDAA2C;AAC3C,qEAA0D;AAC1D,mDAAyC;AACzC,2FAA8E;AAC9E,uEAA2D;AAE3D,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,iCAAkB,CAAA;AACpB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAGM,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,4BAAK;CAmElC,CAAA;AAnEY,4BAAQ;AAGX;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,kBAAI,CAAC;IACtB,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;wCACN;AAMf;IAJP,IAAA,6BAAM,EAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACnD,SAAS,EAAE,KAAK;KACjB,CAAC;;0CAC6B;AAKvB;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,wBAAO,CAAC;IACzB,IAAA,6BAAM,EAAC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,CAAC,2DAAuB,CAAC;;kDACa;AAG5C;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,wCAAc,CAAC;8BACZ,wCAAc;2CAAC;mBAlExB,QAAQ;IADpB,4BAAK;GACO,QAAQ,CAmEpB"}
|
|
@@ -80,6 +80,10 @@ __decorate([
|
|
|
80
80
|
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.TEXT, allowNull: true }),
|
|
81
81
|
__metadata("design:type", String)
|
|
82
82
|
], ReturnRequestItem.prototype, "notes", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], ReturnRequestItem.prototype, "image", void 0);
|
|
83
87
|
__decorate([
|
|
84
88
|
(0, sequelize_typescript_1.BelongsTo)(() => return_request_entity_1.ReturnRequest),
|
|
85
89
|
__metadata("design:type", return_request_entity_1.ReturnRequest)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"return-request-item.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/return-request-item.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAO8B;AAC9B,mEAAwD;AACxD,2DAAgD;AAChD,mDAAyC;AACzC,uDAA4C;AAE5C,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uCAAoB,CAAA;IACpB,yCAAqB,CAAA;AACvB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,gDAAuB,CAAA;IACvB,0CAAoB,CAAA;AACtB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,4BAAK;
|
|
1
|
+
{"version":3,"file":"return-request-item.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/return-request-item.entity.ts"],"names":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Y,EAAE,qBAAqB,CAAC,SAAS;KAC9C,CAAC;;sDACyC;AAInC;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;IACxB,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;mDACF;AAIlB;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,yBAAO,CAAC;IACzB,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;2DACM;AAG1B;IADP,IAAA,6BAAM,EAAC,EAAE,IAAI,EAAE,+BAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;8BACtB,IAAI;2DAAC;AAGxB;IADP,IAAA,6BAAM,EAAC,EAAE,IAAI,EAAE,+BAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;gDAC1B;AAIf;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;gDACL;AAKf;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,qCAAa,CAAC;8BACR,qCAAa;wDAAC;AAG7B;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,6BAAS,CAAC;8BACR,6BAAS;oDAAC;AAGrB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;8BACP,sBAAM;iDAAC;AAGhB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,yBAAO,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,EAAE,EAAE,mBAAmB,EAAE,CAAC;8BAC1D,yBAAO;4DAAC;4BA5DzB,iBAAiB;IAD7B,4BAAK;GACO,iBAAiB,CA6D7B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { SpinWheel } from './spin-wheel.entity';
|
|
3
|
+
import { Coupon } from './coupon.entity';
|
|
4
|
+
import { Product } from './product.entity';
|
|
5
|
+
import { ProductVariant } from './product-variant.entity';
|
|
6
|
+
export declare enum SpinPrizeType {
|
|
7
|
+
COUPON = "coupon",
|
|
8
|
+
FREE_PRODUCT = "free_product",
|
|
9
|
+
NO_PRIZE = "no_prize"
|
|
10
|
+
}
|
|
11
|
+
export declare enum SpinWheelItemStatus {
|
|
12
|
+
ACTIVE = "active",
|
|
13
|
+
INACTIVE = "inactive"
|
|
14
|
+
}
|
|
15
|
+
export declare class SpinWheelItem extends Model {
|
|
16
|
+
wheelId: number;
|
|
17
|
+
labelEn: string;
|
|
18
|
+
labelAr: string;
|
|
19
|
+
prizeType: SpinPrizeType;
|
|
20
|
+
couponId?: number;
|
|
21
|
+
productId?: number;
|
|
22
|
+
productVariantId?: number;
|
|
23
|
+
winPercentage: number;
|
|
24
|
+
maxWins?: number;
|
|
25
|
+
winsCount: number;
|
|
26
|
+
prizeExpiryDays?: number;
|
|
27
|
+
status: SpinWheelItemStatus;
|
|
28
|
+
sortOrder: number;
|
|
29
|
+
wheel: SpinWheel;
|
|
30
|
+
coupon?: Coupon;
|
|
31
|
+
product?: Product;
|
|
32
|
+
variant?: ProductVariant;
|
|
33
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SpinWheelItem = exports.SpinWheelItemStatus = exports.SpinPrizeType = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const spin_wheel_entity_1 = require("./spin-wheel.entity");
|
|
15
|
+
const coupon_entity_1 = require("./coupon.entity");
|
|
16
|
+
const product_entity_1 = require("./product.entity");
|
|
17
|
+
const product_variant_entity_1 = require("./product-variant.entity");
|
|
18
|
+
var SpinPrizeType;
|
|
19
|
+
(function (SpinPrizeType) {
|
|
20
|
+
SpinPrizeType["COUPON"] = "coupon";
|
|
21
|
+
SpinPrizeType["FREE_PRODUCT"] = "free_product";
|
|
22
|
+
SpinPrizeType["NO_PRIZE"] = "no_prize";
|
|
23
|
+
})(SpinPrizeType || (exports.SpinPrizeType = SpinPrizeType = {}));
|
|
24
|
+
var SpinWheelItemStatus;
|
|
25
|
+
(function (SpinWheelItemStatus) {
|
|
26
|
+
SpinWheelItemStatus["ACTIVE"] = "active";
|
|
27
|
+
SpinWheelItemStatus["INACTIVE"] = "inactive";
|
|
28
|
+
})(SpinWheelItemStatus || (exports.SpinWheelItemStatus = SpinWheelItemStatus = {}));
|
|
29
|
+
let SpinWheelItem = class SpinWheelItem extends sequelize_typescript_1.Model {
|
|
30
|
+
};
|
|
31
|
+
exports.SpinWheelItem = SpinWheelItem;
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, sequelize_typescript_1.ForeignKey)(() => spin_wheel_entity_1.SpinWheel),
|
|
34
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], SpinWheelItem.prototype, "wheelId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], SpinWheelItem.prototype, "labelEn", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], SpinWheelItem.prototype, "labelAr", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, sequelize_typescript_1.Column)({
|
|
47
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(SpinPrizeType)),
|
|
48
|
+
allowNull: false,
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], SpinWheelItem.prototype, "prizeType", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, sequelize_typescript_1.ForeignKey)(() => coupon_entity_1.Coupon),
|
|
54
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
55
|
+
__metadata("design:type", Number)
|
|
56
|
+
], SpinWheelItem.prototype, "couponId", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, sequelize_typescript_1.ForeignKey)(() => product_entity_1.Product),
|
|
59
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], SpinWheelItem.prototype, "productId", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, sequelize_typescript_1.ForeignKey)(() => product_variant_entity_1.ProductVariant),
|
|
64
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
65
|
+
__metadata("design:type", Number)
|
|
66
|
+
], SpinWheelItem.prototype, "productVariantId", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.DECIMAL(5, 2), allowNull: false }),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], SpinWheelItem.prototype, "winPercentage", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.INTEGER, allowNull: true }),
|
|
73
|
+
__metadata("design:type", Number)
|
|
74
|
+
], SpinWheelItem.prototype, "maxWins", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.INTEGER, allowNull: false, defaultValue: 0 }),
|
|
77
|
+
__metadata("design:type", Number)
|
|
78
|
+
], SpinWheelItem.prototype, "winsCount", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.INTEGER, allowNull: true }),
|
|
81
|
+
__metadata("design:type", Number)
|
|
82
|
+
], SpinWheelItem.prototype, "prizeExpiryDays", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, sequelize_typescript_1.Column)({
|
|
85
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(SpinWheelItemStatus)),
|
|
86
|
+
allowNull: false,
|
|
87
|
+
defaultValue: SpinWheelItemStatus.ACTIVE,
|
|
88
|
+
}),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], SpinWheelItem.prototype, "status", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false, defaultValue: 0 }),
|
|
93
|
+
__metadata("design:type", Number)
|
|
94
|
+
], SpinWheelItem.prototype, "sortOrder", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, sequelize_typescript_1.BelongsTo)(() => spin_wheel_entity_1.SpinWheel),
|
|
97
|
+
__metadata("design:type", spin_wheel_entity_1.SpinWheel)
|
|
98
|
+
], SpinWheelItem.prototype, "wheel", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, sequelize_typescript_1.BelongsTo)(() => coupon_entity_1.Coupon),
|
|
101
|
+
__metadata("design:type", coupon_entity_1.Coupon)
|
|
102
|
+
], SpinWheelItem.prototype, "coupon", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, sequelize_typescript_1.BelongsTo)(() => product_entity_1.Product),
|
|
105
|
+
__metadata("design:type", product_entity_1.Product)
|
|
106
|
+
], SpinWheelItem.prototype, "product", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, sequelize_typescript_1.BelongsTo)(() => product_variant_entity_1.ProductVariant),
|
|
109
|
+
__metadata("design:type", product_variant_entity_1.ProductVariant)
|
|
110
|
+
], SpinWheelItem.prototype, "variant", void 0);
|
|
111
|
+
exports.SpinWheelItem = SpinWheelItem = __decorate([
|
|
112
|
+
sequelize_typescript_1.Table
|
|
113
|
+
], SpinWheelItem);
|
|
114
|
+
//# sourceMappingURL=spin-wheel-item.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin-wheel-item.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/spin-wheel-item.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAE8B;AAC9B,2DAAgD;AAChD,mDAAyC;AACzC,qDAA2C;AAC3C,qEAA0D;AAE1D,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAuB,CAAA;IACvB,8CAA6B,CAAA;IAC7B,sCAAyB,CAAA;AAC3B,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,wCAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,4BAAK;CAsEvC,CAAA;AAtEY,sCAAa;AAGhB;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,6BAAS,CAAC;IAC3B,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CACL;AAGhB;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CACL;AAGhB;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CACL;AAMhB;I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Y,EAAE,mBAAmB,CAAC,MAAM;KACzC,CAAC;;6CACkC;AAG5B;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;;gDACpB;AAIlB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,6BAAS,CAAC;8BACZ,6BAAS;4CAAC;AAGjB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;8BACP,sBAAM;6CAAC;AAGhB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,CAAC;8BACP,wBAAO;8CAAC;AAGlB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,CAAC;8BACd,uCAAc;8CAAC;wBArEtB,aAAa;IADzB,4BAAK;GACO,aAAa,CAsEzB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { SpinWheelSpin } from './spin-wheel-spin.entity';
|
|
3
|
+
import { SpinWheelItem, SpinPrizeType } from './spin-wheel-item.entity';
|
|
4
|
+
import { User } from './user.entity';
|
|
5
|
+
import { Coupon } from './coupon.entity';
|
|
6
|
+
import { Product } from './product.entity';
|
|
7
|
+
import { ProductVariant } from './product-variant.entity';
|
|
8
|
+
import { Order } from './order.entity';
|
|
9
|
+
export declare enum SpinPrizeStatus {
|
|
10
|
+
PENDING = "pending",
|
|
11
|
+
REDEEMED = "redeemed",
|
|
12
|
+
EXPIRED = "expired"
|
|
13
|
+
}
|
|
14
|
+
export declare class SpinWheelPrize extends Model {
|
|
15
|
+
userId: number;
|
|
16
|
+
spinId: number;
|
|
17
|
+
wheelItemId: number;
|
|
18
|
+
prizeType: SpinPrizeType;
|
|
19
|
+
labelEn: string;
|
|
20
|
+
labelAr: string;
|
|
21
|
+
couponId?: number;
|
|
22
|
+
productId?: number;
|
|
23
|
+
productVariantId?: number;
|
|
24
|
+
status: SpinPrizeStatus;
|
|
25
|
+
expiresAt?: Date;
|
|
26
|
+
redeemedOrderId?: number;
|
|
27
|
+
redeemedAt?: Date;
|
|
28
|
+
user: User;
|
|
29
|
+
spin: SpinWheelSpin;
|
|
30
|
+
wheelItem: SpinWheelItem;
|
|
31
|
+
coupon?: Coupon;
|
|
32
|
+
product?: Product;
|
|
33
|
+
variant?: ProductVariant;
|
|
34
|
+
redeemedOrder?: Order;
|
|
35
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SpinWheelPrize = exports.SpinPrizeStatus = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const spin_wheel_spin_entity_1 = require("./spin-wheel-spin.entity");
|
|
15
|
+
const spin_wheel_item_entity_1 = require("./spin-wheel-item.entity");
|
|
16
|
+
const user_entity_1 = require("./user.entity");
|
|
17
|
+
const coupon_entity_1 = require("./coupon.entity");
|
|
18
|
+
const product_entity_1 = require("./product.entity");
|
|
19
|
+
const product_variant_entity_1 = require("./product-variant.entity");
|
|
20
|
+
const order_entity_1 = require("./order.entity");
|
|
21
|
+
var SpinPrizeStatus;
|
|
22
|
+
(function (SpinPrizeStatus) {
|
|
23
|
+
SpinPrizeStatus["PENDING"] = "pending";
|
|
24
|
+
SpinPrizeStatus["REDEEMED"] = "redeemed";
|
|
25
|
+
SpinPrizeStatus["EXPIRED"] = "expired";
|
|
26
|
+
})(SpinPrizeStatus || (exports.SpinPrizeStatus = SpinPrizeStatus = {}));
|
|
27
|
+
let SpinWheelPrize = class SpinWheelPrize extends sequelize_typescript_1.Model {
|
|
28
|
+
};
|
|
29
|
+
exports.SpinWheelPrize = SpinWheelPrize;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, sequelize_typescript_1.ForeignKey)(() => user_entity_1.User),
|
|
32
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], SpinWheelPrize.prototype, "userId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, sequelize_typescript_1.ForeignKey)(() => spin_wheel_spin_entity_1.SpinWheelSpin),
|
|
37
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
38
|
+
__metadata("design:type", Number)
|
|
39
|
+
], SpinWheelPrize.prototype, "spinId", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, sequelize_typescript_1.ForeignKey)(() => spin_wheel_item_entity_1.SpinWheelItem),
|
|
42
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
43
|
+
__metadata("design:type", Number)
|
|
44
|
+
], SpinWheelPrize.prototype, "wheelItemId", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, sequelize_typescript_1.Column)({
|
|
47
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(spin_wheel_item_entity_1.SpinPrizeType)),
|
|
48
|
+
allowNull: false,
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], SpinWheelPrize.prototype, "prizeType", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], SpinWheelPrize.prototype, "labelEn", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], SpinWheelPrize.prototype, "labelAr", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, sequelize_typescript_1.ForeignKey)(() => coupon_entity_1.Coupon),
|
|
62
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
63
|
+
__metadata("design:type", Number)
|
|
64
|
+
], SpinWheelPrize.prototype, "couponId", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, sequelize_typescript_1.ForeignKey)(() => product_entity_1.Product),
|
|
67
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
68
|
+
__metadata("design:type", Number)
|
|
69
|
+
], SpinWheelPrize.prototype, "productId", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, sequelize_typescript_1.ForeignKey)(() => product_variant_entity_1.ProductVariant),
|
|
72
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
73
|
+
__metadata("design:type", Number)
|
|
74
|
+
], SpinWheelPrize.prototype, "productVariantId", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, sequelize_typescript_1.Column)({
|
|
77
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(SpinPrizeStatus)),
|
|
78
|
+
allowNull: false,
|
|
79
|
+
defaultValue: SpinPrizeStatus.PENDING,
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], SpinWheelPrize.prototype, "status", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.DATE, allowNull: true }),
|
|
85
|
+
__metadata("design:type", Date)
|
|
86
|
+
], SpinWheelPrize.prototype, "expiresAt", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, sequelize_typescript_1.ForeignKey)(() => order_entity_1.Order),
|
|
89
|
+
(0, sequelize_typescript_1.Column)({ allowNull: true }),
|
|
90
|
+
__metadata("design:type", Number)
|
|
91
|
+
], SpinWheelPrize.prototype, "redeemedOrderId", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.DATE, allowNull: true }),
|
|
94
|
+
__metadata("design:type", Date)
|
|
95
|
+
], SpinWheelPrize.prototype, "redeemedAt", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, sequelize_typescript_1.BelongsTo)(() => user_entity_1.User),
|
|
98
|
+
__metadata("design:type", user_entity_1.User)
|
|
99
|
+
], SpinWheelPrize.prototype, "user", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, sequelize_typescript_1.BelongsTo)(() => spin_wheel_spin_entity_1.SpinWheelSpin),
|
|
102
|
+
__metadata("design:type", spin_wheel_spin_entity_1.SpinWheelSpin)
|
|
103
|
+
], SpinWheelPrize.prototype, "spin", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, sequelize_typescript_1.BelongsTo)(() => spin_wheel_item_entity_1.SpinWheelItem),
|
|
106
|
+
__metadata("design:type", spin_wheel_item_entity_1.SpinWheelItem)
|
|
107
|
+
], SpinWheelPrize.prototype, "wheelItem", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, sequelize_typescript_1.BelongsTo)(() => coupon_entity_1.Coupon),
|
|
110
|
+
__metadata("design:type", coupon_entity_1.Coupon)
|
|
111
|
+
], SpinWheelPrize.prototype, "coupon", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, sequelize_typescript_1.BelongsTo)(() => product_entity_1.Product),
|
|
114
|
+
__metadata("design:type", product_entity_1.Product)
|
|
115
|
+
], SpinWheelPrize.prototype, "product", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, sequelize_typescript_1.BelongsTo)(() => product_variant_entity_1.ProductVariant),
|
|
118
|
+
__metadata("design:type", product_variant_entity_1.ProductVariant)
|
|
119
|
+
], SpinWheelPrize.prototype, "variant", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, sequelize_typescript_1.BelongsTo)(() => order_entity_1.Order),
|
|
122
|
+
__metadata("design:type", order_entity_1.Order)
|
|
123
|
+
], SpinWheelPrize.prototype, "redeemedOrder", void 0);
|
|
124
|
+
exports.SpinWheelPrize = SpinWheelPrize = __decorate([
|
|
125
|
+
sequelize_typescript_1.Table
|
|
126
|
+
], SpinWheelPrize);
|
|
127
|
+
//# sourceMappingURL=spin-wheel-prize.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin-wheel-prize.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/spin-wheel-prize.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAE8B;AAC9B,qEAAyD;AACzD,qEAAwE;AACxE,+CAAqC;AACrC,mDAAyC;AACzC,qDAA2C;AAC3C,qEAA0D;AAC1D,iDAAuC;AAEvC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,sCAAoB,CAAA;IACpB,wCAAqB,CAAA;IACrB,sCAAoB,CAAA;AACtB,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAKM,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,4BAAK;CA8ExC,CAAA;AA9EY,wCAAc;AAGjB;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,kBAAI,CAAC;IACtB,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CACN;AAIf;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,sCAAa,CAAC;IAC/B,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CACN;AAIf;IAFP,IAAA,iCAAU,EAAC,GAAG,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,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;uDACK;AAGzB;IADP,IAAA,6BAAM,EAAC,EAAE,IAAI,EAAE,+BAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;8BAC5B,IAAI;kDAAC;AAIlB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,CAAC;8BACR,kBAAI;4CAAC;AAGX;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,sCAAa,CAAC;8BACjB,sCAAa;4CAAC;AAGpB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,sCAAa,CAAC;8BACZ,sCAAa;iDAAC;AAGzB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;8BACP,sBAAM;8CAAC;AAGhB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,CAAC;8BACP,wBAAO;+CAAC;AAGlB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,CAAC;8BACd,uCAAc;+CAAC;AAGzB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,oBAAK,CAAC;8BACC,oBAAK;qDAAC;yBA7EnB,cAAc;IAD1B,4BAAK;GACO,cAAc,CA8E1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { SpinWheel } from './spin-wheel.entity';
|
|
3
|
+
import { SpinWheelItem } from './spin-wheel-item.entity';
|
|
4
|
+
import { User } from './user.entity';
|
|
5
|
+
export declare class SpinWheelSpin extends Model {
|
|
6
|
+
wheelId: number;
|
|
7
|
+
userId: number;
|
|
8
|
+
wheelItemId: number;
|
|
9
|
+
wheel: SpinWheel;
|
|
10
|
+
wheelItem: SpinWheelItem;
|
|
11
|
+
user: User;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SpinWheelSpin = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const spin_wheel_entity_1 = require("./spin-wheel.entity");
|
|
15
|
+
const spin_wheel_item_entity_1 = require("./spin-wheel-item.entity");
|
|
16
|
+
const user_entity_1 = require("./user.entity");
|
|
17
|
+
let SpinWheelSpin = class SpinWheelSpin extends sequelize_typescript_1.Model {
|
|
18
|
+
};
|
|
19
|
+
exports.SpinWheelSpin = SpinWheelSpin;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, sequelize_typescript_1.ForeignKey)(() => spin_wheel_entity_1.SpinWheel),
|
|
22
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], SpinWheelSpin.prototype, "wheelId", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, sequelize_typescript_1.ForeignKey)(() => user_entity_1.User),
|
|
27
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], SpinWheelSpin.prototype, "userId", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, sequelize_typescript_1.ForeignKey)(() => spin_wheel_item_entity_1.SpinWheelItem),
|
|
32
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], SpinWheelSpin.prototype, "wheelItemId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, sequelize_typescript_1.BelongsTo)(() => spin_wheel_entity_1.SpinWheel),
|
|
37
|
+
__metadata("design:type", spin_wheel_entity_1.SpinWheel)
|
|
38
|
+
], SpinWheelSpin.prototype, "wheel", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, sequelize_typescript_1.BelongsTo)(() => spin_wheel_item_entity_1.SpinWheelItem),
|
|
41
|
+
__metadata("design:type", spin_wheel_item_entity_1.SpinWheelItem)
|
|
42
|
+
], SpinWheelSpin.prototype, "wheelItem", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, sequelize_typescript_1.BelongsTo)(() => user_entity_1.User),
|
|
45
|
+
__metadata("design:type", user_entity_1.User)
|
|
46
|
+
], SpinWheelSpin.prototype, "user", void 0);
|
|
47
|
+
exports.SpinWheelSpin = SpinWheelSpin = __decorate([
|
|
48
|
+
sequelize_typescript_1.Table
|
|
49
|
+
], SpinWheelSpin);
|
|
50
|
+
//# sourceMappingURL=spin-wheel-spin.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin-wheel-spin.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/spin-wheel-spin.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAE8B;AAC9B,2DAAgD;AAChD,qEAAyD;AACzD,+CAAqC;AAK9B,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,4BAAK;CAqBvC,CAAA;AArBY,sCAAa;AAGhB;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,6BAAS,CAAC;IAC3B,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;8CACL;AAIhB;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,kBAAI,CAAC;IACtB,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;6CACN;AAIf;IAFP,IAAA,iCAAU,EAAC,GAAG,EAAE,CAAC,sCAAa,CAAC;IAC/B,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDACD;AAGpB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,6BAAS,CAAC;8BACZ,6BAAS;4CAAC;AAGjB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,sCAAa,CAAC;8BACZ,sCAAa;gDAAC;AAGzB;IADP,IAAA,gCAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,CAAC;8BACR,kBAAI;2CAAC;wBApBR,aAAa;IADzB,4BAAK;GACO,aAAa,CAqBzB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { SpinWheelItem } from './spin-wheel-item.entity';
|
|
3
|
+
export declare enum SpinWheelStatus {
|
|
4
|
+
ACTIVE = "active",
|
|
5
|
+
INACTIVE = "inactive",
|
|
6
|
+
DRAFT = "draft"
|
|
7
|
+
}
|
|
8
|
+
export declare enum SpinFrequency {
|
|
9
|
+
TOTAL = "total",
|
|
10
|
+
DAILY = "daily",
|
|
11
|
+
WEEKLY = "weekly"
|
|
12
|
+
}
|
|
13
|
+
export declare class SpinWheel extends Model {
|
|
14
|
+
nameEn: string;
|
|
15
|
+
nameAr: string;
|
|
16
|
+
startDate: Date | null;
|
|
17
|
+
endDate: Date | null;
|
|
18
|
+
spinsPerCustomer: number;
|
|
19
|
+
spinFrequency: SpinFrequency;
|
|
20
|
+
status: SpinWheelStatus;
|
|
21
|
+
sortOrder: number;
|
|
22
|
+
items: SpinWheelItem[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SpinWheel = exports.SpinFrequency = exports.SpinWheelStatus = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const spin_wheel_item_entity_1 = require("./spin-wheel-item.entity");
|
|
15
|
+
var SpinWheelStatus;
|
|
16
|
+
(function (SpinWheelStatus) {
|
|
17
|
+
SpinWheelStatus["ACTIVE"] = "active";
|
|
18
|
+
SpinWheelStatus["INACTIVE"] = "inactive";
|
|
19
|
+
SpinWheelStatus["DRAFT"] = "draft";
|
|
20
|
+
})(SpinWheelStatus || (exports.SpinWheelStatus = SpinWheelStatus = {}));
|
|
21
|
+
var SpinFrequency;
|
|
22
|
+
(function (SpinFrequency) {
|
|
23
|
+
SpinFrequency["TOTAL"] = "total";
|
|
24
|
+
SpinFrequency["DAILY"] = "daily";
|
|
25
|
+
SpinFrequency["WEEKLY"] = "weekly";
|
|
26
|
+
})(SpinFrequency || (exports.SpinFrequency = SpinFrequency = {}));
|
|
27
|
+
let SpinWheel = class SpinWheel extends sequelize_typescript_1.Model {
|
|
28
|
+
};
|
|
29
|
+
exports.SpinWheel = SpinWheel;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], SpinWheel.prototype, "nameEn", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], SpinWheel.prototype, "nameAr", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.DATE, allowNull: true }),
|
|
40
|
+
__metadata("design:type", Date)
|
|
41
|
+
], SpinWheel.prototype, "startDate", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.DATE, allowNull: true }),
|
|
44
|
+
__metadata("design:type", Date)
|
|
45
|
+
], SpinWheel.prototype, "endDate", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, sequelize_typescript_1.Column)({ type: sequelize_typescript_1.DataType.INTEGER, allowNull: false, defaultValue: 1 }),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], SpinWheel.prototype, "spinsPerCustomer", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, sequelize_typescript_1.Column)({
|
|
52
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(SpinFrequency)),
|
|
53
|
+
allowNull: false,
|
|
54
|
+
defaultValue: SpinFrequency.TOTAL,
|
|
55
|
+
}),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], SpinWheel.prototype, "spinFrequency", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, sequelize_typescript_1.Column)({
|
|
60
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(SpinWheelStatus)),
|
|
61
|
+
allowNull: false,
|
|
62
|
+
defaultValue: SpinWheelStatus.DRAFT,
|
|
63
|
+
}),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], SpinWheel.prototype, "status", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false, defaultValue: 0 }),
|
|
68
|
+
__metadata("design:type", Number)
|
|
69
|
+
], SpinWheel.prototype, "sortOrder", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, sequelize_typescript_1.HasMany)(() => spin_wheel_item_entity_1.SpinWheelItem),
|
|
72
|
+
__metadata("design:type", Array)
|
|
73
|
+
], SpinWheel.prototype, "items", void 0);
|
|
74
|
+
exports.SpinWheel = SpinWheel = __decorate([
|
|
75
|
+
sequelize_typescript_1.Table
|
|
76
|
+
], SpinWheel);
|
|
77
|
+
//# sourceMappingURL=spin-wheel.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin-wheel.entity.js","sourceRoot":"","sources":["../../../../libs/tatayab-entities-library/src/entities/spin-wheel.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAE8B;AAC9B,qEAAyD;AAEzD,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,oCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,kCAAkB,CAAA;AACpB,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAGD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,gCAAgB,CAAA;IAChB,gCAAgB,CAAA;IAChB,kCAAiB,CAAA;AACnB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAGM,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,4BAAK;CAsCnC,CAAA;AAtCY,8BAAS;AAEZ;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;yCACN;AAGf;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;yCACN;AAIf;IADP,IAAA,6BAAM,EAAC,EAAE,IAAI,EAAE,+BAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;8BAC9B,IAAI;4CAAQ;AAGvB;IADP,IAAA,6BAAM,EAAC,EAAE,IAAI,EAAE,+BAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;8BAChC,IAAI;0CAAQ;AAIrB;IADP,IAAA,6BAAM,EAAC,EAAE,IAAI,EAAE,+BAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;;mDACrC;AAOzB;IALP,IAAA,6BAAM,EAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACpD,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,aAAa,CAAC,KAAK;KAClC,CAAC;;gDACmC;AAO7B;IALP,IAAA,6BAAM,EAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACtD,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,eAAe,CAAC,KAAK;KACpC,CAAC;;yCAC8B;AAIxB;IADP,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;;4CACpB;AAGlB;IADP,IAAA,8BAAO,EAAC,GAAG,EAAE,CAAC,sCAAa,CAAC;;wCACE;oBArCpB,SAAS;IADrB,4BAAK;GACO,SAAS,CAsCrB"}
|
|
@@ -13,6 +13,10 @@ export { Banner, BannerPlacement, BannerStatus, BannerFilters, } from './entitie
|
|
|
13
13
|
export { AppConfig } from './entities/app-config.entity';
|
|
14
14
|
export { PopupAd, PopupAdType, PopupAdStatus, PopupAdRefIds, } from './entities/popup-ad.entity';
|
|
15
15
|
export { PopupAdStore } from './entities/popup-ad-store.entity';
|
|
16
|
+
export { SpinWheel, SpinWheelStatus, SpinFrequency, } from './entities/spin-wheel.entity';
|
|
17
|
+
export { SpinWheelItem, SpinPrizeType, SpinWheelItemStatus, } from './entities/spin-wheel-item.entity';
|
|
18
|
+
export { SpinWheelSpin } from './entities/spin-wheel-spin.entity';
|
|
19
|
+
export { SpinWheelPrize, SpinPrizeStatus, } from './entities/spin-wheel-prize.entity';
|
|
16
20
|
export { RunSheet, RunSheetStatus } from './entities/run-sheet.entity';
|
|
17
21
|
export { RunSheetOrder, RunSheetOrderStatus, } from './entities/run-sheet-order.entity';
|
|
18
22
|
export { Refund, RefundMethod, RefundStatus } from './entities/refund.entity';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.StockMovementType = exports.PurchaseOrderStatus = exports.Gender = exports.Status = exports.Language = exports.VersionType = exports.ProductApp = exports.OsName = exports.MarketingFeed = exports.ReturnItemDestination = void 0;
|
|
3
|
+
exports.Bundle = exports.ProductTag = exports.Tag = exports.ProductVariantOption = exports.ProductVariant = exports.MediaType = exports.ProductMedia = exports.Product = exports.VariantOption = exports.VariantType = exports.Brand = exports.CategoryListingType = exports.Category = exports.PasswordResetOtp = exports.UserWalletBalance = exports.RefundStatus = exports.RefundMethod = exports.Refund = exports.RunSheetOrderStatus = exports.RunSheetOrder = exports.RunSheetStatus = exports.RunSheet = exports.SpinPrizeStatus = exports.SpinWheelPrize = exports.SpinWheelSpin = exports.SpinWheelItemStatus = exports.SpinPrizeType = exports.SpinWheelItem = exports.SpinFrequency = exports.SpinWheelStatus = exports.SpinWheel = exports.PopupAdStore = exports.PopupAdStatus = exports.PopupAdType = exports.PopupAd = exports.AppConfig = exports.BannerStatus = exports.BannerPlacement = exports.Banner = exports.FavoriteCatalogItemType = exports.UserFavoriteCatalog = exports.UserFavorite = exports.UserAddress = exports.UserDevice = exports.User = exports.SysUser = exports.SysRole = exports.Area = exports.Country = exports.ApiKey = void 0;
|
|
4
|
+
exports.OrderEditScenario = exports.OrderItemChangeLog = exports.PurchaseOrderReceiptItem = exports.PurchaseOrderReceipt = exports.PurchaseOrderOrderItem = exports.TransactionCategory = exports.TransactionType = exports.UserTransaction = exports.OrderStatusHistory = exports.OrderItemBundleSelection = exports.OrderItemFulfillmentStatus = exports.OrderItemType = exports.OrderItem = exports.Order = exports.OrderStatusCode = exports.OrderStatus = exports.CouponUser = exports.CouponProduct = exports.CouponStore = exports.CouponOsTarget = exports.CouponAppliesTo = exports.CouponDiscountType = exports.Coupon = exports.CartItemBundleSelection = exports.CartItemType = exports.CartItem = exports.CartStatus = exports.Cart = exports.StorePaymentMethod = exports.PaymentMethodCountry = exports.PaymentMethodType = exports.PaymentMethod = exports.PaymentGatewayType = exports.PaymentGateway = exports.RolePermission = exports.Permission = exports.PurchaseOrderItemStatus = exports.PurchaseOrderItem = exports.PurchaseOrder = exports.VendorProduct = exports.Vendor = exports.ShippingRule = exports.StockMovement = exports.InventoryStock = exports.StoreInventory = exports.Inventory = exports.ProductStore = exports.Store = exports.BundleStore = exports.BundleProduct = void 0;
|
|
5
|
+
exports.StockMovementType = exports.PurchaseOrderStatus = exports.Gender = exports.Status = exports.Language = exports.VersionType = exports.ProductApp = exports.OsName = exports.MarketingFeed = exports.ReturnItemDestination = exports.ReturnItemStatus = exports.ReturnRequestItem = exports.ReturnRequestStatus = exports.ReturnRequest = exports.OrderEditItem = exports.OrderEditSession = exports.OrderPaymentType = exports.OrderPaymentStatus = exports.OrderPayment = void 0;
|
|
6
6
|
exports.getDbModels = getDbModels;
|
|
7
7
|
const country_entity_1 = require("./entities/country.entity");
|
|
8
8
|
const area_entity_1 = require("./entities/area.entity");
|
|
@@ -18,6 +18,10 @@ const banner_entity_1 = require("./entities/banner.entity");
|
|
|
18
18
|
const app_config_entity_1 = require("./entities/app-config.entity");
|
|
19
19
|
const popup_ad_entity_1 = require("./entities/popup-ad.entity");
|
|
20
20
|
const popup_ad_store_entity_1 = require("./entities/popup-ad-store.entity");
|
|
21
|
+
const spin_wheel_entity_1 = require("./entities/spin-wheel.entity");
|
|
22
|
+
const spin_wheel_item_entity_1 = require("./entities/spin-wheel-item.entity");
|
|
23
|
+
const spin_wheel_spin_entity_1 = require("./entities/spin-wheel-spin.entity");
|
|
24
|
+
const spin_wheel_prize_entity_1 = require("./entities/spin-wheel-prize.entity");
|
|
21
25
|
const category_entity_1 = require("./entities/category.entity");
|
|
22
26
|
const brand_entity_1 = require("./entities/brand.entity");
|
|
23
27
|
const variant_type_entity_1 = require("./entities/variant-type.entity");
|
|
@@ -109,6 +113,19 @@ Object.defineProperty(exports, "PopupAdType", { enumerable: true, get: function
|
|
|
109
113
|
Object.defineProperty(exports, "PopupAdStatus", { enumerable: true, get: function () { return popup_ad_entity_2.PopupAdStatus; } });
|
|
110
114
|
var popup_ad_store_entity_2 = require("./entities/popup-ad-store.entity");
|
|
111
115
|
Object.defineProperty(exports, "PopupAdStore", { enumerable: true, get: function () { return popup_ad_store_entity_2.PopupAdStore; } });
|
|
116
|
+
var spin_wheel_entity_2 = require("./entities/spin-wheel.entity");
|
|
117
|
+
Object.defineProperty(exports, "SpinWheel", { enumerable: true, get: function () { return spin_wheel_entity_2.SpinWheel; } });
|
|
118
|
+
Object.defineProperty(exports, "SpinWheelStatus", { enumerable: true, get: function () { return spin_wheel_entity_2.SpinWheelStatus; } });
|
|
119
|
+
Object.defineProperty(exports, "SpinFrequency", { enumerable: true, get: function () { return spin_wheel_entity_2.SpinFrequency; } });
|
|
120
|
+
var spin_wheel_item_entity_2 = require("./entities/spin-wheel-item.entity");
|
|
121
|
+
Object.defineProperty(exports, "SpinWheelItem", { enumerable: true, get: function () { return spin_wheel_item_entity_2.SpinWheelItem; } });
|
|
122
|
+
Object.defineProperty(exports, "SpinPrizeType", { enumerable: true, get: function () { return spin_wheel_item_entity_2.SpinPrizeType; } });
|
|
123
|
+
Object.defineProperty(exports, "SpinWheelItemStatus", { enumerable: true, get: function () { return spin_wheel_item_entity_2.SpinWheelItemStatus; } });
|
|
124
|
+
var spin_wheel_spin_entity_2 = require("./entities/spin-wheel-spin.entity");
|
|
125
|
+
Object.defineProperty(exports, "SpinWheelSpin", { enumerable: true, get: function () { return spin_wheel_spin_entity_2.SpinWheelSpin; } });
|
|
126
|
+
var spin_wheel_prize_entity_2 = require("./entities/spin-wheel-prize.entity");
|
|
127
|
+
Object.defineProperty(exports, "SpinWheelPrize", { enumerable: true, get: function () { return spin_wheel_prize_entity_2.SpinWheelPrize; } });
|
|
128
|
+
Object.defineProperty(exports, "SpinPrizeStatus", { enumerable: true, get: function () { return spin_wheel_prize_entity_2.SpinPrizeStatus; } });
|
|
112
129
|
var run_sheet_entity_2 = require("./entities/run-sheet.entity");
|
|
113
130
|
Object.defineProperty(exports, "RunSheet", { enumerable: true, get: function () { return run_sheet_entity_2.RunSheet; } });
|
|
114
131
|
Object.defineProperty(exports, "RunSheetStatus", { enumerable: true, get: function () { return run_sheet_entity_2.RunSheetStatus; } });
|
|
@@ -339,6 +356,10 @@ function getDbModels() {
|
|
|
339
356
|
PasswordResetOtp_1.PasswordResetOtp,
|
|
340
357
|
popup_ad_entity_1.PopupAd,
|
|
341
358
|
popup_ad_store_entity_1.PopupAdStore,
|
|
359
|
+
spin_wheel_entity_1.SpinWheel,
|
|
360
|
+
spin_wheel_item_entity_1.SpinWheelItem,
|
|
361
|
+
spin_wheel_spin_entity_1.SpinWheelSpin,
|
|
362
|
+
spin_wheel_prize_entity_1.SpinWheelPrize,
|
|
342
363
|
return_request_entity_1.ReturnRequest,
|
|
343
364
|
return_request_item_entity_1.ReturnRequestItem,
|
|
344
365
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/tatayab-entities-library/src/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/tatayab-entities-library/src/index.ts"],"names":[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BAAQ;QACR,2DAAuB;QAGvB,sBAAM;QACN,iCAAW;QACX,qCAAa;QACb,+BAAU;QAGV,iCAAW;QACX,oBAAK;QACL,6BAAS;QACT,6DAAwB;QACxB,gDAAkB;QAClB,yDAAsB;QAGtB,sBAAM;QAEN,6BAAS;QAET,2BAAQ;QACR,sCAAa;QAEb,sBAAM;QACN,oDAAoB;QACpB,6DAAwB;QAExB,iDAAkB;QAClB,mCAAY;QACZ,4CAAgB;QAChB,sCAAa;QAEb,qCAAa;QACb,mCAAgB;QAGhB,yBAAO;QACP,oCAAY;QAGZ,6BAAS;QACT,sCAAa;QACb,sCAAa;QACb,wCAAc;QAGd,qCAAa;QACb,8CAAiB;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Product } from './product.entity';
|
|
|
7
7
|
import { ProductVariant } from './product-variant.entity';
|
|
8
8
|
import { Bundle } from './bundle.entity';
|
|
9
9
|
import { CartItemBundleSelection } from './cart-item-bundle-selection.entity';
|
|
10
|
+
import { SpinWheelPrize } from './spin-wheel-prize.entity';
|
|
10
11
|
|
|
11
12
|
export enum CartItemType {
|
|
12
13
|
PRODUCT = 'product',
|
|
@@ -51,6 +52,12 @@ export class CartItem extends Model {
|
|
|
51
52
|
@Column({ type: DataType.DECIMAL(10, 3), allowNull: false })
|
|
52
53
|
declare unitPrice: number;
|
|
53
54
|
|
|
55
|
+
// ── Spin & Win — set when this line is a free-product prize ──────────────────
|
|
56
|
+
// Prize lines are locked: quantity fixed at 1, unitPrice fixed at 0
|
|
57
|
+
@ForeignKey(() => SpinWheelPrize)
|
|
58
|
+
@Column({ allowNull: true })
|
|
59
|
+
declare spinPrizeId?: number;
|
|
60
|
+
|
|
54
61
|
// ── Stock flag — set true by the stock-check endpoint ─────────────────────────
|
|
55
62
|
// Cleared when user updates qty or item is re-validated
|
|
56
63
|
@Column({ allowNull: false, defaultValue: false })
|
|
@@ -72,4 +79,7 @@ export class CartItem extends Model {
|
|
|
72
79
|
|
|
73
80
|
@HasMany(() => CartItemBundleSelection)
|
|
74
81
|
declare bundleSelections: CartItemBundleSelection[];
|
|
82
|
+
|
|
83
|
+
@BelongsTo(() => SpinWheelPrize)
|
|
84
|
+
declare spinPrize?: SpinWheelPrize;
|
|
75
85
|
}
|
|
@@ -66,6 +66,10 @@ export class ReturnRequestItem extends Model {
|
|
|
66
66
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
67
67
|
declare notes?: string;
|
|
68
68
|
|
|
69
|
+
// Optional photo uploaded by admin at return-request creation time
|
|
70
|
+
@Column({ allowNull: true })
|
|
71
|
+
declare image?: string;
|
|
72
|
+
|
|
69
73
|
// ─── Associations ─────────────────────────────────────────────────────────────
|
|
70
74
|
|
|
71
75
|
@BelongsTo(() => ReturnRequest)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table, Column, Model, DataType, ForeignKey, BelongsTo,
|
|
3
|
+
} from 'sequelize-typescript';
|
|
4
|
+
import { SpinWheel } from './spin-wheel.entity';
|
|
5
|
+
import { Coupon } from './coupon.entity';
|
|
6
|
+
import { Product } from './product.entity';
|
|
7
|
+
import { ProductVariant } from './product-variant.entity';
|
|
8
|
+
|
|
9
|
+
export enum SpinPrizeType {
|
|
10
|
+
COUPON = 'coupon', // Wins an existing coupon (assigned to the user)
|
|
11
|
+
FREE_PRODUCT = 'free_product', // Wins a product added free to the next order
|
|
12
|
+
NO_PRIZE = 'no_prize', // "Better luck next time" slice
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum SpinWheelItemStatus {
|
|
16
|
+
ACTIVE = 'active',
|
|
17
|
+
INACTIVE = 'inactive',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Table
|
|
21
|
+
export class SpinWheelItem extends Model {
|
|
22
|
+
@ForeignKey(() => SpinWheel)
|
|
23
|
+
@Column({ allowNull: false })
|
|
24
|
+
declare wheelId: number;
|
|
25
|
+
|
|
26
|
+
@Column({ allowNull: false })
|
|
27
|
+
declare labelEn: string;
|
|
28
|
+
|
|
29
|
+
@Column({ allowNull: false })
|
|
30
|
+
declare labelAr: string;
|
|
31
|
+
|
|
32
|
+
@Column({
|
|
33
|
+
type: DataType.ENUM(...Object.values(SpinPrizeType)),
|
|
34
|
+
allowNull: false,
|
|
35
|
+
})
|
|
36
|
+
declare prizeType: SpinPrizeType;
|
|
37
|
+
|
|
38
|
+
// ── Prize reference (exactly one branch set, per prizeType) ─────────────────
|
|
39
|
+
@ForeignKey(() => Coupon)
|
|
40
|
+
@Column({ allowNull: true })
|
|
41
|
+
declare couponId?: number;
|
|
42
|
+
|
|
43
|
+
// free_product: productId required; productVariantId required only when
|
|
44
|
+
// the product has variants (specific variant is the prize)
|
|
45
|
+
@ForeignKey(() => Product)
|
|
46
|
+
@Column({ allowNull: true })
|
|
47
|
+
declare productId?: number;
|
|
48
|
+
|
|
49
|
+
@ForeignKey(() => ProductVariant)
|
|
50
|
+
@Column({ allowNull: true })
|
|
51
|
+
declare productVariantId?: number;
|
|
52
|
+
|
|
53
|
+
// ── Odds — percentage share of the wheel; all slices must total 100 ─────────
|
|
54
|
+
@Column({ type: DataType.DECIMAL(5, 2), allowNull: false })
|
|
55
|
+
declare winPercentage: number;
|
|
56
|
+
|
|
57
|
+
// ── Win quota — null = unlimited. A slice with winsCount >= maxWins is
|
|
58
|
+
// treated as no_prize when drawn (marketing sees exhaustion in the stats) ────
|
|
59
|
+
@Column({ type: DataType.INTEGER, allowNull: true })
|
|
60
|
+
declare maxWins?: number;
|
|
61
|
+
|
|
62
|
+
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
|
|
63
|
+
declare winsCount: number;
|
|
64
|
+
|
|
65
|
+
// Days the won prize stays redeemable — null = never expires
|
|
66
|
+
@Column({ type: DataType.INTEGER, allowNull: true })
|
|
67
|
+
declare prizeExpiryDays?: number;
|
|
68
|
+
|
|
69
|
+
@Column({
|
|
70
|
+
type: DataType.ENUM(...Object.values(SpinWheelItemStatus)),
|
|
71
|
+
allowNull: false,
|
|
72
|
+
defaultValue: SpinWheelItemStatus.ACTIVE,
|
|
73
|
+
})
|
|
74
|
+
declare status: SpinWheelItemStatus;
|
|
75
|
+
|
|
76
|
+
@Column({ allowNull: false, defaultValue: 0 })
|
|
77
|
+
declare sortOrder: number;
|
|
78
|
+
|
|
79
|
+
// ── Associations ─────────────────────────────────────────────────────────────
|
|
80
|
+
@BelongsTo(() => SpinWheel)
|
|
81
|
+
declare wheel: SpinWheel;
|
|
82
|
+
|
|
83
|
+
@BelongsTo(() => Coupon)
|
|
84
|
+
declare coupon?: Coupon;
|
|
85
|
+
|
|
86
|
+
@BelongsTo(() => Product)
|
|
87
|
+
declare product?: Product;
|
|
88
|
+
|
|
89
|
+
@BelongsTo(() => ProductVariant)
|
|
90
|
+
declare variant?: ProductVariant;
|
|
91
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table, Column, Model, DataType, ForeignKey, BelongsTo,
|
|
3
|
+
} from 'sequelize-typescript';
|
|
4
|
+
import { SpinWheelSpin } from './spin-wheel-spin.entity';
|
|
5
|
+
import { SpinWheelItem, SpinPrizeType } from './spin-wheel-item.entity';
|
|
6
|
+
import { User } from './user.entity';
|
|
7
|
+
import { Coupon } from './coupon.entity';
|
|
8
|
+
import { Product } from './product.entity';
|
|
9
|
+
import { ProductVariant } from './product-variant.entity';
|
|
10
|
+
import { Order } from './order.entity';
|
|
11
|
+
|
|
12
|
+
export enum SpinPrizeStatus {
|
|
13
|
+
PENDING = 'pending', // Won, not yet used — redeemable
|
|
14
|
+
REDEEMED = 'redeemed', // Consumed by a placed order
|
|
15
|
+
EXPIRED = 'expired', // Passed expiresAt before being used
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// A won prize is a liability with a lifecycle — separate from the spin log.
|
|
19
|
+
// no_prize spins do NOT create a row here.
|
|
20
|
+
@Table
|
|
21
|
+
export class SpinWheelPrize extends Model {
|
|
22
|
+
@ForeignKey(() => User)
|
|
23
|
+
@Column({ allowNull: false })
|
|
24
|
+
declare userId: number;
|
|
25
|
+
|
|
26
|
+
@ForeignKey(() => SpinWheelSpin)
|
|
27
|
+
@Column({ allowNull: false })
|
|
28
|
+
declare spinId: number;
|
|
29
|
+
|
|
30
|
+
@ForeignKey(() => SpinWheelItem)
|
|
31
|
+
@Column({ allowNull: false })
|
|
32
|
+
declare wheelItemId: number;
|
|
33
|
+
|
|
34
|
+
@Column({
|
|
35
|
+
type: DataType.ENUM(...Object.values(SpinPrizeType)),
|
|
36
|
+
allowNull: false,
|
|
37
|
+
})
|
|
38
|
+
declare prizeType: SpinPrizeType;
|
|
39
|
+
|
|
40
|
+
// ── Prize snapshot — survives later edits to the wheel item ─────────────────
|
|
41
|
+
@Column({ allowNull: false })
|
|
42
|
+
declare labelEn: string;
|
|
43
|
+
|
|
44
|
+
@Column({ allowNull: false })
|
|
45
|
+
declare labelAr: string;
|
|
46
|
+
|
|
47
|
+
@ForeignKey(() => Coupon)
|
|
48
|
+
@Column({ allowNull: true })
|
|
49
|
+
declare couponId?: number;
|
|
50
|
+
|
|
51
|
+
@ForeignKey(() => Product)
|
|
52
|
+
@Column({ allowNull: true })
|
|
53
|
+
declare productId?: number;
|
|
54
|
+
|
|
55
|
+
@ForeignKey(() => ProductVariant)
|
|
56
|
+
@Column({ allowNull: true })
|
|
57
|
+
declare productVariantId?: number;
|
|
58
|
+
|
|
59
|
+
// ── Lifecycle ────────────────────────────────────────────────────────────────
|
|
60
|
+
@Column({
|
|
61
|
+
type: DataType.ENUM(...Object.values(SpinPrizeStatus)),
|
|
62
|
+
allowNull: false,
|
|
63
|
+
defaultValue: SpinPrizeStatus.PENDING,
|
|
64
|
+
})
|
|
65
|
+
declare status: SpinPrizeStatus;
|
|
66
|
+
|
|
67
|
+
// null = never expires
|
|
68
|
+
@Column({ type: DataType.DATE, allowNull: true })
|
|
69
|
+
declare expiresAt?: Date;
|
|
70
|
+
|
|
71
|
+
@ForeignKey(() => Order)
|
|
72
|
+
@Column({ allowNull: true })
|
|
73
|
+
declare redeemedOrderId?: number;
|
|
74
|
+
|
|
75
|
+
@Column({ type: DataType.DATE, allowNull: true })
|
|
76
|
+
declare redeemedAt?: Date;
|
|
77
|
+
|
|
78
|
+
// ── Associations ─────────────────────────────────────────────────────────────
|
|
79
|
+
@BelongsTo(() => User)
|
|
80
|
+
declare user: User;
|
|
81
|
+
|
|
82
|
+
@BelongsTo(() => SpinWheelSpin)
|
|
83
|
+
declare spin: SpinWheelSpin;
|
|
84
|
+
|
|
85
|
+
@BelongsTo(() => SpinWheelItem)
|
|
86
|
+
declare wheelItem: SpinWheelItem;
|
|
87
|
+
|
|
88
|
+
@BelongsTo(() => Coupon)
|
|
89
|
+
declare coupon?: Coupon;
|
|
90
|
+
|
|
91
|
+
@BelongsTo(() => Product)
|
|
92
|
+
declare product?: Product;
|
|
93
|
+
|
|
94
|
+
@BelongsTo(() => ProductVariant)
|
|
95
|
+
declare variant?: ProductVariant;
|
|
96
|
+
|
|
97
|
+
@BelongsTo(() => Order)
|
|
98
|
+
declare redeemedOrder?: Order;
|
|
99
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table, Column, Model, ForeignKey, BelongsTo,
|
|
3
|
+
} from 'sequelize-typescript';
|
|
4
|
+
import { SpinWheel } from './spin-wheel.entity';
|
|
5
|
+
import { SpinWheelItem } from './spin-wheel-item.entity';
|
|
6
|
+
import { User } from './user.entity';
|
|
7
|
+
|
|
8
|
+
// Immutable audit log — one row per executed spin.
|
|
9
|
+
// Spin allowance is enforced by counting rows here, so never delete them.
|
|
10
|
+
@Table
|
|
11
|
+
export class SpinWheelSpin extends Model {
|
|
12
|
+
@ForeignKey(() => SpinWheel)
|
|
13
|
+
@Column({ allowNull: false })
|
|
14
|
+
declare wheelId: number;
|
|
15
|
+
|
|
16
|
+
@ForeignKey(() => User)
|
|
17
|
+
@Column({ allowNull: false })
|
|
18
|
+
declare userId: number;
|
|
19
|
+
|
|
20
|
+
@ForeignKey(() => SpinWheelItem)
|
|
21
|
+
@Column({ allowNull: false })
|
|
22
|
+
declare wheelItemId: number;
|
|
23
|
+
|
|
24
|
+
@BelongsTo(() => SpinWheel)
|
|
25
|
+
declare wheel: SpinWheel;
|
|
26
|
+
|
|
27
|
+
@BelongsTo(() => SpinWheelItem)
|
|
28
|
+
declare wheelItem: SpinWheelItem;
|
|
29
|
+
|
|
30
|
+
@BelongsTo(() => User)
|
|
31
|
+
declare user: User;
|
|
32
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table, Column, Model, DataType, HasMany,
|
|
3
|
+
} from 'sequelize-typescript';
|
|
4
|
+
import { SpinWheelItem } from './spin-wheel-item.entity';
|
|
5
|
+
|
|
6
|
+
export enum SpinWheelStatus {
|
|
7
|
+
ACTIVE = 'active',
|
|
8
|
+
INACTIVE = 'inactive',
|
|
9
|
+
DRAFT = 'draft',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// How the spinsPerCustomer allowance resets
|
|
13
|
+
export enum SpinFrequency {
|
|
14
|
+
TOTAL = 'total', // N spins for the whole campaign lifetime
|
|
15
|
+
DAILY = 'daily', // N spins per calendar day (UTC)
|
|
16
|
+
WEEKLY = 'weekly', // N spins per calendar week (Mon–Sun, UTC)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Table
|
|
20
|
+
export class SpinWheel extends Model {
|
|
21
|
+
@Column({ allowNull: false })
|
|
22
|
+
declare nameEn: string;
|
|
23
|
+
|
|
24
|
+
@Column({ allowNull: false })
|
|
25
|
+
declare nameAr: string;
|
|
26
|
+
|
|
27
|
+
// ── Validity period — both optional ─────────────────────────────────────────
|
|
28
|
+
@Column({ type: DataType.DATE, allowNull: true })
|
|
29
|
+
declare startDate: Date | null;
|
|
30
|
+
|
|
31
|
+
@Column({ type: DataType.DATE, allowNull: true })
|
|
32
|
+
declare endDate: Date | null;
|
|
33
|
+
|
|
34
|
+
// ── Spin allowance ───────────────────────────────────────────────────────────
|
|
35
|
+
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 1 })
|
|
36
|
+
declare spinsPerCustomer: number;
|
|
37
|
+
|
|
38
|
+
@Column({
|
|
39
|
+
type: DataType.ENUM(...Object.values(SpinFrequency)),
|
|
40
|
+
allowNull: false,
|
|
41
|
+
defaultValue: SpinFrequency.TOTAL,
|
|
42
|
+
})
|
|
43
|
+
declare spinFrequency: SpinFrequency;
|
|
44
|
+
|
|
45
|
+
@Column({
|
|
46
|
+
type: DataType.ENUM(...Object.values(SpinWheelStatus)),
|
|
47
|
+
allowNull: false,
|
|
48
|
+
defaultValue: SpinWheelStatus.DRAFT,
|
|
49
|
+
})
|
|
50
|
+
declare status: SpinWheelStatus;
|
|
51
|
+
|
|
52
|
+
// Tiebreaker when more than one wheel is active — lowest wins
|
|
53
|
+
@Column({ allowNull: false, defaultValue: 0 })
|
|
54
|
+
declare sortOrder: number;
|
|
55
|
+
|
|
56
|
+
@HasMany(() => SpinWheelItem)
|
|
57
|
+
declare items: SpinWheelItem[];
|
|
58
|
+
}
|
|
@@ -16,6 +16,12 @@ import { AppConfig } from './entities/app-config.entity';
|
|
|
16
16
|
import { PopupAd } from './entities/popup-ad.entity';
|
|
17
17
|
import { PopupAdStore } from './entities/popup-ad-store.entity';
|
|
18
18
|
|
|
19
|
+
// ─── Spin & Win ───────────────────────────────────────────────────────────────
|
|
20
|
+
import { SpinWheel } from './entities/spin-wheel.entity';
|
|
21
|
+
import { SpinWheelItem } from './entities/spin-wheel-item.entity';
|
|
22
|
+
import { SpinWheelSpin } from './entities/spin-wheel-spin.entity';
|
|
23
|
+
import { SpinWheelPrize } from './entities/spin-wheel-prize.entity';
|
|
24
|
+
|
|
19
25
|
// ─── Catalogue ────────────────────────────────────────────────────────────────
|
|
20
26
|
import { Category } from './entities/category.entity';
|
|
21
27
|
import { Brand } from './entities/brand.entity';
|
|
@@ -124,6 +130,21 @@ export {
|
|
|
124
130
|
PopupAdRefIds,
|
|
125
131
|
} from './entities/popup-ad.entity';
|
|
126
132
|
export { PopupAdStore } from './entities/popup-ad-store.entity';
|
|
133
|
+
export {
|
|
134
|
+
SpinWheel,
|
|
135
|
+
SpinWheelStatus,
|
|
136
|
+
SpinFrequency,
|
|
137
|
+
} from './entities/spin-wheel.entity';
|
|
138
|
+
export {
|
|
139
|
+
SpinWheelItem,
|
|
140
|
+
SpinPrizeType,
|
|
141
|
+
SpinWheelItemStatus,
|
|
142
|
+
} from './entities/spin-wheel-item.entity';
|
|
143
|
+
export { SpinWheelSpin } from './entities/spin-wheel-spin.entity';
|
|
144
|
+
export {
|
|
145
|
+
SpinWheelPrize,
|
|
146
|
+
SpinPrizeStatus,
|
|
147
|
+
} from './entities/spin-wheel-prize.entity';
|
|
127
148
|
export { RunSheet, RunSheetStatus } from './entities/run-sheet.entity';
|
|
128
149
|
export {
|
|
129
150
|
RunSheetOrder,
|
|
@@ -363,6 +384,12 @@ export function getDbModels(): ModelCtor[] {
|
|
|
363
384
|
PopupAd,
|
|
364
385
|
PopupAdStore,
|
|
365
386
|
|
|
387
|
+
// Spin & Win
|
|
388
|
+
SpinWheel,
|
|
389
|
+
SpinWheelItem,
|
|
390
|
+
SpinWheelSpin,
|
|
391
|
+
SpinWheelPrize,
|
|
392
|
+
|
|
366
393
|
// Returns
|
|
367
394
|
ReturnRequest,
|
|
368
395
|
ReturnRequestItem,
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
async up(queryInterface, Sequelize) {
|
|
6
|
+
await queryInterface.addColumn('ReturnRequestItems', 'image', {
|
|
7
|
+
type: Sequelize.STRING(500),
|
|
8
|
+
allowNull: true,
|
|
9
|
+
after: 'notes',
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
async down(queryInterface) {
|
|
14
|
+
await queryInterface.removeColumn('ReturnRequestItems', 'image');
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
// ── Wheels (campaigns) ─────────────────────────────────────────────────────
|
|
6
|
+
await queryInterface.createTable('SpinWheels', {
|
|
7
|
+
id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true },
|
|
8
|
+
nameEn: { type: Sequelize.STRING, allowNull: false },
|
|
9
|
+
nameAr: { type: Sequelize.STRING, allowNull: false },
|
|
10
|
+
startDate: { type: Sequelize.DATE, allowNull: true },
|
|
11
|
+
endDate: { type: Sequelize.DATE, allowNull: true },
|
|
12
|
+
spinsPerCustomer: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 1 },
|
|
13
|
+
spinFrequency: { type: Sequelize.ENUM('total', 'daily', 'weekly'), allowNull: false, defaultValue: 'total' },
|
|
14
|
+
status: { type: Sequelize.ENUM('active', 'inactive', 'draft'), allowNull: false, defaultValue: 'draft' },
|
|
15
|
+
sortOrder: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
|
16
|
+
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
17
|
+
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
18
|
+
deletedAt: { type: Sequelize.DATE, allowNull: true },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// ── Slices ─────────────────────────────────────────────────────────────────
|
|
22
|
+
await queryInterface.createTable('SpinWheelItems', {
|
|
23
|
+
id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true },
|
|
24
|
+
wheelId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'SpinWheels', key: 'id' }, onDelete: 'CASCADE' },
|
|
25
|
+
labelEn: { type: Sequelize.STRING, allowNull: false },
|
|
26
|
+
labelAr: { type: Sequelize.STRING, allowNull: false },
|
|
27
|
+
prizeType: { type: Sequelize.ENUM('coupon', 'free_product', 'no_prize'), allowNull: false },
|
|
28
|
+
couponId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'Coupons', key: 'id' } },
|
|
29
|
+
productId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'Products', key: 'id' } },
|
|
30
|
+
productVariantId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'ProductVariants', key: 'id' } },
|
|
31
|
+
winPercentage: { type: Sequelize.DECIMAL(5, 2), allowNull: false },
|
|
32
|
+
maxWins: { type: Sequelize.INTEGER, allowNull: true },
|
|
33
|
+
winsCount: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
|
34
|
+
prizeExpiryDays: { type: Sequelize.INTEGER, allowNull: true },
|
|
35
|
+
status: { type: Sequelize.ENUM('active', 'inactive'), allowNull: false, defaultValue: 'active' },
|
|
36
|
+
sortOrder: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
|
37
|
+
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
38
|
+
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
39
|
+
deletedAt: { type: Sequelize.DATE, allowNull: true },
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// ── Spin audit log ─────────────────────────────────────────────────────────
|
|
43
|
+
await queryInterface.createTable('SpinWheelSpins', {
|
|
44
|
+
id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true },
|
|
45
|
+
wheelId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'SpinWheels', key: 'id' } },
|
|
46
|
+
userId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'Users', key: 'id' } },
|
|
47
|
+
wheelItemId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'SpinWheelItems', key: 'id' } },
|
|
48
|
+
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
49
|
+
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
50
|
+
deletedAt: { type: Sequelize.DATE, allowNull: true },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Spin-allowance lookup: count spins per user per wheel in a time window
|
|
54
|
+
await queryInterface.addIndex('SpinWheelSpins', ['wheelId', 'userId', 'createdAt'], {
|
|
55
|
+
name: 'idx_spin_wheel_spins_wheel_user_time',
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// ── Won prizes ─────────────────────────────────────────────────────────────
|
|
59
|
+
await queryInterface.createTable('SpinWheelPrizes', {
|
|
60
|
+
id: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true },
|
|
61
|
+
userId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'Users', key: 'id' } },
|
|
62
|
+
spinId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'SpinWheelSpins', key: 'id' } },
|
|
63
|
+
wheelItemId: { type: Sequelize.INTEGER, allowNull: false, references: { model: 'SpinWheelItems', key: 'id' } },
|
|
64
|
+
prizeType: { type: Sequelize.ENUM('coupon', 'free_product', 'no_prize'), allowNull: false },
|
|
65
|
+
labelEn: { type: Sequelize.STRING, allowNull: false },
|
|
66
|
+
labelAr: { type: Sequelize.STRING, allowNull: false },
|
|
67
|
+
couponId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'Coupons', key: 'id' } },
|
|
68
|
+
productId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'Products', key: 'id' } },
|
|
69
|
+
productVariantId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'ProductVariants', key: 'id' } },
|
|
70
|
+
status: { type: Sequelize.ENUM('pending', 'redeemed', 'expired'), allowNull: false, defaultValue: 'pending' },
|
|
71
|
+
expiresAt: { type: Sequelize.DATE, allowNull: true },
|
|
72
|
+
redeemedOrderId: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'Orders', key: 'id' } },
|
|
73
|
+
redeemedAt: { type: Sequelize.DATE, allowNull: true },
|
|
74
|
+
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
75
|
+
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
76
|
+
deletedAt: { type: Sequelize.DATE, allowNull: true },
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// "My prizes" lookup
|
|
80
|
+
await queryInterface.addIndex('SpinWheelPrizes', ['userId', 'status'], {
|
|
81
|
+
name: 'idx_spin_wheel_prizes_user_status',
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// ── Free-product prize line in cart ────────────────────────────────────────
|
|
85
|
+
await queryInterface.addColumn('CartItems', 'spinPrizeId', {
|
|
86
|
+
type: Sequelize.INTEGER,
|
|
87
|
+
allowNull: true,
|
|
88
|
+
references: { model: 'SpinWheelPrizes', key: 'id' },
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
down: async (queryInterface) => {
|
|
93
|
+
await queryInterface.removeColumn('CartItems', 'spinPrizeId');
|
|
94
|
+
await queryInterface.dropTable('SpinWheelPrizes');
|
|
95
|
+
await queryInterface.dropTable('SpinWheelSpins');
|
|
96
|
+
await queryInterface.dropTable('SpinWheelItems');
|
|
97
|
+
await queryInterface.dropTable('SpinWheels');
|
|
98
|
+
},
|
|
99
|
+
};
|