@ashutoshvohra136/tenant-db-contract 1.0.0 → 1.0.2
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/constants/index.d.ts +8 -0
- package/dist/constants/index.js +24 -0
- package/dist/constants/status-code.option.d.ts +12 -0
- package/dist/constants/status-code.option.js +25 -13
- package/dist/entities/BranchManagerBrandsMappings.d.ts +1 -0
- package/dist/entities/BranchManagerBrandsMappings.js +4 -0
- package/dist/entities/BranchManagerMerchandiserMappings.d.ts +4 -0
- package/dist/entities/BranchManagerMerchandiserMappings.js +17 -0
- package/dist/entities/BrandPromotionSchemes.d.ts +15 -0
- package/dist/entities/BrandPromotionSchemes.js +65 -0
- package/dist/entities/Brands.d.ts +4 -0
- package/dist/entities/Brands.js +10 -0
- package/dist/entities/CompetitorAnalysisRecords.d.ts +35 -0
- package/dist/entities/CompetitorAnalysisRecords.js +159 -0
- package/dist/entities/CompetitorProducts.d.ts +22 -0
- package/dist/entities/CompetitorProducts.js +96 -0
- package/dist/entities/Competitors.d.ts +13 -0
- package/dist/entities/Competitors.js +56 -0
- package/dist/entities/Enum/index.d.ts +5 -0
- package/dist/entities/Enum/index.js +21 -0
- package/dist/entities/MerchandiserBrandsMappings.d.ts +14 -0
- package/dist/entities/MerchandiserBrandsMappings.js +68 -0
- package/dist/entities/StoreBrandsMapping.js +1 -1
- package/dist/entities/Stores.d.ts +2 -0
- package/dist/entities/Stores.js +8 -0
- package/dist/entities/Task.d.ts +3 -0
- package/dist/entities/Task.js +10 -0
- package/dist/entities/Users.d.ts +3 -0
- package/dist/entities/Users.js +9 -0
- package/dist/entities/Videos.d.ts +4 -0
- package/dist/entities/Videos.js +10 -0
- package/dist/entities/index.d.ts +5 -0
- package/dist/entities/index.js +13 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/src/constants/index.ts +8 -0
- package/src/constants/status-code.option.ts +26 -24
- package/src/entities/Answers.ts +8 -0
- package/src/entities/BranchManagerBrandsMappings.ts +3 -0
- package/src/entities/BranchManagerMerchandiserMappings.ts +17 -0
- package/src/entities/BrandPromotionSchemes.ts +53 -0
- package/src/entities/Brands.ts +9 -0
- package/src/entities/CompetitorAnalysisRecords.ts +128 -0
- package/src/entities/CompetitorProducts.ts +76 -0
- package/src/entities/Competitors.ts +40 -0
- package/src/entities/Enum/index.ts +5 -0
- package/src/entities/LoginHistory.ts +9 -0
- package/src/entities/MerchandiserBrandsMappings.ts +54 -0
- package/src/entities/OfferLaunch.ts +4 -0
- package/src/entities/POSMRequest.ts +2 -0
- package/src/entities/Question.ts +9 -1
- package/src/entities/SalesPunch.ts +3 -0
- package/src/entities/StockRequest.ts +3 -0
- package/src/entities/StoreBrandsMapping.ts +1 -1
- package/src/entities/Stores.ts +6 -0
- package/src/entities/Task.ts +8 -0
- package/src/entities/UserRoster.ts +2 -0
- package/src/entities/Users.ts +8 -0
- package/src/entities/Videos.ts +11 -0
- package/src/entities/index.ts +70 -61
- package/src/index.ts +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './alert-messages';
|
|
2
|
+
export * from './common.option';
|
|
3
|
+
export * from './context.option';
|
|
4
|
+
export * from './date-time.option';
|
|
5
|
+
export * from './encryption.option';
|
|
6
|
+
export * from './events.option';
|
|
7
|
+
export * from './roles.option';
|
|
8
|
+
export * from './status-code.option';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./alert-messages"), exports);
|
|
18
|
+
__exportStar(require("./common.option"), exports);
|
|
19
|
+
__exportStar(require("./context.option"), exports);
|
|
20
|
+
__exportStar(require("./date-time.option"), exports);
|
|
21
|
+
__exportStar(require("./encryption.option"), exports);
|
|
22
|
+
__exportStar(require("./events.option"), exports);
|
|
23
|
+
__exportStar(require("./roles.option"), exports);
|
|
24
|
+
__exportStar(require("./status-code.option"), exports);
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export declare class StatusCodeUtil {
|
|
2
|
+
/**
|
|
3
|
+
* Get a custom status code based on action type and context.
|
|
4
|
+
* @param action - The action being performed ('create', 'update', 'delete', 'fetch', etc.).
|
|
5
|
+
* @param success - Whether the operation is successful.
|
|
6
|
+
* @param context - Additional context to generate more specific codes (e.g., entity name).
|
|
7
|
+
* @returns The custom status code.
|
|
8
|
+
*/
|
|
2
9
|
static getStatusCode(action: string, success: boolean, context?: string): number;
|
|
10
|
+
/**
|
|
11
|
+
* Generates a context-based offset for finer granularity.
|
|
12
|
+
* @param context - The context (e.g., 'user', 'order').
|
|
13
|
+
* @returns An offset number.
|
|
14
|
+
*/
|
|
3
15
|
private static getContextOffset;
|
|
4
16
|
}
|
|
@@ -2,30 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatusCodeUtil = void 0;
|
|
4
4
|
class StatusCodeUtil {
|
|
5
|
+
/**
|
|
6
|
+
* Get a custom status code based on action type and context.
|
|
7
|
+
* @param action - The action being performed ('create', 'update', 'delete', 'fetch', etc.).
|
|
8
|
+
* @param success - Whether the operation is successful.
|
|
9
|
+
* @param context - Additional context to generate more specific codes (e.g., entity name).
|
|
10
|
+
* @returns The custom status code.
|
|
11
|
+
*/
|
|
5
12
|
static getStatusCode(action, success, context) {
|
|
6
|
-
|
|
13
|
+
// Define base codes for actions
|
|
7
14
|
const baseCodes = {
|
|
8
15
|
create: 20001,
|
|
9
16
|
update: 20002,
|
|
10
17
|
delete: 20003,
|
|
11
18
|
fetch: 20004,
|
|
12
19
|
};
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
// Default base code for unknown actions
|
|
21
|
+
const baseCode = baseCodes[action] || 20000;
|
|
22
|
+
// Calculate the specific offset for the context
|
|
23
|
+
const contextOffset = context ? this.getContextOffset(context) : 0;
|
|
24
|
+
// Add offset for error or success
|
|
25
|
+
const statusCode = success ? baseCode + contextOffset : baseCode + contextOffset + 50000;
|
|
26
|
+
return statusCode;
|
|
20
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Generates a context-based offset for finer granularity.
|
|
30
|
+
* @param context - The context (e.g., 'user', 'order').
|
|
31
|
+
* @returns An offset number.
|
|
32
|
+
*/
|
|
21
33
|
static getContextOffset(context) {
|
|
22
|
-
var _a;
|
|
23
34
|
const contextOffsets = {
|
|
24
|
-
user: 10,
|
|
25
|
-
order: 20,
|
|
26
|
-
product: 30,
|
|
35
|
+
user: 10, // Example: Add 10 for user-related actions
|
|
36
|
+
order: 20, // Example: Add 20 for order-related actions
|
|
37
|
+
product: 30, // Example: Add 30 for product-related actions
|
|
27
38
|
};
|
|
28
|
-
|
|
39
|
+
// Default to 0 if the context is not predefined
|
|
40
|
+
return contextOffsets[context.toLowerCase()] || 0;
|
|
29
41
|
}
|
|
30
42
|
}
|
|
31
43
|
exports.StatusCodeUtil = StatusCodeUtil;
|
|
@@ -24,6 +24,10 @@ __decorate([
|
|
|
24
24
|
(0, typeorm_1.Column)('tinyint', { name: 'status', nullable: true, default: 0 }),
|
|
25
25
|
__metadata("design:type", Number)
|
|
26
26
|
], BranchManagerBrandsMappings.prototype, "status", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)('tinyint', { name: 'is_primary', nullable: false, default: 0 }),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], BranchManagerBrandsMappings.prototype, "isPrimary", void 0);
|
|
27
31
|
__decorate([
|
|
28
32
|
(0, typeorm_1.CreateDateColumn)({ type: 'datetime' }),
|
|
29
33
|
__metadata("design:type", Date)
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { BaseEntity } from 'typeorm';
|
|
2
2
|
import { Users } from './Users';
|
|
3
|
+
import { Brands } from './Brands';
|
|
3
4
|
export declare class BranchManagerMerchandiserMappings extends BaseEntity {
|
|
4
5
|
id: string;
|
|
5
6
|
branchManagerId: string;
|
|
6
7
|
merchandiserId: string;
|
|
8
|
+
brandId?: string;
|
|
9
|
+
isPrimary?: number;
|
|
7
10
|
status?: number;
|
|
8
11
|
created_at: Date;
|
|
9
12
|
updated_at: Date;
|
|
10
13
|
merchandiser: Users;
|
|
11
14
|
branchManager: Users;
|
|
15
|
+
brand?: Brands;
|
|
12
16
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BranchManagerMerchandiserMappings = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const Users_1 = require("./Users");
|
|
15
|
+
const Brands_1 = require("./Brands");
|
|
15
16
|
let BranchManagerMerchandiserMappings = class BranchManagerMerchandiserMappings extends typeorm_1.BaseEntity {
|
|
16
17
|
};
|
|
17
18
|
exports.BranchManagerMerchandiserMappings = BranchManagerMerchandiserMappings;
|
|
@@ -27,6 +28,14 @@ __decorate([
|
|
|
27
28
|
(0, typeorm_1.Column)('bigint', { name: 'merchandiser_id', nullable: false }),
|
|
28
29
|
__metadata("design:type", String)
|
|
29
30
|
], BranchManagerMerchandiserMappings.prototype, "merchandiserId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)('bigint', { name: 'brand_id', nullable: true }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], BranchManagerMerchandiserMappings.prototype, "brandId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)('tinyint', { name: 'is_primary', nullable: true, default: 1 }),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], BranchManagerMerchandiserMappings.prototype, "isPrimary", void 0);
|
|
30
39
|
__decorate([
|
|
31
40
|
(0, typeorm_1.Column)('tinyint', { name: 'status', nullable: true, default: 0 }),
|
|
32
41
|
__metadata("design:type", Number)
|
|
@@ -55,6 +64,14 @@ __decorate([
|
|
|
55
64
|
(0, typeorm_1.JoinColumn)([{ name: 'branch_manager_id', referencedColumnName: 'id' }]),
|
|
56
65
|
__metadata("design:type", Users_1.Users)
|
|
57
66
|
], BranchManagerMerchandiserMappings.prototype, "branchManager", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typeorm_1.ManyToOne)(() => Brands_1.Brands, {
|
|
69
|
+
onDelete: 'NO ACTION',
|
|
70
|
+
onUpdate: 'NO ACTION',
|
|
71
|
+
}),
|
|
72
|
+
(0, typeorm_1.JoinColumn)([{ name: 'brand_id', referencedColumnName: 'id' }]),
|
|
73
|
+
__metadata("design:type", Brands_1.Brands)
|
|
74
|
+
], BranchManagerMerchandiserMappings.prototype, "brand", void 0);
|
|
58
75
|
exports.BranchManagerMerchandiserMappings = BranchManagerMerchandiserMappings = __decorate([
|
|
59
76
|
(0, typeorm_1.Index)('branch_manager_merchandiser_ibfk_1', ['merchandiserId'], {}),
|
|
60
77
|
(0, typeorm_1.Index)('branch_manager_merchandiser_ibfk_2', ['branchManagerId'], {}),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseEntity } from 'typeorm';
|
|
2
|
+
import { Brands } from './Brands';
|
|
3
|
+
export declare class BrandPromotionSchemes extends BaseEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
type: string;
|
|
6
|
+
name: string;
|
|
7
|
+
thumbnail: string;
|
|
8
|
+
url: string;
|
|
9
|
+
status: number;
|
|
10
|
+
start_date: Date;
|
|
11
|
+
end_date: Date;
|
|
12
|
+
created_at: Date;
|
|
13
|
+
updated_at: Date;
|
|
14
|
+
brand: Brands;
|
|
15
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.BrandPromotionSchemes = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Brands_1 = require("./Brands");
|
|
15
|
+
let BrandPromotionSchemes = class BrandPromotionSchemes extends typeorm_1.BaseEntity {
|
|
16
|
+
};
|
|
17
|
+
exports.BrandPromotionSchemes = BrandPromotionSchemes;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('increment', { type: 'bigint' }),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], BrandPromotionSchemes.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], BrandPromotionSchemes.prototype, "type", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], BrandPromotionSchemes.prototype, "name", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], BrandPromotionSchemes.prototype, "thumbnail", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], BrandPromotionSchemes.prototype, "url", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)({ type: 'tinyint', nullable: true }),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], BrandPromotionSchemes.prototype, "status", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'datetime', nullable: false }),
|
|
44
|
+
__metadata("design:type", Date)
|
|
45
|
+
], BrandPromotionSchemes.prototype, "start_date", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ type: 'datetime', nullable: false }),
|
|
48
|
+
__metadata("design:type", Date)
|
|
49
|
+
], BrandPromotionSchemes.prototype, "end_date", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
|
|
52
|
+
__metadata("design:type", Date)
|
|
53
|
+
], BrandPromotionSchemes.prototype, "created_at", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], BrandPromotionSchemes.prototype, "updated_at", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.ManyToOne)(() => Brands_1.Brands, (brand) => brand.brandPromotionscheme),
|
|
60
|
+
(0, typeorm_1.JoinColumn)({ name: 'brand_id' }),
|
|
61
|
+
__metadata("design:type", Brands_1.Brands)
|
|
62
|
+
], BrandPromotionSchemes.prototype, "brand", void 0);
|
|
63
|
+
exports.BrandPromotionSchemes = BrandPromotionSchemes = __decorate([
|
|
64
|
+
(0, typeorm_1.Entity)('brand_promotion_schemes')
|
|
65
|
+
], BrandPromotionSchemes);
|
|
@@ -7,6 +7,8 @@ import { LeaveTypes } from './LeaveTypes';
|
|
|
7
7
|
import { Users } from './Users';
|
|
8
8
|
import { StoreBrandsMappings } from './StoreBrandsMapping';
|
|
9
9
|
import { BeatPlanVisits } from './BeatPlanVisits';
|
|
10
|
+
import { MerchandiserBrandsMappings } from './MerchandiserBrandsMappings';
|
|
11
|
+
import { BrandPromotionSchemes } from './BrandPromotionSchemes';
|
|
10
12
|
export declare class Brands extends BaseEntity {
|
|
11
13
|
id: string;
|
|
12
14
|
name: string | null;
|
|
@@ -22,4 +24,6 @@ export declare class Brands extends BaseEntity {
|
|
|
22
24
|
leaveTypes?: LeaveTypes[];
|
|
23
25
|
user?: Users[];
|
|
24
26
|
visits: BeatPlanVisits[];
|
|
27
|
+
merchandiserBrandsMappings?: MerchandiserBrandsMappings[];
|
|
28
|
+
brandPromotionscheme: BrandPromotionSchemes[];
|
|
25
29
|
}
|
package/dist/entities/Brands.js
CHANGED
|
@@ -19,6 +19,8 @@ const LeaveTypes_1 = require("./LeaveTypes");
|
|
|
19
19
|
const Users_1 = require("./Users");
|
|
20
20
|
const StoreBrandsMapping_1 = require("./StoreBrandsMapping");
|
|
21
21
|
const BeatPlanVisits_1 = require("./BeatPlanVisits");
|
|
22
|
+
const MerchandiserBrandsMappings_1 = require("./MerchandiserBrandsMappings");
|
|
23
|
+
const BrandPromotionSchemes_1 = require("./BrandPromotionSchemes");
|
|
22
24
|
let Brands = class Brands extends typeorm_1.BaseEntity {
|
|
23
25
|
};
|
|
24
26
|
exports.Brands = Brands;
|
|
@@ -83,6 +85,14 @@ __decorate([
|
|
|
83
85
|
(0, typeorm_1.OneToMany)(() => BeatPlanVisits_1.BeatPlanVisits, (visit) => visit.brand),
|
|
84
86
|
__metadata("design:type", Array)
|
|
85
87
|
], Brands.prototype, "visits", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.OneToMany)(() => MerchandiserBrandsMappings_1.MerchandiserBrandsMappings, (mapping) => mapping.brand),
|
|
90
|
+
__metadata("design:type", Array)
|
|
91
|
+
], Brands.prototype, "merchandiserBrandsMappings", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.OneToMany)(() => BrandPromotionSchemes_1.BrandPromotionSchemes, (promotion) => promotion.brand),
|
|
94
|
+
__metadata("design:type", Array)
|
|
95
|
+
], Brands.prototype, "brandPromotionscheme", void 0);
|
|
86
96
|
exports.Brands = Brands = __decorate([
|
|
87
97
|
(0, typeorm_1.Index)('code', ['code'], { unique: true })
|
|
88
98
|
// @Index("IDX_1687d82f42d8b3f8162a29e7df", ["code"], { unique: true })
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseEntity } from 'typeorm';
|
|
2
|
+
import { Stores } from './Stores';
|
|
3
|
+
import { Brands } from './Brands';
|
|
4
|
+
import { Users } from './Users';
|
|
5
|
+
import { CompetitorProducts } from './CompetitorProducts';
|
|
6
|
+
import { Product } from './Products';
|
|
7
|
+
import { Attachement } from './Attachments';
|
|
8
|
+
export declare class CompetitorAnalysisRecords extends BaseEntity {
|
|
9
|
+
id: string;
|
|
10
|
+
storeId: string;
|
|
11
|
+
brandId: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
competitorProductId?: string;
|
|
14
|
+
ourProductId?: string;
|
|
15
|
+
ourPrice?: number;
|
|
16
|
+
competitorPrice?: number;
|
|
17
|
+
shelfPosition?: string;
|
|
18
|
+
marketShareEstimate?: number;
|
|
19
|
+
ourStockLevel?: number;
|
|
20
|
+
competitorStockLevel?: number;
|
|
21
|
+
promotionType?: string;
|
|
22
|
+
promotionDetails?: string;
|
|
23
|
+
notes?: string;
|
|
24
|
+
attachmentId?: string;
|
|
25
|
+
analysisDate?: Date;
|
|
26
|
+
status?: number;
|
|
27
|
+
created_at: Date;
|
|
28
|
+
updated_at: Date;
|
|
29
|
+
store: Stores;
|
|
30
|
+
brand: Brands;
|
|
31
|
+
user: Users;
|
|
32
|
+
competitorProduct?: CompetitorProducts;
|
|
33
|
+
ourProduct?: Product;
|
|
34
|
+
attachment?: Attachement;
|
|
35
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
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.CompetitorAnalysisRecords = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Stores_1 = require("./Stores");
|
|
15
|
+
const Brands_1 = require("./Brands");
|
|
16
|
+
const Users_1 = require("./Users");
|
|
17
|
+
const CompetitorProducts_1 = require("./CompetitorProducts");
|
|
18
|
+
const Products_1 = require("./Products");
|
|
19
|
+
const Attachments_1 = require("./Attachments");
|
|
20
|
+
let CompetitorAnalysisRecords = class CompetitorAnalysisRecords extends typeorm_1.BaseEntity {
|
|
21
|
+
};
|
|
22
|
+
exports.CompetitorAnalysisRecords = CompetitorAnalysisRecords;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: 'bigint', name: 'id' }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], CompetitorAnalysisRecords.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)('bigint', { name: 'store_id', nullable: false }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], CompetitorAnalysisRecords.prototype, "storeId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)('bigint', { name: 'brand_id', nullable: false }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CompetitorAnalysisRecords.prototype, "brandId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)('bigint', { name: 'user_id', nullable: false }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], CompetitorAnalysisRecords.prototype, "userId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)('bigint', { name: 'competitor_product_id', nullable: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], CompetitorAnalysisRecords.prototype, "competitorProductId", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)('bigint', { name: 'our_product_id', nullable: true }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], CompetitorAnalysisRecords.prototype, "ourProductId", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)('decimal', { name: 'our_price', nullable: true, precision: 10, scale: 2 }),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], CompetitorAnalysisRecords.prototype, "ourPrice", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)('decimal', { name: 'competitor_price', nullable: true, precision: 10, scale: 2 }),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], CompetitorAnalysisRecords.prototype, "competitorPrice", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)('varchar', { name: 'shelf_position', nullable: true, length: 100 }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], CompetitorAnalysisRecords.prototype, "shelfPosition", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)('decimal', { name: 'market_share_estimate', nullable: true, precision: 5, scale: 2 }),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], CompetitorAnalysisRecords.prototype, "marketShareEstimate", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typeorm_1.Column)('int', { name: 'our_stock_level', nullable: true }),
|
|
65
|
+
__metadata("design:type", Number)
|
|
66
|
+
], CompetitorAnalysisRecords.prototype, "ourStockLevel", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typeorm_1.Column)('int', { name: 'competitor_stock_level', nullable: true }),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], CompetitorAnalysisRecords.prototype, "competitorStockLevel", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typeorm_1.Column)('varchar', { name: 'promotion_type', nullable: true, length: 100 }),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], CompetitorAnalysisRecords.prototype, "promotionType", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typeorm_1.Column)('text', { name: 'promotion_details', nullable: true }),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], CompetitorAnalysisRecords.prototype, "promotionDetails", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.Column)('text', { name: 'notes', nullable: true }),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], CompetitorAnalysisRecords.prototype, "notes", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.Column)('bigint', { name: 'attachment_id', nullable: true }),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], CompetitorAnalysisRecords.prototype, "attachmentId", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typeorm_1.Column)('date', { name: 'analysis_date', nullable: true }),
|
|
89
|
+
__metadata("design:type", Date)
|
|
90
|
+
], CompetitorAnalysisRecords.prototype, "analysisDate", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typeorm_1.Column)('tinyint', { name: 'status', nullable: true, default: 1 }),
|
|
93
|
+
__metadata("design:type", Number)
|
|
94
|
+
], CompetitorAnalysisRecords.prototype, "status", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'datetime' }),
|
|
97
|
+
__metadata("design:type", Date)
|
|
98
|
+
], CompetitorAnalysisRecords.prototype, "created_at", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'datetime' }),
|
|
101
|
+
__metadata("design:type", Date)
|
|
102
|
+
], CompetitorAnalysisRecords.prototype, "updated_at", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.ManyToOne)(() => Stores_1.Stores, {
|
|
105
|
+
onDelete: 'CASCADE',
|
|
106
|
+
onUpdate: 'NO ACTION',
|
|
107
|
+
}),
|
|
108
|
+
(0, typeorm_1.JoinColumn)([{ name: 'store_id', referencedColumnName: 'id' }]),
|
|
109
|
+
__metadata("design:type", Stores_1.Stores)
|
|
110
|
+
], CompetitorAnalysisRecords.prototype, "store", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typeorm_1.ManyToOne)(() => Brands_1.Brands, {
|
|
113
|
+
onDelete: 'CASCADE',
|
|
114
|
+
onUpdate: 'NO ACTION',
|
|
115
|
+
}),
|
|
116
|
+
(0, typeorm_1.JoinColumn)([{ name: 'brand_id', referencedColumnName: 'id' }]),
|
|
117
|
+
__metadata("design:type", Brands_1.Brands)
|
|
118
|
+
], CompetitorAnalysisRecords.prototype, "brand", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, typeorm_1.ManyToOne)(() => Users_1.Users, {
|
|
121
|
+
onDelete: 'CASCADE',
|
|
122
|
+
onUpdate: 'NO ACTION',
|
|
123
|
+
}),
|
|
124
|
+
(0, typeorm_1.JoinColumn)([{ name: 'user_id', referencedColumnName: 'id' }]),
|
|
125
|
+
__metadata("design:type", Users_1.Users)
|
|
126
|
+
], CompetitorAnalysisRecords.prototype, "user", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typeorm_1.ManyToOne)(() => CompetitorProducts_1.CompetitorProducts, (product) => product.analysisRecords, {
|
|
129
|
+
onDelete: 'SET NULL',
|
|
130
|
+
onUpdate: 'NO ACTION',
|
|
131
|
+
}),
|
|
132
|
+
(0, typeorm_1.JoinColumn)([{ name: 'competitor_product_id', referencedColumnName: 'id' }]),
|
|
133
|
+
__metadata("design:type", CompetitorProducts_1.CompetitorProducts)
|
|
134
|
+
], CompetitorAnalysisRecords.prototype, "competitorProduct", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.ManyToOne)(() => Products_1.Product, {
|
|
137
|
+
onDelete: 'SET NULL',
|
|
138
|
+
onUpdate: 'NO ACTION',
|
|
139
|
+
}),
|
|
140
|
+
(0, typeorm_1.JoinColumn)([{ name: 'our_product_id', referencedColumnName: 'id' }]),
|
|
141
|
+
__metadata("design:type", Products_1.Product)
|
|
142
|
+
], CompetitorAnalysisRecords.prototype, "ourProduct", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, typeorm_1.ManyToOne)(() => Attachments_1.Attachement, {
|
|
145
|
+
onDelete: 'SET NULL',
|
|
146
|
+
onUpdate: 'NO ACTION',
|
|
147
|
+
}),
|
|
148
|
+
(0, typeorm_1.JoinColumn)([{ name: 'attachment_id', referencedColumnName: 'id' }]),
|
|
149
|
+
__metadata("design:type", Attachments_1.Attachement)
|
|
150
|
+
], CompetitorAnalysisRecords.prototype, "attachment", void 0);
|
|
151
|
+
exports.CompetitorAnalysisRecords = CompetitorAnalysisRecords = __decorate([
|
|
152
|
+
(0, typeorm_1.Index)('competitor_analysis_ibfk_1', ['storeId'], {}),
|
|
153
|
+
(0, typeorm_1.Index)('competitor_analysis_ibfk_2', ['brandId'], {}),
|
|
154
|
+
(0, typeorm_1.Index)('competitor_analysis_ibfk_3', ['userId'], {}),
|
|
155
|
+
(0, typeorm_1.Index)('competitor_analysis_ibfk_4', ['competitorProductId'], {}),
|
|
156
|
+
(0, typeorm_1.Index)('competitor_analysis_ibfk_5', ['ourProductId'], {}),
|
|
157
|
+
(0, typeorm_1.Index)('idx_analysis_date', ['analysisDate'], {}),
|
|
158
|
+
(0, typeorm_1.Entity)('competitor_analysis_records')
|
|
159
|
+
], CompetitorAnalysisRecords);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseEntity } from 'typeorm';
|
|
2
|
+
import { Competitors } from './Competitors';
|
|
3
|
+
import { Catagory } from './Category';
|
|
4
|
+
import { CompetitorAnalysisRecords } from './CompetitorAnalysisRecords';
|
|
5
|
+
export declare class CompetitorProducts extends BaseEntity {
|
|
6
|
+
id: string;
|
|
7
|
+
competitorId: string;
|
|
8
|
+
categoryId?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
sku?: string;
|
|
11
|
+
price?: number;
|
|
12
|
+
mrp?: number;
|
|
13
|
+
image?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
packSize?: string;
|
|
16
|
+
status?: number;
|
|
17
|
+
created_at: Date;
|
|
18
|
+
updated_at: Date;
|
|
19
|
+
competitor: Competitors;
|
|
20
|
+
category?: Catagory;
|
|
21
|
+
analysisRecords?: CompetitorAnalysisRecords[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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.CompetitorProducts = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Competitors_1 = require("./Competitors");
|
|
15
|
+
const Category_1 = require("./Category");
|
|
16
|
+
const CompetitorAnalysisRecords_1 = require("./CompetitorAnalysisRecords");
|
|
17
|
+
let CompetitorProducts = class CompetitorProducts extends typeorm_1.BaseEntity {
|
|
18
|
+
};
|
|
19
|
+
exports.CompetitorProducts = CompetitorProducts;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: 'bigint', name: 'id' }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], CompetitorProducts.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)('bigint', { name: 'competitor_id', nullable: false }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], CompetitorProducts.prototype, "competitorId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)('bigint', { name: 'category_id', nullable: true }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], CompetitorProducts.prototype, "categoryId", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)('varchar', { name: 'name', nullable: false, length: 255 }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], CompetitorProducts.prototype, "name", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)('varchar', { name: 'sku', nullable: true, length: 255 }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], CompetitorProducts.prototype, "sku", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)('decimal', { name: 'price', nullable: true, precision: 10, scale: 2 }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], CompetitorProducts.prototype, "price", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)('decimal', { name: 'mrp', nullable: true, precision: 10, scale: 2 }),
|
|
46
|
+
__metadata("design:type", Number)
|
|
47
|
+
], CompetitorProducts.prototype, "mrp", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)('varchar', { name: 'image', nullable: true, length: 500 }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], CompetitorProducts.prototype, "image", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)('text', { name: 'description', nullable: true }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], CompetitorProducts.prototype, "description", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)('varchar', { name: 'pack_size', nullable: true, length: 100 }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], CompetitorProducts.prototype, "packSize", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)('tinyint', { name: 'status', nullable: true, default: 1 }),
|
|
62
|
+
__metadata("design:type", Number)
|
|
63
|
+
], CompetitorProducts.prototype, "status", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'datetime' }),
|
|
66
|
+
__metadata("design:type", Date)
|
|
67
|
+
], CompetitorProducts.prototype, "created_at", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'datetime' }),
|
|
70
|
+
__metadata("design:type", Date)
|
|
71
|
+
], CompetitorProducts.prototype, "updated_at", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.ManyToOne)(() => Competitors_1.Competitors, (competitor) => competitor.products, {
|
|
74
|
+
onDelete: 'CASCADE',
|
|
75
|
+
onUpdate: 'NO ACTION',
|
|
76
|
+
}),
|
|
77
|
+
(0, typeorm_1.JoinColumn)([{ name: 'competitor_id', referencedColumnName: 'id' }]),
|
|
78
|
+
__metadata("design:type", Competitors_1.Competitors)
|
|
79
|
+
], CompetitorProducts.prototype, "competitor", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, typeorm_1.ManyToOne)(() => Category_1.Catagory, {
|
|
82
|
+
onDelete: 'SET NULL',
|
|
83
|
+
onUpdate: 'NO ACTION',
|
|
84
|
+
}),
|
|
85
|
+
(0, typeorm_1.JoinColumn)([{ name: 'category_id', referencedColumnName: 'id' }]),
|
|
86
|
+
__metadata("design:type", Category_1.Catagory)
|
|
87
|
+
], CompetitorProducts.prototype, "category", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.OneToMany)(() => CompetitorAnalysisRecords_1.CompetitorAnalysisRecords, (record) => record.competitorProduct),
|
|
90
|
+
__metadata("design:type", Array)
|
|
91
|
+
], CompetitorProducts.prototype, "analysisRecords", void 0);
|
|
92
|
+
exports.CompetitorProducts = CompetitorProducts = __decorate([
|
|
93
|
+
(0, typeorm_1.Index)('competitor_products_ibfk_1', ['competitorId'], {}),
|
|
94
|
+
(0, typeorm_1.Index)('competitor_products_ibfk_2', ['categoryId'], {}),
|
|
95
|
+
(0, typeorm_1.Entity)('competitor_products')
|
|
96
|
+
], CompetitorProducts);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEntity } from 'typeorm';
|
|
2
|
+
import { CompetitorProducts } from './CompetitorProducts';
|
|
3
|
+
export declare class Competitors extends BaseEntity {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
logo?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
website?: string;
|
|
9
|
+
status?: number;
|
|
10
|
+
created_at: Date;
|
|
11
|
+
updated_at: Date;
|
|
12
|
+
products?: CompetitorProducts[];
|
|
13
|
+
}
|