@ashutoshvohra136/tenant-db-contract 1.0.0

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.
Files changed (244) hide show
  1. package/.prettierrc +32 -0
  2. package/README.md +12 -0
  3. package/dist/constants/alert-messages.d.ts +10 -0
  4. package/dist/constants/alert-messages.js +14 -0
  5. package/dist/constants/common.option.d.ts +7 -0
  6. package/dist/constants/common.option.js +10 -0
  7. package/dist/constants/context.option.d.ts +4 -0
  8. package/dist/constants/context.option.js +8 -0
  9. package/dist/constants/date-time.option.d.ts +5 -0
  10. package/dist/constants/date-time.option.js +21 -0
  11. package/dist/constants/encryption.option.d.ts +4 -0
  12. package/dist/constants/encryption.option.js +8 -0
  13. package/dist/constants/events.option.d.ts +6 -0
  14. package/dist/constants/events.option.js +10 -0
  15. package/dist/constants/roles.option.d.ts +8 -0
  16. package/dist/constants/roles.option.js +12 -0
  17. package/dist/constants/status-code.option.d.ts +4 -0
  18. package/dist/constants/status-code.option.js +31 -0
  19. package/dist/entities/AchievementHistory.d.ts +11 -0
  20. package/dist/entities/AchievementHistory.js +48 -0
  21. package/dist/entities/AlertMessages.d.ts +9 -0
  22. package/dist/entities/AlertMessages.js +45 -0
  23. package/dist/entities/Analysis.d.ts +17 -0
  24. package/dist/entities/Analysis.js +68 -0
  25. package/dist/entities/Answers.d.ts +10 -0
  26. package/dist/entities/Answers.js +45 -0
  27. package/dist/entities/ApiResponses.d.ts +14 -0
  28. package/dist/entities/ApiResponses.js +63 -0
  29. package/dist/entities/Attachments.d.ts +24 -0
  30. package/dist/entities/Attachments.js +95 -0
  31. package/dist/entities/AttendanceDetails.d.ts +25 -0
  32. package/dist/entities/AttendanceDetails.js +111 -0
  33. package/dist/entities/BeatPlanCheckIns.d.ts +23 -0
  34. package/dist/entities/BeatPlanCheckIns.js +96 -0
  35. package/dist/entities/BeatPlanVisits.d.ts +28 -0
  36. package/dist/entities/BeatPlanVisits.js +109 -0
  37. package/dist/entities/BranchManagerBrandsMappings.d.ts +11 -0
  38. package/dist/entities/BranchManagerBrandsMappings.js +53 -0
  39. package/dist/entities/BranchManagerMerchandiserMappings.d.ts +12 -0
  40. package/dist/entities/BranchManagerMerchandiserMappings.js +75 -0
  41. package/dist/entities/BrandWiseCategory.d.ts +10 -0
  42. package/dist/entities/BrandWiseCategory.js +44 -0
  43. package/dist/entities/Brands.d.ts +25 -0
  44. package/dist/entities/Brands.js +91 -0
  45. package/dist/entities/Category.d.ts +17 -0
  46. package/dist/entities/Category.js +70 -0
  47. package/dist/entities/DamagedProductsRequests.d.ts +12 -0
  48. package/dist/entities/DamagedProductsRequests.js +50 -0
  49. package/dist/entities/DamagedProductsRequestsDetails.d.ts +19 -0
  50. package/dist/entities/DamagedProductsRequestsDetails.js +74 -0
  51. package/dist/entities/Enum/ImageType.d.ts +8 -0
  52. package/dist/entities/Enum/ImageType.js +12 -0
  53. package/dist/entities/Enum/LogType.d.ts +9 -0
  54. package/dist/entities/Enum/LogType.js +14 -0
  55. package/dist/entities/Enum/Months.d.ts +14 -0
  56. package/dist/entities/Enum/Months.js +18 -0
  57. package/dist/entities/Enum/UserRole.d.ts +13 -0
  58. package/dist/entities/Enum/UserRole.js +18 -0
  59. package/dist/entities/Enum/UserRosterAssignStatus.d.ts +8 -0
  60. package/dist/entities/Enum/UserRosterAssignStatus.js +12 -0
  61. package/dist/entities/Inventory.d.ts +14 -0
  62. package/dist/entities/Inventory.js +60 -0
  63. package/dist/entities/InventoryDetails.d.ts +20 -0
  64. package/dist/entities/InventoryDetails.js +80 -0
  65. package/dist/entities/LeaveRequests.d.ts +18 -0
  66. package/dist/entities/LeaveRequests.js +78 -0
  67. package/dist/entities/LeaveTypes.d.ts +12 -0
  68. package/dist/entities/LeaveTypes.js +50 -0
  69. package/dist/entities/LoginHistory.d.ts +18 -0
  70. package/dist/entities/LoginHistory.js +89 -0
  71. package/dist/entities/Notifications.d.ts +18 -0
  72. package/dist/entities/Notifications.js +73 -0
  73. package/dist/entities/Offer.d.ts +11 -0
  74. package/dist/entities/Offer.js +51 -0
  75. package/dist/entities/OfferLaunch.d.ts +10 -0
  76. package/dist/entities/OfferLaunch.js +44 -0
  77. package/dist/entities/POSMMaterials.d.ts +8 -0
  78. package/dist/entities/POSMMaterials.js +39 -0
  79. package/dist/entities/POSMRequest.d.ts +12 -0
  80. package/dist/entities/POSMRequest.js +50 -0
  81. package/dist/entities/POSMRequestDetails.d.ts +18 -0
  82. package/dist/entities/POSMRequestDetails.js +70 -0
  83. package/dist/entities/PasswordManager.d.ts +12 -0
  84. package/dist/entities/PasswordManager.js +57 -0
  85. package/dist/entities/Products.d.ts +43 -0
  86. package/dist/entities/Products.js +170 -0
  87. package/dist/entities/Question.d.ts +16 -0
  88. package/dist/entities/Question.js +69 -0
  89. package/dist/entities/Roles.d.ts +13 -0
  90. package/dist/entities/Roles.js +50 -0
  91. package/dist/entities/SalesPunch.d.ts +19 -0
  92. package/dist/entities/SalesPunch.js +73 -0
  93. package/dist/entities/SalesPunchingAIAnalysis.d.ts +11 -0
  94. package/dist/entities/SalesPunchingAIAnalysis.js +49 -0
  95. package/dist/entities/Schemes.d.ts +12 -0
  96. package/dist/entities/Schemes.js +53 -0
  97. package/dist/entities/Shifts.d.ts +14 -0
  98. package/dist/entities/Shifts.js +57 -0
  99. package/dist/entities/StockRequest.d.ts +22 -0
  100. package/dist/entities/StockRequest.js +88 -0
  101. package/dist/entities/StockRequestDetails.d.ts +20 -0
  102. package/dist/entities/StockRequestDetails.js +78 -0
  103. package/dist/entities/StoreBrandsMapping.d.ts +12 -0
  104. package/dist/entities/StoreBrandsMapping.js +57 -0
  105. package/dist/entities/StoreShifts.d.ts +13 -0
  106. package/dist/entities/StoreShifts.js +56 -0
  107. package/dist/entities/Stores.d.ts +25 -0
  108. package/dist/entities/Stores.js +92 -0
  109. package/dist/entities/Task.d.ts +19 -0
  110. package/dist/entities/Task.js +79 -0
  111. package/dist/entities/TaskAttachment.d.ts +9 -0
  112. package/dist/entities/TaskAttachment.js +41 -0
  113. package/dist/entities/TermsAndCondition.d.ts +9 -0
  114. package/dist/entities/TermsAndCondition.js +43 -0
  115. package/dist/entities/UplaodedImages.d.ts +10 -0
  116. package/dist/entities/UplaodedImages.js +52 -0
  117. package/dist/entities/UserDetails.d.ts +22 -0
  118. package/dist/entities/UserDetails.js +97 -0
  119. package/dist/entities/UserLocations.d.ts +13 -0
  120. package/dist/entities/UserLocations.js +62 -0
  121. package/dist/entities/UserQuestionAttemptHistory.d.ts +13 -0
  122. package/dist/entities/UserQuestionAttemptHistory.js +54 -0
  123. package/dist/entities/UserRoster.d.ts +17 -0
  124. package/dist/entities/UserRoster.js +73 -0
  125. package/dist/entities/UserRosterChanges.d.ts +14 -0
  126. package/dist/entities/UserRosterChanges.js +59 -0
  127. package/dist/entities/UserStoreChangedHistory.d.ts +12 -0
  128. package/dist/entities/UserStoreChangedHistory.js +56 -0
  129. package/dist/entities/UserVideosAttemptsHistory.d.ts +17 -0
  130. package/dist/entities/UserVideosAttemptsHistory.js +76 -0
  131. package/dist/entities/Users.d.ts +92 -0
  132. package/dist/entities/Users.js +301 -0
  133. package/dist/entities/Versions.d.ts +15 -0
  134. package/dist/entities/Versions.js +67 -0
  135. package/dist/entities/Videos.d.ts +17 -0
  136. package/dist/entities/Videos.js +62 -0
  137. package/dist/entities/automation_executions.entity.d.ts +7 -0
  138. package/dist/entities/automation_executions.entity.js +39 -0
  139. package/dist/entities/automations.entity.d.ts +16 -0
  140. package/dist/entities/automations.entity.js +75 -0
  141. package/dist/entities/entitiesV2/Inventory.d.ts +14 -0
  142. package/dist/entities/entitiesV2/Inventory.js +60 -0
  143. package/dist/entities/entitiesV2/InventoryDetails.d.ts +20 -0
  144. package/dist/entities/entitiesV2/InventoryDetails.js +80 -0
  145. package/dist/entities/entitiesV2/StockRequest.d.ts +22 -0
  146. package/dist/entities/entitiesV2/StockRequest.js +88 -0
  147. package/dist/entities/entitiesV2/StockRequestDetails.d.ts +20 -0
  148. package/dist/entities/entitiesV2/StockRequestDetails.js +78 -0
  149. package/dist/entities/fcm.entity.d.ts +9 -0
  150. package/dist/entities/fcm.entity.js +41 -0
  151. package/dist/entities/index.d.ts +61 -0
  152. package/dist/entities/index.js +126 -0
  153. package/dist/entities/notification-user-history.entity.d.ts +16 -0
  154. package/dist/entities/notification-user-history.entity.js +68 -0
  155. package/dist/entities/out-of-range.entity.d.ts +11 -0
  156. package/dist/entities/out-of-range.entity.js +49 -0
  157. package/dist/entities/permission-policy.entity.d.ts +7 -0
  158. package/dist/entities/permission-policy.entity.js +40 -0
  159. package/dist/entities/target.d.ts +17 -0
  160. package/dist/entities/target.js +72 -0
  161. package/dist/index.d.ts +1 -0
  162. package/dist/index.js +17 -0
  163. package/package.json +17 -0
  164. package/src/constants/alert-messages.ts +10 -0
  165. package/src/constants/common.option.ts +8 -0
  166. package/src/constants/context.option.ts +4 -0
  167. package/src/constants/date-time.option.ts +19 -0
  168. package/src/constants/encryption.option.ts +4 -0
  169. package/src/constants/events.option.ts +6 -0
  170. package/src/constants/roles.option.ts +8 -0
  171. package/src/constants/status-code.option.ts +43 -0
  172. package/src/entities/AchievementHistory.ts +37 -0
  173. package/src/entities/AlertMessages.ts +33 -0
  174. package/src/entities/Analysis.ts +53 -0
  175. package/src/entities/Answers.ts +36 -0
  176. package/src/entities/ApiResponses.ts +45 -0
  177. package/src/entities/Attachments.ts +81 -0
  178. package/src/entities/AttendanceDetails.ts +86 -0
  179. package/src/entities/BeatPlanCheckIns.ts +82 -0
  180. package/src/entities/BeatPlanVisits.ts +88 -0
  181. package/src/entities/BranchManagerBrandsMappings.ts +41 -0
  182. package/src/entities/BranchManagerMerchandiserMappings.ts +65 -0
  183. package/src/entities/BrandWiseCategory.ts +32 -0
  184. package/src/entities/Brands.ts +73 -0
  185. package/src/entities/Category.ts +57 -0
  186. package/src/entities/DamagedProductsRequests.ts +44 -0
  187. package/src/entities/DamagedProductsRequestsDetails.ts +65 -0
  188. package/src/entities/Enum/ImageType.ts +8 -0
  189. package/src/entities/Enum/LogType.ts +10 -0
  190. package/src/entities/Enum/Months.ts +14 -0
  191. package/src/entities/Enum/UserRole.ts +14 -0
  192. package/src/entities/Enum/UserRosterAssignStatus.ts +8 -0
  193. package/src/entities/Inventory.ts +50 -0
  194. package/src/entities/InventoryDetails.ts +63 -0
  195. package/src/entities/LeaveRequests.ts +61 -0
  196. package/src/entities/LeaveTypes.ts +38 -0
  197. package/src/entities/LoginHistory.ts +70 -0
  198. package/src/entities/Notifications.ts +62 -0
  199. package/src/entities/Offer.ts +35 -0
  200. package/src/entities/OfferLaunch.ts +31 -0
  201. package/src/entities/POSMMaterials.ts +33 -0
  202. package/src/entities/POSMRequest.ts +41 -0
  203. package/src/entities/POSMRequestDetails.ts +59 -0
  204. package/src/entities/PasswordManager.ts +44 -0
  205. package/src/entities/Products.ts +145 -0
  206. package/src/entities/Question.ts +57 -0
  207. package/src/entities/Roles.ts +36 -0
  208. package/src/entities/SalesPunch.ts +63 -0
  209. package/src/entities/SalesPunchingAIAnalysis.ts +36 -0
  210. package/src/entities/Schemes.ts +39 -0
  211. package/src/entities/Shifts.ts +41 -0
  212. package/src/entities/StockRequest.ts +68 -0
  213. package/src/entities/StockRequestDetails.ts +63 -0
  214. package/src/entities/StoreBrandsMapping.ts +44 -0
  215. package/src/entities/StoreShifts.ts +46 -0
  216. package/src/entities/Stores.ts +68 -0
  217. package/src/entities/Task.ts +60 -0
  218. package/src/entities/TaskAttachment.ts +29 -0
  219. package/src/entities/TermsAndCondition.ts +29 -0
  220. package/src/entities/UplaodedImages.ts +37 -0
  221. package/src/entities/UserDetails.ts +74 -0
  222. package/src/entities/UserLocations.ts +49 -0
  223. package/src/entities/UserQuestionAttemptHistory.ts +49 -0
  224. package/src/entities/UserRoster.ts +58 -0
  225. package/src/entities/UserRosterChanges.ts +44 -0
  226. package/src/entities/UserStoreChangedHistory.ts +40 -0
  227. package/src/entities/UserVideosAttemptsHistory.ts +64 -0
  228. package/src/entities/Users.ts +259 -0
  229. package/src/entities/Versions.ts +47 -0
  230. package/src/entities/Videos.ts +48 -0
  231. package/src/entities/automation_executions.entity.ts +24 -0
  232. package/src/entities/automations.entity.ts +60 -0
  233. package/src/entities/entitiesV2/Inventory.ts +51 -0
  234. package/src/entities/entitiesV2/InventoryDetails.ts +63 -0
  235. package/src/entities/entitiesV2/StockRequest.ts +68 -0
  236. package/src/entities/entitiesV2/StockRequestDetails.ts +63 -0
  237. package/src/entities/fcm.entity.ts +30 -0
  238. package/src/entities/index.ts +61 -0
  239. package/src/entities/notification-user-history.entity.ts +51 -0
  240. package/src/entities/out-of-range.entity.ts +36 -0
  241. package/src/entities/permission-policy.entity.ts +25 -0
  242. package/src/entities/target.ts +54 -0
  243. package/src/index.ts +1 -0
  244. package/tsconfig.json +14 -0
@@ -0,0 +1,81 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ CreateDateColumn,
6
+ UpdateDateColumn,
7
+ BaseEntity,
8
+ JoinColumn,
9
+ ManyToOne,
10
+ OneToOne,
11
+ Index,
12
+ } from 'typeorm';
13
+ import { SalesPunching } from './SalesPunch';
14
+ import { Analysis } from './Analysis';
15
+ import { POSMRequestDetails } from './POSMRequestDetails';
16
+ import { LeaveRequests } from './LeaveRequests';
17
+ import { DamagedProductsRequestDetails } from './DamagedProductsRequestsDetails';
18
+ import { BeatPlanCheckins } from './BeatPlanCheckIns';
19
+ import { InventoryDetails } from './InventoryDetails';
20
+ import { StockRequestDetails } from './StockRequestDetails'; // ← ADD THIS IMPORT
21
+
22
+ @Entity({ name: 'attachement' })
23
+ @Index('IDX_attachement_damaged_request', ['damagedProductsRequestDetails'])
24
+ @Index('IDX_attachement_analysis_id', ['analysis'])
25
+ @Index('IDX_attachement_posm_request_details_id', ['posmRequestDetails'])
26
+ @Index('IDX_attachement_beat_plan_checkin_id', ['beatPlanCheckIns'])
27
+ export class Attachement extends BaseEntity {
28
+ @PrimaryGeneratedColumn('increment', { type: 'bigint' })
29
+ id!: number;
30
+
31
+ @Column({ type: 'varchar', length: 100, nullable: false })
32
+ type!: string;
33
+
34
+ @Column({ type: 'text', nullable: false })
35
+ url!: string;
36
+
37
+ @Column({ type: 'tinyint', default: 1 })
38
+ status?: number;
39
+
40
+ @CreateDateColumn({ type: 'datetime' })
41
+ created_at!: Date;
42
+
43
+ @UpdateDateColumn({ type: 'datetime' })
44
+ updated_at!: Date;
45
+
46
+ @ManyToOne(() => SalesPunching, (salesPunching) => salesPunching.attachment)
47
+ @JoinColumn({ name: 'sales_punching_id' })
48
+ salesPunching: SalesPunching;
49
+
50
+ @ManyToOne(() => Analysis, (analysis) => analysis.attachment)
51
+ @JoinColumn({ name: 'analysis_id' })
52
+ analysis: Analysis;
53
+
54
+ @ManyToOne(() => POSMRequestDetails, (posmRequestDetails) => posmRequestDetails.attachment)
55
+ @JoinColumn({ name: 'posm_request_details_id' })
56
+ posmRequestDetails: POSMRequestDetails;
57
+
58
+ @OneToOne(
59
+ () => DamagedProductsRequestDetails,
60
+ (damagedProductsRequestDetails) => damagedProductsRequestDetails.attachment
61
+ )
62
+ @JoinColumn({ name: 'damaged_products_request_details_id' })
63
+ damagedProductsRequestDetails: DamagedProductsRequestDetails;
64
+
65
+ @ManyToOne(() => LeaveRequests, (leaveRequest) => leaveRequest.attachment)
66
+ @JoinColumn({ name: 'leave_request_id' })
67
+ leaveRequest: LeaveRequests;
68
+
69
+ @ManyToOne(() => BeatPlanCheckins, (bp) => bp.attachment)
70
+ @JoinColumn({ name: 'beat_plan_checkIns_id' })
71
+ beatPlanCheckIns: LeaveRequests;
72
+
73
+ @OneToOne(() => InventoryDetails, (inventoryDetails) => inventoryDetails.attachment)
74
+ @JoinColumn({ name: 'inventory_details_id' })
75
+ inventoryDetails: InventoryDetails;
76
+
77
+ // ← ADD THIS RELATION (at the end, before closing brace)
78
+ @OneToOne(() => StockRequestDetails, (stockRequestDetails) => stockRequestDetails.attachment)
79
+ @JoinColumn({ name: 'stock_request_details_id' })
80
+ stockRequestDetails?: StockRequestDetails;
81
+ }
@@ -0,0 +1,86 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ Index,
7
+ JoinColumn,
8
+ ManyToOne,
9
+ PrimaryGeneratedColumn,
10
+ UpdateDateColumn,
11
+ } from 'typeorm';
12
+ import { Users } from './Users';
13
+ import { LogType } from './Enum/LogType';
14
+
15
+ @Index('fk_attendance_details_1_idx', ['userId'], {})
16
+ @Index('IDX_attendance_details_log_in_time', ['logInTime'])
17
+ @Entity('attendance_details')
18
+ export class AttendanceDetails extends BaseEntity {
19
+ @PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
20
+ id!: string;
21
+
22
+ @Column('bigint', { name: 'user_id', nullable: true })
23
+ userId?: string | null;
24
+
25
+ @Column('timestamp', { name: 'log_in_time', nullable: true })
26
+ logInTime?: Date;
27
+
28
+ @Column('timestamp', { name: 'log_out_time', nullable: true })
29
+ logOutTime?: Date;
30
+
31
+ @Column('varchar', { name: 'log_in_latitude', nullable: true, length: 255 })
32
+ logInLatitude?: string;
33
+
34
+ @Column('varchar', { name: 'log_in_longitude', nullable: true, length: 255 })
35
+ logInLongitude?: string;
36
+
37
+ @Column('varchar', { name: 'log_out_latitude', nullable: true, length: 255 })
38
+ logOutLatitude?: string;
39
+
40
+ @Column('varchar', { name: 'log_out_longitude', nullable: true, length: 255 })
41
+ logOutLongitude?: string;
42
+
43
+ @Column('varchar', { name: 'log_in_addresss', nullable: true, length: 255 })
44
+ logInAddresss?: string;
45
+
46
+ @Column('varchar', { name: 'log_out_address', nullable: true, length: 255 })
47
+ logOutAddress?: string;
48
+
49
+ @Column('varchar', { name: 'log_in_state', nullable: true, length: 255 })
50
+ logInState?: string;
51
+
52
+ @Column('varchar', { name: 'log_out_state', nullable: true, length: 255 })
53
+ logOutState?: string;
54
+
55
+ @Column('varchar', { name: 'log_in_city', nullable: true, length: 255 })
56
+ logInCity?: string;
57
+
58
+ @Column('varchar', { name: 'log_out_city', nullable: true, length: 255 })
59
+ logOutCity?: string;
60
+
61
+ @Column('varchar', { name: 'session_id', nullable: true, length: 255 })
62
+ sessionId?: string;
63
+
64
+ @Column('tinyint', { name: 'status', nullable: true })
65
+ status?: number;
66
+
67
+ @CreateDateColumn({ type: 'datetime' })
68
+ created_at!: Date;
69
+
70
+ @UpdateDateColumn({ type: 'datetime' })
71
+ updated_at!: Date;
72
+
73
+ @Column({
74
+ type: 'enum',
75
+ enum: LogType,
76
+ default: LogType.NOTACTIVE,
77
+ })
78
+ log_type?: LogType;
79
+
80
+ @ManyToOne(() => Users, (users) => users.attendanceDetails, {
81
+ onDelete: 'NO ACTION',
82
+ onUpdate: 'NO ACTION',
83
+ })
84
+ @JoinColumn([{ name: 'user_id', referencedColumnName: 'id' }])
85
+ user?: Users;
86
+ }
@@ -0,0 +1,82 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ PrimaryGeneratedColumn,
7
+ ManyToOne,
8
+ JoinColumn,
9
+ OneToMany,
10
+ UpdateDateColumn,
11
+ Index,
12
+ } from 'typeorm';
13
+ import { BeatPlanVisits } from './BeatPlanVisits';
14
+ import { Users } from './Users';
15
+ import { BeatPlanLogType } from './Enum/LogType';
16
+ import { Attachement } from './Attachments';
17
+
18
+ @Entity({ name: 'beat_plan_checkins' })
19
+ @Index('IDX_beat_plan_checkins_user_checkout', ['user_id', 'check_out_time'])
20
+ @Index('IDX_beat_plan_checkins_visit', ['beat_plan_visit_id'])
21
+ export class BeatPlanCheckins extends BaseEntity {
22
+ @PrimaryGeneratedColumn({ type: 'bigint' })
23
+ id!: string;
24
+
25
+ @Column({ type: 'string', nullable: false })
26
+ beat_plan_visit_id!: string;
27
+
28
+ @Column({ type: 'string', nullable: false })
29
+ user_id!: string;
30
+
31
+ @Column({ type: 'decimal', precision: 10, scale: 8 })
32
+ check_in_latitude!: number;
33
+
34
+ @Column({ type: 'decimal', precision: 10, scale: 8 })
35
+ check_in_longitude!: number;
36
+
37
+ @Column({ type: 'decimal', precision: 10, scale: 8, nullable: true })
38
+ check_out_latitude?: number;
39
+
40
+ @Column({ type: 'decimal', precision: 10, scale: 8, nullable: true })
41
+ check_out_longitude?: number;
42
+
43
+ @Column({ type: 'datetime' })
44
+ check_in_time!: Date;
45
+
46
+ @Column({ type: 'datetime', nullable: true })
47
+ check_out_time?: Date;
48
+
49
+ @Column({ type: 'text', nullable: true })
50
+ remarks?: string;
51
+
52
+ // @Column({ type: 'text', name: 'selfie_url', nullable: true })
53
+ // selfieUrl?: string;
54
+
55
+ // @Column({ type: 'varchar', length: 10 })
56
+ // type!: string; // IN or OUT
57
+
58
+ @Column({
59
+ type: 'enum',
60
+ enum: BeatPlanLogType,
61
+ default: null,
62
+ nullable: true,
63
+ })
64
+ type!: BeatPlanLogType; // IN or OUT
65
+
66
+ @CreateDateColumn({ type: 'datetime' })
67
+ created_at!: Date;
68
+
69
+ @UpdateDateColumn({ name: 'updated_at', type: 'datetime' })
70
+ updatedAt!: Date;
71
+
72
+ @ManyToOne(() => BeatPlanVisits, (visit) => visit.checkins)
73
+ @JoinColumn({ name: 'beat_plan_visit_id' })
74
+ beatPlanVisit!: BeatPlanVisits;
75
+
76
+ @ManyToOne(() => Users, (user) => user.beatPlanCheckins)
77
+ @JoinColumn({ name: 'user_id' })
78
+ user!: Users;
79
+
80
+ @OneToMany(() => Attachement, (attachement) => attachement.beatPlanCheckIns)
81
+ attachment: Attachement;
82
+ }
@@ -0,0 +1,88 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ PrimaryGeneratedColumn,
7
+ UpdateDateColumn,
8
+ ManyToOne,
9
+ OneToMany,
10
+ JoinColumn,
11
+ Index,
12
+ } from 'typeorm';
13
+ import { Stores } from './Stores';
14
+ import { Users } from './Users';
15
+ import { Brands } from './Brands';
16
+ import { Inventory } from './Inventory';
17
+ import { BeatPlanCheckins } from './BeatPlanCheckIns';
18
+ import { StockRequest } from './StockRequest';
19
+
20
+ @Entity({ name: 'beat_plan_visits' })
21
+ @Index('IDX_beat_plan_visits_assigned_date_start', ['assignedTo', 'visitDate', 'visitStartTime'])
22
+ export class BeatPlanVisits extends BaseEntity {
23
+ @PrimaryGeneratedColumn({ type: 'bigint' })
24
+ id!: string;
25
+
26
+ @Column({ name: 'store_id', type: 'bigint', nullable: false })
27
+ storeId!: string;
28
+
29
+ @Column({ name: 'assigned_by', type: 'bigint', nullable: false })
30
+ assignedBy!: string;
31
+
32
+ @Column({ name: 'assigned_to', type: 'bigint', nullable: false })
33
+ assignedTo!: string;
34
+
35
+ @Column({ name: 'visit_date', type: 'date' })
36
+ visitDate!: Date | string;
37
+
38
+ @Column({ name: 'visit_start_time', type: 'time' })
39
+ visitStartTime!: string;
40
+
41
+ @Column({ name: 'visit_end_time', type: 'time' })
42
+ visitEndTime!: string;
43
+
44
+ @Column({ type: 'tinyint', default: 0 })
45
+ status?: number; //0 pending,1 completed,2 deactivated, 3= partial completed
46
+
47
+ @Column({ name: 'check_in_time', type: 'datetime', nullable: true })
48
+ checkInTime?: Date;
49
+
50
+ @Column({ name: 'check_out_time', type: 'datetime', nullable: true })
51
+ checkOutTime?: Date;
52
+
53
+ @Column({ type: 'text', nullable: true })
54
+ remarks?: string;
55
+
56
+ @Column({ name: 'brand_id', type: 'bigint', nullable: false })
57
+ brandId!: string;
58
+
59
+ @CreateDateColumn({ name: 'created_at', type: 'datetime' })
60
+ createdAt!: Date;
61
+
62
+ @UpdateDateColumn({ name: 'updated_at', type: 'datetime' })
63
+ updatedAt!: Date;
64
+
65
+ // ===== Relations =====
66
+
67
+ @ManyToOne(() => Stores, (store) => store.beatPlanVisit)
68
+ @JoinColumn({ name: 'store_id' })
69
+ store!: Stores;
70
+
71
+ @ManyToOne(() => Users, (user) => user.beatPlanVisitsAssignedTo)
72
+ @JoinColumn({ name: 'assigned_to' })
73
+ assignedToUser!: Users;
74
+
75
+ @ManyToOne(() => Users, (user) => user.beatPlanVisitsAssignedBy)
76
+ @JoinColumn({ name: 'assigned_by' })
77
+ assignedByUser!: Users;
78
+
79
+ @ManyToOne(() => Brands, (brand) => brand.visits)
80
+ @JoinColumn({ name: 'brand_id' })
81
+ brand!: Brands;
82
+
83
+ @OneToMany(() => StockRequest, (stockRequest) => stockRequest.beatPlanVisit)
84
+ stockRequests!: StockRequest[];
85
+
86
+ @OneToMany(() => BeatPlanCheckins, (checkin) => checkin.beatPlanVisit)
87
+ checkins!: BeatPlanCheckins[];
88
+ }
@@ -0,0 +1,41 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ JoinColumn,
7
+ ManyToOne,
8
+ PrimaryGeneratedColumn,
9
+ UpdateDateColumn,
10
+ } from 'typeorm';
11
+ import { Users } from './Users';
12
+ import { Brands } from './Brands';
13
+
14
+ @Entity('branch_manager_brands_mappings')
15
+ export class BranchManagerBrandsMappings extends BaseEntity {
16
+ @PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
17
+ id!: string;
18
+
19
+ @Column('tinyint', { name: 'status', nullable: true, default: 0 })
20
+ status?: number;
21
+
22
+ @CreateDateColumn({ type: 'datetime' })
23
+ created_at!: Date;
24
+
25
+ @UpdateDateColumn({ type: 'datetime' })
26
+ updated_at!: Date;
27
+
28
+ @ManyToOne(() => Users, (users) => users.branchManagerBrandsMappings, {
29
+ onDelete: 'NO ACTION',
30
+ onUpdate: 'NO ACTION',
31
+ })
32
+ @JoinColumn([{ name: 'branch_manager_id', referencedColumnName: 'id' }])
33
+ branchManager!: Users;
34
+
35
+ @ManyToOne(() => Brands, (brands) => brands.branchManagerBrandsMappings, {
36
+ onDelete: 'NO ACTION',
37
+ onUpdate: 'NO ACTION',
38
+ })
39
+ @JoinColumn([{ name: 'brands_id', referencedColumnName: 'id' }])
40
+ brands!: Brands;
41
+ }
@@ -0,0 +1,65 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ Index,
7
+ JoinColumn,
8
+ ManyToOne,
9
+ PrimaryGeneratedColumn,
10
+ UpdateDateColumn,
11
+ } from 'typeorm';
12
+ import { Users } from './Users';
13
+
14
+ @Index('branch_manager_merchandiser_ibfk_1', ['merchandiserId'], {})
15
+ @Index('branch_manager_merchandiser_ibfk_2', ['branchManagerId'], {})
16
+ @Entity('branch_manager_merchandiser_mappings')
17
+ export class BranchManagerMerchandiserMappings extends BaseEntity {
18
+ @PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
19
+ id!: string;
20
+
21
+ @Column('bigint', { name: 'branch_manager_id', nullable: false })
22
+ branchManagerId!: string;
23
+
24
+ @Column('bigint', { name: 'merchandiser_id', nullable: false })
25
+ merchandiserId!: string;
26
+
27
+ @Column('tinyint', { name: 'status', nullable: true, default: 0 })
28
+ status?: number;
29
+
30
+ @CreateDateColumn({ type: 'datetime' })
31
+ created_at!: Date;
32
+
33
+ @UpdateDateColumn({ type: 'datetime' })
34
+ updated_at!: Date;
35
+
36
+ @ManyToOne(() => Users, (users) => users.merchandiserMappings, {
37
+ onDelete: 'NO ACTION',
38
+ onUpdate: 'NO ACTION',
39
+ })
40
+ @JoinColumn([{ name: 'merchandiser_id', referencedColumnName: 'id' }])
41
+ merchandiser!: Users;
42
+
43
+ // ✅ Fix: Define `branchManager` Relation
44
+ @ManyToOne(() => Users, (users) => users.branchManagerMappings, {
45
+ onDelete: 'NO ACTION',
46
+ onUpdate: 'NO ACTION',
47
+ })
48
+ @JoinColumn([{ name: 'branch_manager_id', referencedColumnName: 'id' }])
49
+ branchManager!: Users;
50
+ }
51
+
52
+ // @ManyToOne(() => Users, (users) => users.branchManagerMappings, {
53
+ // onDelete: "CASCADE",
54
+ // onUpdate: "CASCADE",
55
+ // })
56
+ // @JoinColumn([{ name: "branch_manager_id", referencedColumnName: "id" }])
57
+ // branchManager!: Users;
58
+
59
+ // // ✅ Corrected ManyToOne relation with Users (Merchandiser)
60
+ // @ManyToOne(() => Users, (users) => users.merchandiserMappings, {
61
+ // onDelete: "CASCADE",
62
+ // onUpdate: "CASCADE",
63
+ // })
64
+ // @JoinColumn([{ name: "merchandiser_id", referencedColumnName: "id" }])
65
+ // merchandiser!: Users;
@@ -0,0 +1,32 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ CreateDateColumn,
5
+ UpdateDateColumn,
6
+ BaseEntity,
7
+ JoinColumn,
8
+ ManyToOne,
9
+ } from 'typeorm';
10
+ import { Brands } from './Brands';
11
+ import { Catagory } from './Category';
12
+ // import {SalesProduct} from './SalesProducts'
13
+
14
+ @Entity({ name: 'brand_wise_category' })
15
+ export class BrandWiseCategory extends BaseEntity {
16
+ @PrimaryGeneratedColumn('increment', { type: 'bigint' })
17
+ id!: number;
18
+
19
+ @ManyToOne(() => Brands, (brands) => brands.brandCategory)
20
+ @JoinColumn({ name: 'brand_id' })
21
+ brand!: Brands[];
22
+
23
+ @ManyToOne(() => Catagory, (catagory) => catagory.brandCategory)
24
+ @JoinColumn({ name: 'category_id' })
25
+ subCategoryProducts!: Catagory;
26
+
27
+ @CreateDateColumn({ type: 'datetime' })
28
+ created_at!: Date;
29
+
30
+ @UpdateDateColumn({ type: 'datetime' })
31
+ updated_at!: Date;
32
+ }
@@ -0,0 +1,73 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ Index,
7
+ ManyToOne,
8
+ OneToMany,
9
+ PrimaryGeneratedColumn,
10
+ UpdateDateColumn,
11
+ } from 'typeorm';
12
+ import { BranchManagerBrandsMappings } from './BranchManagerBrandsMappings';
13
+ import { Analysis } from './Analysis';
14
+ import { Product } from './Products';
15
+ import { BrandWiseCategory } from './BrandWiseCategory';
16
+ import { LeaveTypes } from './LeaveTypes';
17
+ import { Users } from './Users';
18
+ import { StoreBrandsMappings } from './StoreBrandsMapping';
19
+ import { BeatPlanVisits } from './BeatPlanVisits';
20
+
21
+ @Index('code', ['code'], { unique: true })
22
+ // @Index("IDX_1687d82f42d8b3f8162a29e7df", ["code"], { unique: true })
23
+ @Entity('brands')
24
+ export class Brands extends BaseEntity {
25
+ @PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
26
+ id!: string;
27
+
28
+ @Column('varchar', { name: 'name', nullable: false, length: 255 })
29
+ name!: string | null;
30
+
31
+ @Column({ type: 'varchar', length: 255 })
32
+ image!: string;
33
+
34
+ @Column('varchar', {
35
+ name: 'code',
36
+ nullable: false,
37
+ unique: true,
38
+ length: 255,
39
+ })
40
+ code!: string;
41
+
42
+ @CreateDateColumn({ type: 'datetime' })
43
+ created_at!: Date;
44
+
45
+ @UpdateDateColumn({ type: 'datetime' })
46
+ updated_at!: Date;
47
+
48
+ @OneToMany(
49
+ () => BranchManagerBrandsMappings,
50
+ (branchManagerBrandsMappings) => branchManagerBrandsMappings.brands
51
+ )
52
+ branchManagerBrandsMappings?: BranchManagerBrandsMappings[];
53
+
54
+ @OneToMany(() => StoreBrandsMappings, (storeBrandsMappings) => storeBrandsMappings.brands)
55
+ storeBrandsMappings?: StoreBrandsMappings[];
56
+
57
+ @ManyToOne(() => Analysis, (analysis) => analysis.brand)
58
+ analysis: Analysis[];
59
+ @OneToMany(() => Product, (product) => product.brand)
60
+ product?: Product[];
61
+
62
+ @OneToMany(() => BrandWiseCategory, (brandWiseCategory) => brandWiseCategory.brand)
63
+ brandCategory!: BrandWiseCategory[];
64
+
65
+ @OneToMany(() => LeaveTypes, (leaveTypes) => leaveTypes.brand)
66
+ leaveTypes?: LeaveTypes[];
67
+
68
+ @OneToMany(() => Users, (users) => users.brand)
69
+ user?: Users[];
70
+
71
+ @OneToMany(() => BeatPlanVisits, (visit) => visit.brand)
72
+ visits!: BeatPlanVisits[];
73
+ }
@@ -0,0 +1,57 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ CreateDateColumn,
6
+ UpdateDateColumn,
7
+ BaseEntity,
8
+ OneToMany,
9
+ } from 'typeorm';
10
+ import { Product } from './Products';
11
+ import { BrandWiseCategory } from './BrandWiseCategory';
12
+ // import {SalesProduct} from './SalesProducts'
13
+
14
+ @Entity({ name: 'categories' })
15
+ export class Catagory extends BaseEntity {
16
+ @PrimaryGeneratedColumn('increment', { type: 'bigint' })
17
+ id!: number;
18
+
19
+ @Column({ type: 'varchar', length: 100, nullable: false })
20
+ name!: string;
21
+
22
+ @Column({ type: 'varchar', length: 255 })
23
+ slug!: string;
24
+
25
+ @Column({ type: 'text', nullable: true })
26
+ description?: string;
27
+
28
+ @Column({ type: 'varchar', length: 255, nullable: true })
29
+ image?: string;
30
+
31
+ // @Column({ type: 'varchar', length: 255, nullable: true })
32
+ // parent_id!: string;
33
+
34
+ @Column({ type: 'tinyint', default: 1 })
35
+ status?: number;
36
+
37
+ @Column({ type: 'varchar', default: null })
38
+ category_id?: string;
39
+
40
+ @OneToMany(() => Product, (product) => product.category)
41
+ products!: Product[];
42
+
43
+ // @OneToMany(() => SalesProduct, product => product.category)
44
+ // product!: SalesProduct[];
45
+
46
+ @OneToMany(() => Product, (product) => product.subCategory)
47
+ subCategoryProducts!: Product[];
48
+
49
+ @OneToMany(() => BrandWiseCategory, (brandWiseCategory) => brandWiseCategory.brand)
50
+ brandCategory!: BrandWiseCategory[];
51
+
52
+ @CreateDateColumn({ type: 'datetime' })
53
+ created_at!: Date;
54
+
55
+ @UpdateDateColumn({ type: 'datetime' })
56
+ updated_at!: Date;
57
+ }
@@ -0,0 +1,44 @@
1
+ import {
2
+ BaseEntity,
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ JoinColumn,
7
+ ManyToOne,
8
+ OneToMany,
9
+ PrimaryGeneratedColumn,
10
+ UpdateDateColumn,
11
+ } from 'typeorm';
12
+ import { Users } from './Users';
13
+ import { DamagedProductsRequestDetails } from './DamagedProductsRequestsDetails';
14
+
15
+ @Entity('damaged_product_requests')
16
+ export class DamagedProductsRequest extends BaseEntity {
17
+ @PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
18
+ id!: string;
19
+
20
+ @Column('bigint', { name: 'user_id', nullable: true })
21
+ userId?: string | null;
22
+
23
+ // @Column({ type: 'datetime', nullable: true })
24
+ // date!: Date;
25
+
26
+ @Column('tinyint', { name: 'status', nullable: true, default: 0 })
27
+ status?: number;
28
+
29
+ @CreateDateColumn({ type: 'datetime' })
30
+ created_at!: Date;
31
+
32
+ @UpdateDateColumn({ type: 'datetime' })
33
+ updated_at!: Date;
34
+
35
+ @ManyToOne(() => Users, (user) => user.damagedProductRequest)
36
+ @JoinColumn({ name: 'user_id', referencedColumnName: 'id' })
37
+ user?: Users;
38
+
39
+ @OneToMany(
40
+ () => DamagedProductsRequestDetails,
41
+ (damagedProductsRequestDetails) => damagedProductsRequestDetails.damagedProductsRequest
42
+ )
43
+ damagedProductsRequestDetails?: DamagedProductsRequestDetails[];
44
+ }