@ashutoshvohra136/tenant-db-contract 1.0.7 → 1.0.10

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.
@@ -9,6 +9,7 @@ import { StoreBrandsMappings } from './StoreBrandsMapping';
9
9
  import { BeatPlanVisits } from './BeatPlanVisits';
10
10
  import { MerchandiserBrandsMappings } from './MerchandiserBrandsMappings';
11
11
  import { BrandPromotionSchemes } from './BrandPromotionSchemes';
12
+ import { NotificationBrandMapping } from './NotificationBrandMapping';
12
13
  export declare class Brands extends BaseEntity {
13
14
  id: string;
14
15
  name: string | null;
@@ -26,4 +27,5 @@ export declare class Brands extends BaseEntity {
26
27
  visits: BeatPlanVisits[];
27
28
  merchandiserBrandsMappings?: MerchandiserBrandsMappings[];
28
29
  brandPromotionscheme: BrandPromotionSchemes[];
30
+ notificationBrandMappings?: NotificationBrandMapping[];
29
31
  }
@@ -21,6 +21,7 @@ const StoreBrandsMapping_1 = require("./StoreBrandsMapping");
21
21
  const BeatPlanVisits_1 = require("./BeatPlanVisits");
22
22
  const MerchandiserBrandsMappings_1 = require("./MerchandiserBrandsMappings");
23
23
  const BrandPromotionSchemes_1 = require("./BrandPromotionSchemes");
24
+ const NotificationBrandMapping_1 = require("./NotificationBrandMapping");
24
25
  let Brands = class Brands extends typeorm_1.BaseEntity {
25
26
  };
26
27
  exports.Brands = Brands;
@@ -93,6 +94,10 @@ __decorate([
93
94
  (0, typeorm_1.OneToMany)(() => BrandPromotionSchemes_1.BrandPromotionSchemes, (promotion) => promotion.brand),
94
95
  __metadata("design:type", Array)
95
96
  ], Brands.prototype, "brandPromotionscheme", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.OneToMany)(() => NotificationBrandMapping_1.NotificationBrandMapping, (mapping) => mapping.brand),
99
+ __metadata("design:type", Array)
100
+ ], Brands.prototype, "notificationBrandMappings", void 0);
96
101
  exports.Brands = Brands = __decorate([
97
102
  (0, typeorm_1.Index)('code', ['code'], { unique: true })
98
103
  // @Index("IDX_1687d82f42d8b3f8162a29e7df", ["code"], { unique: true })
@@ -47,7 +47,7 @@ __decorate([
47
47
  __decorate([
48
48
  (0, typeorm_1.ManyToOne)(() => Users_1.Users, (users) => users.merchandiserBrandsMappings, {
49
49
  onDelete: 'CASCADE',
50
- onUpdate: 'NO ACTION'
50
+ onUpdate: 'NO ACTION',
51
51
  }),
52
52
  (0, typeorm_1.JoinColumn)([{ name: 'merchandiser_id', referencedColumnName: 'id' }]),
53
53
  __metadata("design:type", Users_1.Users)
@@ -0,0 +1,16 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ import { Notification } from './Notifications';
3
+ import { Brands } from './Brands';
4
+ import { Roles } from './Roles';
5
+ export declare class NotificationBrandMapping extends BaseEntity {
6
+ id: string;
7
+ notificationId: string;
8
+ brandId: string;
9
+ roleId?: string;
10
+ status?: number;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ notification: Notification;
14
+ brand: Brands;
15
+ role: Roles;
16
+ }
@@ -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.NotificationBrandMapping = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Notifications_1 = require("./Notifications");
15
+ const Brands_1 = require("./Brands");
16
+ const Roles_1 = require("./Roles");
17
+ let NotificationBrandMapping = class NotificationBrandMapping extends typeorm_1.BaseEntity {
18
+ };
19
+ exports.NotificationBrandMapping = NotificationBrandMapping;
20
+ __decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: 'bigint', name: 'id' }),
22
+ __metadata("design:type", String)
23
+ ], NotificationBrandMapping.prototype, "id", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)('bigint', { name: 'notification_id', nullable: false }),
26
+ __metadata("design:type", String)
27
+ ], NotificationBrandMapping.prototype, "notificationId", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)('bigint', { name: 'brand_id', nullable: false }),
30
+ __metadata("design:type", String)
31
+ ], NotificationBrandMapping.prototype, "brandId", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)('bigint', { name: 'role_id', nullable: true }),
34
+ __metadata("design:type", String)
35
+ ], NotificationBrandMapping.prototype, "roleId", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)('tinyint', { name: 'status', nullable: true, default: 1 }),
38
+ __metadata("design:type", Number)
39
+ ], NotificationBrandMapping.prototype, "status", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.CreateDateColumn)({ type: 'datetime', name: 'created_at' }),
42
+ __metadata("design:type", Date)
43
+ ], NotificationBrandMapping.prototype, "createdAt", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.UpdateDateColumn)({ type: 'datetime', name: 'updated_at' }),
46
+ __metadata("design:type", Date)
47
+ ], NotificationBrandMapping.prototype, "updatedAt", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.ManyToOne)(() => Notifications_1.Notification, (notification) => notification.notificationBrandMappings, {
50
+ onDelete: 'CASCADE',
51
+ onUpdate: 'NO ACTION',
52
+ }),
53
+ (0, typeorm_1.JoinColumn)([{ name: 'notification_id', referencedColumnName: 'id' }]),
54
+ __metadata("design:type", Notifications_1.Notification)
55
+ ], NotificationBrandMapping.prototype, "notification", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.ManyToOne)(() => Brands_1.Brands, (brands) => brands.notificationBrandMappings, {
58
+ onDelete: 'CASCADE',
59
+ onUpdate: 'NO ACTION',
60
+ }),
61
+ (0, typeorm_1.JoinColumn)([{ name: 'brand_id', referencedColumnName: 'id' }]),
62
+ __metadata("design:type", Brands_1.Brands)
63
+ ], NotificationBrandMapping.prototype, "brand", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.ManyToOne)(() => Roles_1.Roles, (roles) => roles.notificationBrandMappings, {
66
+ onDelete: 'CASCADE',
67
+ onUpdate: 'NO ACTION',
68
+ }),
69
+ (0, typeorm_1.JoinColumn)([{ name: 'role_id', referencedColumnName: 'id' }]),
70
+ __metadata("design:type", Roles_1.Roles)
71
+ ], NotificationBrandMapping.prototype, "role", void 0);
72
+ exports.NotificationBrandMapping = NotificationBrandMapping = __decorate([
73
+ (0, typeorm_1.Index)('notification_id', ['notificationId'], {}),
74
+ (0, typeorm_1.Index)('brand_id', ['brandId'], {}),
75
+ (0, typeorm_1.Index)('role_id', ['roleId'], {}),
76
+ (0, typeorm_1.Entity)('notification_brand_mapping')
77
+ ], NotificationBrandMapping);
@@ -2,6 +2,7 @@ import { BaseEntity } from 'typeorm';
2
2
  import { Users } from './Users';
3
3
  import { NotificationUserHistory } from './notification-user-history.entity';
4
4
  import { Roles } from './Roles';
5
+ import { NotificationBrandMapping } from './NotificationBrandMapping';
5
6
  export declare class Notification extends BaseEntity {
6
7
  id: bigint;
7
8
  user: Users;
@@ -10,9 +11,10 @@ export declare class Notification extends BaseEntity {
10
11
  title: string;
11
12
  content: string;
12
13
  type: string;
13
- role: Roles;
14
+ role?: Roles;
14
15
  status?: number;
15
16
  notification_user_history?: NotificationUserHistory;
16
17
  created_at: Date;
17
18
  updated_at: Date;
19
+ notificationBrandMappings?: NotificationBrandMapping[];
18
20
  }
@@ -14,6 +14,7 @@ const typeorm_1 = require("typeorm");
14
14
  const Users_1 = require("./Users");
15
15
  const notification_user_history_entity_1 = require("./notification-user-history.entity");
16
16
  const Roles_1 = require("./Roles");
17
+ const NotificationBrandMapping_1 = require("./NotificationBrandMapping");
17
18
  // import { Roles } from './Roles';
18
19
  let Notification = class Notification extends typeorm_1.BaseEntity {
19
20
  };
@@ -48,7 +49,7 @@ __decorate([
48
49
  __metadata("design:type", String)
49
50
  ], Notification.prototype, "type", void 0);
50
51
  __decorate([
51
- (0, typeorm_1.ManyToOne)(() => Roles_1.Roles, (role) => role.scheme),
52
+ (0, typeorm_1.ManyToOne)(() => Roles_1.Roles, (role) => role.notification),
52
53
  (0, typeorm_1.JoinColumn)({ name: 'role_id' }),
53
54
  __metadata("design:type", Roles_1.Roles)
54
55
  ], Notification.prototype, "role", void 0);
@@ -68,6 +69,10 @@ __decorate([
68
69
  (0, typeorm_1.UpdateDateColumn)({ type: 'datetime' }),
69
70
  __metadata("design:type", Date)
70
71
  ], Notification.prototype, "updated_at", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.OneToMany)(() => NotificationBrandMapping_1.NotificationBrandMapping, (notificationBrandMapping) => notificationBrandMapping.notification),
74
+ __metadata("design:type", Array)
75
+ ], Notification.prototype, "notificationBrandMappings", void 0);
71
76
  exports.Notification = Notification = __decorate([
72
77
  (0, typeorm_1.Entity)({ name: 'notifications' })
73
78
  ], Notification);
@@ -2,6 +2,7 @@ import { BaseEntity } from 'typeorm';
2
2
  import { Users } from './Users';
3
3
  import { Notification } from './Notifications';
4
4
  import { Schemes } from './Schemes';
5
+ import { NotificationBrandMapping } from './NotificationBrandMapping';
5
6
  export declare class Roles extends BaseEntity {
6
7
  id: string;
7
8
  name: string;
@@ -10,4 +11,5 @@ export declare class Roles extends BaseEntity {
10
11
  users?: Users[];
11
12
  notification: Notification;
12
13
  scheme?: Schemes[];
14
+ notificationBrandMappings?: NotificationBrandMapping[];
13
15
  }
@@ -14,6 +14,7 @@ const typeorm_1 = require("typeorm");
14
14
  const Users_1 = require("./Users");
15
15
  const Notifications_1 = require("./Notifications");
16
16
  const Schemes_1 = require("./Schemes");
17
+ const NotificationBrandMapping_1 = require("./NotificationBrandMapping");
17
18
  let Roles = class Roles extends typeorm_1.BaseEntity {
18
19
  };
19
20
  exports.Roles = Roles;
@@ -45,6 +46,10 @@ __decorate([
45
46
  (0, typeorm_1.OneToMany)(() => Schemes_1.Schemes, (scheme) => scheme.role),
46
47
  __metadata("design:type", Array)
47
48
  ], Roles.prototype, "scheme", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.OneToMany)(() => NotificationBrandMapping_1.NotificationBrandMapping, (mapping) => mapping.role),
51
+ __metadata("design:type", Array)
52
+ ], Roles.prototype, "notificationBrandMappings", void 0);
48
53
  exports.Roles = Roles = __decorate([
49
54
  (0, typeorm_1.Entity)('roles')
50
55
  ], Roles);
@@ -64,3 +64,9 @@ export { Competitors } from './Competitors';
64
64
  export { CompetitorProducts } from './CompetitorProducts';
65
65
  export { CompetitorAnalysisRecords } from './CompetitorAnalysisRecords';
66
66
  export { BrandPromotionSchemes } from './BrandPromotionSchemes';
67
+ export { NotificationBrandMapping } from './NotificationBrandMapping';
68
+ export { UserRoles, UserRoleId } from './Enum/UserRole';
69
+ export { Months } from './Enum/Months';
70
+ export { ImageTypeEnums } from './Enum/ImageType';
71
+ export { LogType, BeatPlanLogType } from './Enum/LogType';
72
+ export { UserAssignedRosterStatus } from './Enum/UserRosterAssignStatus';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserRosters = exports.UsersQuestionsAttemptsHistory = exports.UserDetails = exports.UploadedImages = exports.TermsAndCondition = exports.TaskAttachment = exports.Task = exports.Target = exports.Stores = exports.StoreBrandsMappings = exports.StockRequestDetails = exports.StockRequest = exports.StoreShifts = exports.Shifts = exports.Schemes = exports.SalesPunchingAiAnalysis = exports.SalesPunching = exports.Roles = exports.Questions = exports.Product = exports.POSMRequestDetails = exports.POSMRequest = exports.POSMMaterials = exports.PasswordManager = exports.OutOfRange = exports.OfferLaunch = exports.Offers = exports.Notification = exports.NotificationUserHistory = exports.LoginHistory = exports.LeaveTypes = exports.LeaveRequests = exports.InventoryDetails = exports.Inventory = exports.FCM = exports.DamagedProductsRequestDetails = exports.DamagedProductsRequest = exports.Catagory = exports.BrandWiseCategory = exports.Brands = exports.BranchManagerMerchandiserMappings = exports.BranchManagerBrandsMappings = exports.BeatPlanVisits = exports.BeatPlanCheckins = exports.AttendanceDetails = exports.Attachement = exports.Answers = exports.Analysis = exports.AlertMessages = exports.AchievementHistory = void 0;
4
- exports.BrandPromotionSchemes = exports.CompetitorAnalysisRecords = exports.CompetitorProducts = exports.Competitors = exports.MerchandiserBrandsMappings = exports.PermissionPolicy = exports.UserLocations = exports.APIResponse = exports.AutomationExecutions = exports.Automations = exports.Users = exports.Videos = exports.Version = exports.UsersVideosAttemptsHistory = exports.UserStoreChangeHistory = exports.UsersRosterChangeLogs = void 0;
4
+ exports.UserAssignedRosterStatus = exports.BeatPlanLogType = exports.LogType = exports.ImageTypeEnums = exports.Months = exports.UserRoleId = exports.UserRoles = exports.NotificationBrandMapping = exports.BrandPromotionSchemes = exports.CompetitorAnalysisRecords = exports.CompetitorProducts = exports.Competitors = exports.MerchandiserBrandsMappings = exports.PermissionPolicy = exports.UserLocations = exports.APIResponse = exports.AutomationExecutions = exports.Automations = exports.Users = exports.Videos = exports.Version = exports.UsersVideosAttemptsHistory = exports.UserStoreChangeHistory = exports.UsersRosterChangeLogs = void 0;
5
5
  var AchievementHistory_1 = require("./AchievementHistory");
6
6
  Object.defineProperty(exports, "AchievementHistory", { enumerable: true, get: function () { return AchievementHistory_1.AchievementHistory; } });
7
7
  var AlertMessages_1 = require("./AlertMessages");
@@ -136,3 +136,18 @@ var CompetitorAnalysisRecords_1 = require("./CompetitorAnalysisRecords");
136
136
  Object.defineProperty(exports, "CompetitorAnalysisRecords", { enumerable: true, get: function () { return CompetitorAnalysisRecords_1.CompetitorAnalysisRecords; } });
137
137
  var BrandPromotionSchemes_1 = require("./BrandPromotionSchemes");
138
138
  Object.defineProperty(exports, "BrandPromotionSchemes", { enumerable: true, get: function () { return BrandPromotionSchemes_1.BrandPromotionSchemes; } });
139
+ var NotificationBrandMapping_1 = require("./NotificationBrandMapping");
140
+ Object.defineProperty(exports, "NotificationBrandMapping", { enumerable: true, get: function () { return NotificationBrandMapping_1.NotificationBrandMapping; } });
141
+ // Enums
142
+ var UserRole_1 = require("./Enum/UserRole");
143
+ Object.defineProperty(exports, "UserRoles", { enumerable: true, get: function () { return UserRole_1.UserRoles; } });
144
+ Object.defineProperty(exports, "UserRoleId", { enumerable: true, get: function () { return UserRole_1.UserRoleId; } });
145
+ var Months_1 = require("./Enum/Months");
146
+ Object.defineProperty(exports, "Months", { enumerable: true, get: function () { return Months_1.Months; } });
147
+ var ImageType_1 = require("./Enum/ImageType");
148
+ Object.defineProperty(exports, "ImageTypeEnums", { enumerable: true, get: function () { return ImageType_1.ImageTypeEnums; } });
149
+ var LogType_1 = require("./Enum/LogType");
150
+ Object.defineProperty(exports, "LogType", { enumerable: true, get: function () { return LogType_1.LogType; } });
151
+ Object.defineProperty(exports, "BeatPlanLogType", { enumerable: true, get: function () { return LogType_1.BeatPlanLogType; } });
152
+ var UserRosterAssignStatus_1 = require("./Enum/UserRosterAssignStatus");
153
+ Object.defineProperty(exports, "UserAssignedRosterStatus", { enumerable: true, get: function () { return UserRosterAssignStatus_1.UserAssignedRosterStatus; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ashutoshvohra136/tenant-db-contract",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -8,7 +8,7 @@ export class StatusCodeUtil {
8
8
  */
9
9
  static getStatusCode(action: string, success: boolean, context?: string): number {
10
10
  // Define base codes for actions
11
- const baseCodes = {
11
+ const baseCodes: { [key: string]: number } = {
12
12
  create: 20001,
13
13
  update: 20002,
14
14
  delete: 20003,
@@ -33,7 +33,7 @@ export class StatusCodeUtil {
33
33
  * @returns An offset number.
34
34
  */
35
35
  private static getContextOffset(context: string): number {
36
- const contextOffsets = {
36
+ const contextOffsets: { [key: string]: number } = {
37
37
  user: 10, // Example: Add 10 for user-related actions
38
38
  order: 20, // Example: Add 20 for order-related actions
39
39
  product: 30, // Example: Add 30 for product-related actions