@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.
- package/.prettierrc +32 -0
- package/README.md +12 -0
- package/dist/constants/alert-messages.d.ts +10 -0
- package/dist/constants/alert-messages.js +14 -0
- package/dist/constants/common.option.d.ts +7 -0
- package/dist/constants/common.option.js +10 -0
- package/dist/constants/context.option.d.ts +4 -0
- package/dist/constants/context.option.js +8 -0
- package/dist/constants/date-time.option.d.ts +5 -0
- package/dist/constants/date-time.option.js +21 -0
- package/dist/constants/encryption.option.d.ts +4 -0
- package/dist/constants/encryption.option.js +8 -0
- package/dist/constants/events.option.d.ts +6 -0
- package/dist/constants/events.option.js +10 -0
- package/dist/constants/roles.option.d.ts +8 -0
- package/dist/constants/roles.option.js +12 -0
- package/dist/constants/status-code.option.d.ts +4 -0
- package/dist/constants/status-code.option.js +31 -0
- package/dist/entities/AchievementHistory.d.ts +11 -0
- package/dist/entities/AchievementHistory.js +48 -0
- package/dist/entities/AlertMessages.d.ts +9 -0
- package/dist/entities/AlertMessages.js +45 -0
- package/dist/entities/Analysis.d.ts +17 -0
- package/dist/entities/Analysis.js +68 -0
- package/dist/entities/Answers.d.ts +10 -0
- package/dist/entities/Answers.js +45 -0
- package/dist/entities/ApiResponses.d.ts +14 -0
- package/dist/entities/ApiResponses.js +63 -0
- package/dist/entities/Attachments.d.ts +24 -0
- package/dist/entities/Attachments.js +95 -0
- package/dist/entities/AttendanceDetails.d.ts +25 -0
- package/dist/entities/AttendanceDetails.js +111 -0
- package/dist/entities/BeatPlanCheckIns.d.ts +23 -0
- package/dist/entities/BeatPlanCheckIns.js +96 -0
- package/dist/entities/BeatPlanVisits.d.ts +28 -0
- package/dist/entities/BeatPlanVisits.js +109 -0
- package/dist/entities/BranchManagerBrandsMappings.d.ts +11 -0
- package/dist/entities/BranchManagerBrandsMappings.js +53 -0
- package/dist/entities/BranchManagerMerchandiserMappings.d.ts +12 -0
- package/dist/entities/BranchManagerMerchandiserMappings.js +75 -0
- package/dist/entities/BrandWiseCategory.d.ts +10 -0
- package/dist/entities/BrandWiseCategory.js +44 -0
- package/dist/entities/Brands.d.ts +25 -0
- package/dist/entities/Brands.js +91 -0
- package/dist/entities/Category.d.ts +17 -0
- package/dist/entities/Category.js +70 -0
- package/dist/entities/DamagedProductsRequests.d.ts +12 -0
- package/dist/entities/DamagedProductsRequests.js +50 -0
- package/dist/entities/DamagedProductsRequestsDetails.d.ts +19 -0
- package/dist/entities/DamagedProductsRequestsDetails.js +74 -0
- package/dist/entities/Enum/ImageType.d.ts +8 -0
- package/dist/entities/Enum/ImageType.js +12 -0
- package/dist/entities/Enum/LogType.d.ts +9 -0
- package/dist/entities/Enum/LogType.js +14 -0
- package/dist/entities/Enum/Months.d.ts +14 -0
- package/dist/entities/Enum/Months.js +18 -0
- package/dist/entities/Enum/UserRole.d.ts +13 -0
- package/dist/entities/Enum/UserRole.js +18 -0
- package/dist/entities/Enum/UserRosterAssignStatus.d.ts +8 -0
- package/dist/entities/Enum/UserRosterAssignStatus.js +12 -0
- package/dist/entities/Inventory.d.ts +14 -0
- package/dist/entities/Inventory.js +60 -0
- package/dist/entities/InventoryDetails.d.ts +20 -0
- package/dist/entities/InventoryDetails.js +80 -0
- package/dist/entities/LeaveRequests.d.ts +18 -0
- package/dist/entities/LeaveRequests.js +78 -0
- package/dist/entities/LeaveTypes.d.ts +12 -0
- package/dist/entities/LeaveTypes.js +50 -0
- package/dist/entities/LoginHistory.d.ts +18 -0
- package/dist/entities/LoginHistory.js +89 -0
- package/dist/entities/Notifications.d.ts +18 -0
- package/dist/entities/Notifications.js +73 -0
- package/dist/entities/Offer.d.ts +11 -0
- package/dist/entities/Offer.js +51 -0
- package/dist/entities/OfferLaunch.d.ts +10 -0
- package/dist/entities/OfferLaunch.js +44 -0
- package/dist/entities/POSMMaterials.d.ts +8 -0
- package/dist/entities/POSMMaterials.js +39 -0
- package/dist/entities/POSMRequest.d.ts +12 -0
- package/dist/entities/POSMRequest.js +50 -0
- package/dist/entities/POSMRequestDetails.d.ts +18 -0
- package/dist/entities/POSMRequestDetails.js +70 -0
- package/dist/entities/PasswordManager.d.ts +12 -0
- package/dist/entities/PasswordManager.js +57 -0
- package/dist/entities/Products.d.ts +43 -0
- package/dist/entities/Products.js +170 -0
- package/dist/entities/Question.d.ts +16 -0
- package/dist/entities/Question.js +69 -0
- package/dist/entities/Roles.d.ts +13 -0
- package/dist/entities/Roles.js +50 -0
- package/dist/entities/SalesPunch.d.ts +19 -0
- package/dist/entities/SalesPunch.js +73 -0
- package/dist/entities/SalesPunchingAIAnalysis.d.ts +11 -0
- package/dist/entities/SalesPunchingAIAnalysis.js +49 -0
- package/dist/entities/Schemes.d.ts +12 -0
- package/dist/entities/Schemes.js +53 -0
- package/dist/entities/Shifts.d.ts +14 -0
- package/dist/entities/Shifts.js +57 -0
- package/dist/entities/StockRequest.d.ts +22 -0
- package/dist/entities/StockRequest.js +88 -0
- package/dist/entities/StockRequestDetails.d.ts +20 -0
- package/dist/entities/StockRequestDetails.js +78 -0
- package/dist/entities/StoreBrandsMapping.d.ts +12 -0
- package/dist/entities/StoreBrandsMapping.js +57 -0
- package/dist/entities/StoreShifts.d.ts +13 -0
- package/dist/entities/StoreShifts.js +56 -0
- package/dist/entities/Stores.d.ts +25 -0
- package/dist/entities/Stores.js +92 -0
- package/dist/entities/Task.d.ts +19 -0
- package/dist/entities/Task.js +79 -0
- package/dist/entities/TaskAttachment.d.ts +9 -0
- package/dist/entities/TaskAttachment.js +41 -0
- package/dist/entities/TermsAndCondition.d.ts +9 -0
- package/dist/entities/TermsAndCondition.js +43 -0
- package/dist/entities/UplaodedImages.d.ts +10 -0
- package/dist/entities/UplaodedImages.js +52 -0
- package/dist/entities/UserDetails.d.ts +22 -0
- package/dist/entities/UserDetails.js +97 -0
- package/dist/entities/UserLocations.d.ts +13 -0
- package/dist/entities/UserLocations.js +62 -0
- package/dist/entities/UserQuestionAttemptHistory.d.ts +13 -0
- package/dist/entities/UserQuestionAttemptHistory.js +54 -0
- package/dist/entities/UserRoster.d.ts +17 -0
- package/dist/entities/UserRoster.js +73 -0
- package/dist/entities/UserRosterChanges.d.ts +14 -0
- package/dist/entities/UserRosterChanges.js +59 -0
- package/dist/entities/UserStoreChangedHistory.d.ts +12 -0
- package/dist/entities/UserStoreChangedHistory.js +56 -0
- package/dist/entities/UserVideosAttemptsHistory.d.ts +17 -0
- package/dist/entities/UserVideosAttemptsHistory.js +76 -0
- package/dist/entities/Users.d.ts +92 -0
- package/dist/entities/Users.js +301 -0
- package/dist/entities/Versions.d.ts +15 -0
- package/dist/entities/Versions.js +67 -0
- package/dist/entities/Videos.d.ts +17 -0
- package/dist/entities/Videos.js +62 -0
- package/dist/entities/automation_executions.entity.d.ts +7 -0
- package/dist/entities/automation_executions.entity.js +39 -0
- package/dist/entities/automations.entity.d.ts +16 -0
- package/dist/entities/automations.entity.js +75 -0
- package/dist/entities/entitiesV2/Inventory.d.ts +14 -0
- package/dist/entities/entitiesV2/Inventory.js +60 -0
- package/dist/entities/entitiesV2/InventoryDetails.d.ts +20 -0
- package/dist/entities/entitiesV2/InventoryDetails.js +80 -0
- package/dist/entities/entitiesV2/StockRequest.d.ts +22 -0
- package/dist/entities/entitiesV2/StockRequest.js +88 -0
- package/dist/entities/entitiesV2/StockRequestDetails.d.ts +20 -0
- package/dist/entities/entitiesV2/StockRequestDetails.js +78 -0
- package/dist/entities/fcm.entity.d.ts +9 -0
- package/dist/entities/fcm.entity.js +41 -0
- package/dist/entities/index.d.ts +61 -0
- package/dist/entities/index.js +126 -0
- package/dist/entities/notification-user-history.entity.d.ts +16 -0
- package/dist/entities/notification-user-history.entity.js +68 -0
- package/dist/entities/out-of-range.entity.d.ts +11 -0
- package/dist/entities/out-of-range.entity.js +49 -0
- package/dist/entities/permission-policy.entity.d.ts +7 -0
- package/dist/entities/permission-policy.entity.js +40 -0
- package/dist/entities/target.d.ts +17 -0
- package/dist/entities/target.js +72 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/package.json +17 -0
- package/src/constants/alert-messages.ts +10 -0
- package/src/constants/common.option.ts +8 -0
- package/src/constants/context.option.ts +4 -0
- package/src/constants/date-time.option.ts +19 -0
- package/src/constants/encryption.option.ts +4 -0
- package/src/constants/events.option.ts +6 -0
- package/src/constants/roles.option.ts +8 -0
- package/src/constants/status-code.option.ts +43 -0
- package/src/entities/AchievementHistory.ts +37 -0
- package/src/entities/AlertMessages.ts +33 -0
- package/src/entities/Analysis.ts +53 -0
- package/src/entities/Answers.ts +36 -0
- package/src/entities/ApiResponses.ts +45 -0
- package/src/entities/Attachments.ts +81 -0
- package/src/entities/AttendanceDetails.ts +86 -0
- package/src/entities/BeatPlanCheckIns.ts +82 -0
- package/src/entities/BeatPlanVisits.ts +88 -0
- package/src/entities/BranchManagerBrandsMappings.ts +41 -0
- package/src/entities/BranchManagerMerchandiserMappings.ts +65 -0
- package/src/entities/BrandWiseCategory.ts +32 -0
- package/src/entities/Brands.ts +73 -0
- package/src/entities/Category.ts +57 -0
- package/src/entities/DamagedProductsRequests.ts +44 -0
- package/src/entities/DamagedProductsRequestsDetails.ts +65 -0
- package/src/entities/Enum/ImageType.ts +8 -0
- package/src/entities/Enum/LogType.ts +10 -0
- package/src/entities/Enum/Months.ts +14 -0
- package/src/entities/Enum/UserRole.ts +14 -0
- package/src/entities/Enum/UserRosterAssignStatus.ts +8 -0
- package/src/entities/Inventory.ts +50 -0
- package/src/entities/InventoryDetails.ts +63 -0
- package/src/entities/LeaveRequests.ts +61 -0
- package/src/entities/LeaveTypes.ts +38 -0
- package/src/entities/LoginHistory.ts +70 -0
- package/src/entities/Notifications.ts +62 -0
- package/src/entities/Offer.ts +35 -0
- package/src/entities/OfferLaunch.ts +31 -0
- package/src/entities/POSMMaterials.ts +33 -0
- package/src/entities/POSMRequest.ts +41 -0
- package/src/entities/POSMRequestDetails.ts +59 -0
- package/src/entities/PasswordManager.ts +44 -0
- package/src/entities/Products.ts +145 -0
- package/src/entities/Question.ts +57 -0
- package/src/entities/Roles.ts +36 -0
- package/src/entities/SalesPunch.ts +63 -0
- package/src/entities/SalesPunchingAIAnalysis.ts +36 -0
- package/src/entities/Schemes.ts +39 -0
- package/src/entities/Shifts.ts +41 -0
- package/src/entities/StockRequest.ts +68 -0
- package/src/entities/StockRequestDetails.ts +63 -0
- package/src/entities/StoreBrandsMapping.ts +44 -0
- package/src/entities/StoreShifts.ts +46 -0
- package/src/entities/Stores.ts +68 -0
- package/src/entities/Task.ts +60 -0
- package/src/entities/TaskAttachment.ts +29 -0
- package/src/entities/TermsAndCondition.ts +29 -0
- package/src/entities/UplaodedImages.ts +37 -0
- package/src/entities/UserDetails.ts +74 -0
- package/src/entities/UserLocations.ts +49 -0
- package/src/entities/UserQuestionAttemptHistory.ts +49 -0
- package/src/entities/UserRoster.ts +58 -0
- package/src/entities/UserRosterChanges.ts +44 -0
- package/src/entities/UserStoreChangedHistory.ts +40 -0
- package/src/entities/UserVideosAttemptsHistory.ts +64 -0
- package/src/entities/Users.ts +259 -0
- package/src/entities/Versions.ts +47 -0
- package/src/entities/Videos.ts +48 -0
- package/src/entities/automation_executions.entity.ts +24 -0
- package/src/entities/automations.entity.ts +60 -0
- package/src/entities/entitiesV2/Inventory.ts +51 -0
- package/src/entities/entitiesV2/InventoryDetails.ts +63 -0
- package/src/entities/entitiesV2/StockRequest.ts +68 -0
- package/src/entities/entitiesV2/StockRequestDetails.ts +63 -0
- package/src/entities/fcm.entity.ts +30 -0
- package/src/entities/index.ts +61 -0
- package/src/entities/notification-user-history.entity.ts +51 -0
- package/src/entities/out-of-range.entity.ts +36 -0
- package/src/entities/permission-policy.entity.ts +25 -0
- package/src/entities/target.ts +54 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
JoinColumn,
|
|
8
|
+
ManyToOne,
|
|
9
|
+
OneToMany,
|
|
10
|
+
PrimaryGeneratedColumn,
|
|
11
|
+
UpdateDateColumn,
|
|
12
|
+
} from 'typeorm';
|
|
13
|
+
import { AttendanceDetails } from './AttendanceDetails';
|
|
14
|
+
import { BranchManagerBrandsMappings } from './BranchManagerBrandsMappings';
|
|
15
|
+
import { BranchManagerMerchandiserMappings } from './BranchManagerMerchandiserMappings';
|
|
16
|
+
import { LoginHistory } from './LoginHistory';
|
|
17
|
+
import { PasswordManager } from './PasswordManager';
|
|
18
|
+
import { UserDetails } from './UserDetails';
|
|
19
|
+
import { Roles } from './Roles';
|
|
20
|
+
import { Inventory } from './Inventory';
|
|
21
|
+
import { StockRequest } from './StockRequest';
|
|
22
|
+
import { Target } from './target';
|
|
23
|
+
import { SalesPunching } from './SalesPunch';
|
|
24
|
+
import { Analysis } from './Analysis';
|
|
25
|
+
import { Task } from './Task';
|
|
26
|
+
import { AchievementHistory } from './AchievementHistory';
|
|
27
|
+
import { UsersVideosAttemptsHistory } from './UserVideosAttemptsHistory';
|
|
28
|
+
import { UsersQuestionsAttemptsHistory } from './UserQuestionAttemptHistory';
|
|
29
|
+
import { POSMRequest } from './POSMRequest';
|
|
30
|
+
import { FCM } from './fcm.entity';
|
|
31
|
+
import { OutOfRange } from './out-of-range.entity';
|
|
32
|
+
import { Brands } from './Brands';
|
|
33
|
+
import { DamagedProductsRequest } from './DamagedProductsRequests';
|
|
34
|
+
import { UserRosters } from './UserRoster';
|
|
35
|
+
import { UsersRosterChangeLogs } from './UserRosterChanges';
|
|
36
|
+
import { Stores } from './Stores';
|
|
37
|
+
import { BeatPlanVisits } from './BeatPlanVisits';
|
|
38
|
+
import { BeatPlanCheckins } from './BeatPlanCheckIns';
|
|
39
|
+
import { UserLocations } from './UserLocations';
|
|
40
|
+
|
|
41
|
+
// @Index("gst_number_UNIQUE", ["gstNumber"], { unique: true })
|
|
42
|
+
// @Index("IDX_63a0997ffb425135736bb524ea", ["gstNumber"], { unique: true })
|
|
43
|
+
// @Index("IDX_695f19ce860bd926335e85c3e8", ["panNumber"], { unique: true })
|
|
44
|
+
// @Index("pan_number_UNIQUE", ["panNumber"], { unique: true })
|
|
45
|
+
@Index('users_ibfk_1', ['roleId'], {})
|
|
46
|
+
@Index('IDX_users_name', ['name'])
|
|
47
|
+
|
|
48
|
+
@Entity('users')
|
|
49
|
+
export class Users extends BaseEntity {
|
|
50
|
+
@PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
|
|
51
|
+
id!: string;
|
|
52
|
+
|
|
53
|
+
@Column('bigint', { name: 'role_id', nullable: true })
|
|
54
|
+
roleId?: string | null;
|
|
55
|
+
|
|
56
|
+
@Column('varchar', { name: 'name', nullable: true, length: 255 })
|
|
57
|
+
name?: string | null;
|
|
58
|
+
|
|
59
|
+
@Column('varchar', { name: 'lat', nullable: true, length: 255 })
|
|
60
|
+
lat?: string | null;
|
|
61
|
+
|
|
62
|
+
@Column('varchar', { name: 'radius', default: null })
|
|
63
|
+
radius?: string | null;
|
|
64
|
+
|
|
65
|
+
@Column('varchar', { name: 'long', nullable: true, length: 255 })
|
|
66
|
+
long?: string | null;
|
|
67
|
+
|
|
68
|
+
@Column('text', { name: 'map_link', nullable: true })
|
|
69
|
+
map_link?: string | null;
|
|
70
|
+
|
|
71
|
+
@Column('varchar', { name: 'salutation', nullable: true, length: 255 })
|
|
72
|
+
salutation?: string;
|
|
73
|
+
|
|
74
|
+
@Column('varchar', {
|
|
75
|
+
name: 'uuid',
|
|
76
|
+
nullable: true,
|
|
77
|
+
length: 255,
|
|
78
|
+
unique: true,
|
|
79
|
+
})
|
|
80
|
+
uuid?: string | null;
|
|
81
|
+
|
|
82
|
+
@Column({ type: 'varchar', name: 'code', nullable: true, length: 255 })
|
|
83
|
+
code?: string;
|
|
84
|
+
|
|
85
|
+
@Column({ type: 'bigint', name: 'mobile', nullable: false, unique: true })
|
|
86
|
+
mobile?: string;
|
|
87
|
+
|
|
88
|
+
@Column({ type: 'varchar', name: 'email', nullable: false, length: 255, unique: true })
|
|
89
|
+
email!: string;
|
|
90
|
+
|
|
91
|
+
@Column({ type: 'text', name: 'password', nullable: false })
|
|
92
|
+
password!: string;
|
|
93
|
+
|
|
94
|
+
@Column({ type: 'text', name: 'text', nullable: true })
|
|
95
|
+
profile_image!: string;
|
|
96
|
+
|
|
97
|
+
@Column({ type: 'tinyint', name: 'active', nullable: true })
|
|
98
|
+
active?: number | null;
|
|
99
|
+
|
|
100
|
+
@Column({ type: 'tinyint', name: 'flag', nullable: true })
|
|
101
|
+
flag?: number | null;
|
|
102
|
+
|
|
103
|
+
@Column({ type: 'tinyint', name: 'profile_updated', nullable: true })
|
|
104
|
+
profileUpdated?: number | null;
|
|
105
|
+
|
|
106
|
+
@CreateDateColumn({ type: 'datetime' })
|
|
107
|
+
created_at!: Date;
|
|
108
|
+
|
|
109
|
+
@UpdateDateColumn({ type: 'datetime' })
|
|
110
|
+
updated_at!: Date;
|
|
111
|
+
|
|
112
|
+
@Column({ type: 'varchar', name: 'gst_number', nullable: true, unique: true, length: 255 })
|
|
113
|
+
gstNumber?: string | null;
|
|
114
|
+
|
|
115
|
+
@Column({ type: 'varchar', name: 'pan_number', nullable: true, unique: true, length: 255 })
|
|
116
|
+
panNumber?: string | null;
|
|
117
|
+
|
|
118
|
+
@Column({ type: 'varchar', name: 'refresh_token', nullable: true, length: 255 })
|
|
119
|
+
refreshToken?: string | null;
|
|
120
|
+
|
|
121
|
+
@Column({ type: 'timestamp', name: 'refresh_token_expiry', nullable: true })
|
|
122
|
+
refreshTokenExpiry?: Date | null;
|
|
123
|
+
|
|
124
|
+
@Column({ type: 'varchar', name: 'date_of_birth', nullable: true, length: 255 })
|
|
125
|
+
dateOfBirth: string | null;
|
|
126
|
+
|
|
127
|
+
@Column({ type: 'tinyint', name: 'status', default: 1 })
|
|
128
|
+
status?: number;
|
|
129
|
+
|
|
130
|
+
@OneToMany(() => AttendanceDetails, (attendanceDetails) => attendanceDetails.user)
|
|
131
|
+
attendanceDetails?: AttendanceDetails[];
|
|
132
|
+
|
|
133
|
+
@OneToMany(() => UserLocations, (location) => location.user)
|
|
134
|
+
userLocations!: UserLocations[];
|
|
135
|
+
|
|
136
|
+
@OneToMany(
|
|
137
|
+
() => BranchManagerBrandsMappings,
|
|
138
|
+
(branchManagerBrandsMappings) => branchManagerBrandsMappings.branchManager
|
|
139
|
+
)
|
|
140
|
+
branchManagerBrandsMappings: BranchManagerBrandsMappings[];
|
|
141
|
+
|
|
142
|
+
@OneToMany(() => BranchManagerMerchandiserMappings, (mapping) => mapping.branchManager)
|
|
143
|
+
branchManagerMappings!: BranchManagerMerchandiserMappings[];
|
|
144
|
+
|
|
145
|
+
@OneToMany(() => BranchManagerMerchandiserMappings, (mapping) => mapping.merchandiser)
|
|
146
|
+
merchandiserMappings!: BranchManagerMerchandiserMappings[];
|
|
147
|
+
|
|
148
|
+
@OneToMany(() => LoginHistory, (loginHistory) => loginHistory.user)
|
|
149
|
+
loginHistories?: LoginHistory[];
|
|
150
|
+
|
|
151
|
+
@OneToMany(() => Inventory, (inventory) => inventory.user)
|
|
152
|
+
inventory?: Inventory[];
|
|
153
|
+
|
|
154
|
+
@OneToMany(() => StockRequest, (stockRequest) => stockRequest.user)
|
|
155
|
+
stockrequest?: StockRequest[];
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@OneToMany(() => Inventory, (inventory) => inventory.createdBy)
|
|
159
|
+
inventoryCreatedBy?: Inventory[];
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
// @OneToMany(() => StockRequest, (stockRequest) => stockRequest.createdBy)
|
|
163
|
+
// stockrequestCreatedBy?: StockRequest[];
|
|
164
|
+
|
|
165
|
+
@OneToMany(() => POSMRequest, (posmRequest) => posmRequest.user)
|
|
166
|
+
posmrequest?: POSMRequest[];
|
|
167
|
+
|
|
168
|
+
@OneToMany(() => DamagedProductsRequest, (damagedProductsRequest) => damagedProductsRequest.user)
|
|
169
|
+
damagedProductRequest?: DamagedProductsRequest[];
|
|
170
|
+
|
|
171
|
+
@OneToMany(() => Target, (target) => target.users)
|
|
172
|
+
targets!: Target[];
|
|
173
|
+
|
|
174
|
+
@OneToMany(() => PasswordManager, (passwordManager) => passwordManager.user)
|
|
175
|
+
passwordManagers?: PasswordManager[];
|
|
176
|
+
|
|
177
|
+
@OneToMany(() => UserDetails, (userDetails) => userDetails.user)
|
|
178
|
+
userDetails?: UserDetails[];
|
|
179
|
+
|
|
180
|
+
@ManyToOne(() => Roles, (roles) => roles.users, {
|
|
181
|
+
onDelete: 'NO ACTION',
|
|
182
|
+
onUpdate: 'NO ACTION',
|
|
183
|
+
})
|
|
184
|
+
@JoinColumn([{ name: 'role_id', referencedColumnName: 'id' }])
|
|
185
|
+
role?: Roles;
|
|
186
|
+
|
|
187
|
+
@OneToMany(() => SalesPunching, (salesPunching) => salesPunching.users)
|
|
188
|
+
salesPuching: SalesPunching[];
|
|
189
|
+
|
|
190
|
+
@OneToMany(() => Analysis, (analysis) => analysis.user)
|
|
191
|
+
analysis?: Analysis[];
|
|
192
|
+
|
|
193
|
+
@OneToMany(() => Analysis, (analysis) => analysis.createdBy)
|
|
194
|
+
analysisCreatedBy?: Analysis[];
|
|
195
|
+
|
|
196
|
+
@OneToMany(() => Task, (task) => task.sales)
|
|
197
|
+
taskAssignBY?: Task[];
|
|
198
|
+
|
|
199
|
+
@OneToMany(() => Task, (task) => task.user)
|
|
200
|
+
taskAssignTo?: Task[];
|
|
201
|
+
|
|
202
|
+
@OneToMany(() => AchievementHistory, (achievementHistory) => achievementHistory.user)
|
|
203
|
+
AchHistory!: AchievementHistory[];
|
|
204
|
+
|
|
205
|
+
/** One User → Many Video Attempts */
|
|
206
|
+
@OneToMany(() => UsersVideosAttemptsHistory, (attempt) => attempt.user)
|
|
207
|
+
videoAttempts!: UsersVideosAttemptsHistory[];
|
|
208
|
+
|
|
209
|
+
/** One User → Many Question Attempts */
|
|
210
|
+
@OneToMany(() => UsersQuestionsAttemptsHistory, (attempt) => attempt.user)
|
|
211
|
+
questionAttempts!: UsersQuestionsAttemptsHistory[];
|
|
212
|
+
|
|
213
|
+
@OneToMany(() => FCM, (fcm) => fcm.user)
|
|
214
|
+
fcm!: FCM[];
|
|
215
|
+
|
|
216
|
+
@OneToMany(() => OutOfRange, (oor) => oor.user)
|
|
217
|
+
outOfRange!: OutOfRange[];
|
|
218
|
+
|
|
219
|
+
@ManyToOne(() => Brands, (brands) => brands.user, {
|
|
220
|
+
onDelete: 'NO ACTION',
|
|
221
|
+
onUpdate: 'NO ACTION',
|
|
222
|
+
})
|
|
223
|
+
@JoinColumn([{ name: 'brand_id' }])
|
|
224
|
+
brand?: Brands;
|
|
225
|
+
|
|
226
|
+
@OneToMany(() => UserRosters, (roster) => roster.user)
|
|
227
|
+
userRosters!: UserRosters[];
|
|
228
|
+
|
|
229
|
+
@OneToMany(() => UsersRosterChangeLogs, (log) => log.changed_by)
|
|
230
|
+
rosterChangeLogs!: UsersRosterChangeLogs[];
|
|
231
|
+
|
|
232
|
+
@ManyToOne(() => Stores, (store) => store.users, {
|
|
233
|
+
nullable: true,
|
|
234
|
+
onDelete: 'SET NULL',
|
|
235
|
+
})
|
|
236
|
+
@JoinColumn({ name: 'store_id' })
|
|
237
|
+
store?: Stores;
|
|
238
|
+
|
|
239
|
+
@Column({ type: 'bigint', name: 'store_id', nullable: true })
|
|
240
|
+
storeId?: string;
|
|
241
|
+
|
|
242
|
+
@OneToMany(() => BeatPlanVisits, (visit) => visit.assignedToUser)
|
|
243
|
+
beatPlanVisitsAssignedTo!: BeatPlanVisits[];
|
|
244
|
+
|
|
245
|
+
/** One User → Many Beat Plan Visits where they are the assigner (admin/brand admin) */
|
|
246
|
+
@OneToMany(() => BeatPlanVisits, (visit) => visit.assignedByUser)
|
|
247
|
+
beatPlanVisitsAssignedBy!: BeatPlanVisits[];
|
|
248
|
+
|
|
249
|
+
/** One User → Many Beat Plan Check-ins */
|
|
250
|
+
@OneToMany(() => BeatPlanCheckins, (checkin) => checkin.user)
|
|
251
|
+
beatPlanCheckins!: BeatPlanCheckins[];
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
// @ManyToOne(() => Users, (users) => users.inventoryCreatedBy)
|
|
256
|
+
// @JoinColumn({ name: 'created_by' })
|
|
257
|
+
// createdBy: Users;
|
|
258
|
+
|
|
259
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
CreateDateColumn,
|
|
6
|
+
UpdateDateColumn,
|
|
7
|
+
BaseEntity,
|
|
8
|
+
} from 'typeorm';
|
|
9
|
+
|
|
10
|
+
@Entity('version')
|
|
11
|
+
export class Version extends BaseEntity {
|
|
12
|
+
@PrimaryGeneratedColumn('increment', { type: 'bigint' })
|
|
13
|
+
id!: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', length: 80, nullable: false })
|
|
16
|
+
android_old!: string;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'varchar', length: 80, nullable: false })
|
|
19
|
+
android_new!: string;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'varchar', length: 80, nullable: false })
|
|
22
|
+
ios_old!: string;
|
|
23
|
+
|
|
24
|
+
@Column({ type: 'varchar', length: 80, nullable: false })
|
|
25
|
+
ios_new!: string;
|
|
26
|
+
|
|
27
|
+
@Column({ type: 'varchar', length: 225, nullable: true })
|
|
28
|
+
android_type?: string;
|
|
29
|
+
|
|
30
|
+
@Column({ type: 'varchar', length: 225, nullable: true })
|
|
31
|
+
ios_type?: string;
|
|
32
|
+
|
|
33
|
+
@Column({ type: 'boolean', nullable: false })
|
|
34
|
+
force_update?: boolean;
|
|
35
|
+
|
|
36
|
+
@Column({ type: 'varchar', length: 225, nullable: true })
|
|
37
|
+
comment?: string;
|
|
38
|
+
|
|
39
|
+
@Column({ type: 'varchar', length: 225, nullable: true })
|
|
40
|
+
url?: string;
|
|
41
|
+
|
|
42
|
+
@CreateDateColumn({ name: 'created_at', type: 'timestamp' })
|
|
43
|
+
createdAt!: Date;
|
|
44
|
+
|
|
45
|
+
@UpdateDateColumn({ name: 'updated_at', type: 'timestamp' })
|
|
46
|
+
updatedAt!: Date;
|
|
47
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
OneToMany,
|
|
8
|
+
PrimaryGeneratedColumn,
|
|
9
|
+
UpdateDateColumn,
|
|
10
|
+
} from 'typeorm';
|
|
11
|
+
import { UsersVideosAttemptsHistory } from './UserVideosAttemptsHistory';
|
|
12
|
+
import { Questions } from './Question';
|
|
13
|
+
|
|
14
|
+
@Entity('videos')
|
|
15
|
+
@Index('IDX_videos_status_id', ['status', 'id'])
|
|
16
|
+
export class Videos extends BaseEntity {
|
|
17
|
+
@PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
|
|
18
|
+
id!: string;
|
|
19
|
+
|
|
20
|
+
@Column('varchar', { name: 'name', nullable: true, length: 255 })
|
|
21
|
+
name: string;
|
|
22
|
+
|
|
23
|
+
@Column('varchar', { name: 'url', nullable: false, length: 255 })
|
|
24
|
+
url?: string;
|
|
25
|
+
|
|
26
|
+
@Column('varchar', { name: 'thumbnail', nullable: false, length: 255 })
|
|
27
|
+
thumbnail?: string;
|
|
28
|
+
|
|
29
|
+
@Column('varchar', { name: 'duration', nullable: false, length: 255 })
|
|
30
|
+
duration?: string;
|
|
31
|
+
|
|
32
|
+
@Column('tinyint', { name: 'status', default: 1 })
|
|
33
|
+
status?: number;
|
|
34
|
+
|
|
35
|
+
@CreateDateColumn({ type: 'datetime' })
|
|
36
|
+
created_at!: Date;
|
|
37
|
+
|
|
38
|
+
@UpdateDateColumn({ type: 'datetime' })
|
|
39
|
+
updated_at!: Date;
|
|
40
|
+
|
|
41
|
+
/** One Video → Many Attempt Histories */
|
|
42
|
+
@OneToMany(() => UsersVideosAttemptsHistory, (attempt) => attempt.video)
|
|
43
|
+
attempts!: UsersVideosAttemptsHistory[];
|
|
44
|
+
|
|
45
|
+
/** One Video → Many Questions */
|
|
46
|
+
@OneToMany(() => Questions, (question) => question.video)
|
|
47
|
+
questions!: Questions[];
|
|
48
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@Entity('automation_execution_logs')
|
|
5
|
+
export class AutomationExecutions {
|
|
6
|
+
@PrimaryGeneratedColumn({ type: 'bigint' })
|
|
7
|
+
id: number;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@Column({ type: 'bigint' })
|
|
11
|
+
automation_id: number;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@Column({ type: 'datetime' })
|
|
15
|
+
executed_at: Date;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'enum', enum: ['SUCCESS', 'FAILED', 'SKIPPED'] })
|
|
19
|
+
status: 'SUCCESS' | 'FAILED' | 'SKIPPED';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@Column({ type: 'text', nullable: true })
|
|
23
|
+
remarks?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@Entity('automations')
|
|
5
|
+
export class Automations{
|
|
6
|
+
@PrimaryGeneratedColumn({ type: 'bigint' })
|
|
7
|
+
id: number;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@Column({ type: 'varchar', length: 100, unique: true })
|
|
11
|
+
automation_code: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@Column({ type: 'varchar', length: 255 })
|
|
15
|
+
name: string;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'text', nullable: true })
|
|
19
|
+
description?: string;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@Column({ type: 'enum', enum: ['TIME_BASED', 'EVENT_BASED', 'HYBRID'] })
|
|
23
|
+
type: 'TIME_BASED' | 'EVENT_BASED' | 'HYBRID';
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@Column({ type: 'json' })
|
|
27
|
+
trigger_condition: Record<string, any>;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@Column({ type: 'json' })
|
|
31
|
+
action: Record<string, any>;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
35
|
+
recurrence_rule?: string;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@Column({ type: 'int', default: 0 })
|
|
39
|
+
time_offset_minutes: number;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@Column({ type: 'varchar', length: 64, default: 'Asia/Kolkata' })
|
|
43
|
+
timezone: string;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@Column({ type: 'boolean', default: true })
|
|
47
|
+
is_active: boolean;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@Column({ type: 'bigint' })
|
|
51
|
+
created_by: number;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@CreateDateColumn()
|
|
55
|
+
created_at: Date;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@UpdateDateColumn()
|
|
59
|
+
updated_at: Date;
|
|
60
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Inventory.ts
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BaseEntity,
|
|
6
|
+
Column,
|
|
7
|
+
CreateDateColumn,
|
|
8
|
+
Entity,
|
|
9
|
+
JoinColumn,
|
|
10
|
+
ManyToOne,
|
|
11
|
+
OneToMany,
|
|
12
|
+
PrimaryGeneratedColumn,
|
|
13
|
+
UpdateDateColumn,
|
|
14
|
+
} from 'typeorm';
|
|
15
|
+
import { Users } from '../Users';
|
|
16
|
+
import { InventoryDetails } from './InventoryDetails';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@Entity('inventory') // final table name
|
|
21
|
+
export class Inventory extends BaseEntity {
|
|
22
|
+
// copy body from StockRequestOld
|
|
23
|
+
@PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
|
|
24
|
+
id!: string;
|
|
25
|
+
|
|
26
|
+
@Column('bigint', { name: 'user_id', nullable: true })
|
|
27
|
+
userId?: string | null;
|
|
28
|
+
|
|
29
|
+
@Column({ type: 'datetime', nullable: true })
|
|
30
|
+
date!: Date;
|
|
31
|
+
|
|
32
|
+
@Column('tinyint', { name: 'status', nullable: true, default: 0 })
|
|
33
|
+
status?: number;
|
|
34
|
+
|
|
35
|
+
@CreateDateColumn({ type: 'datetime' })
|
|
36
|
+
created_at!: Date;
|
|
37
|
+
|
|
38
|
+
@UpdateDateColumn({ type: 'datetime' })
|
|
39
|
+
updated_at!: Date;
|
|
40
|
+
|
|
41
|
+
@ManyToOne(() => Users, (user) => user.inventory)
|
|
42
|
+
@JoinColumn({ name: 'user_id', referencedColumnName: 'id' })
|
|
43
|
+
user?: Users;
|
|
44
|
+
|
|
45
|
+
@OneToMany(() => InventoryDetails, (d) => d.inventory)
|
|
46
|
+
inventoryDetails?: InventoryDetails[];
|
|
47
|
+
|
|
48
|
+
@ManyToOne(() => Users, (users) => users.inventoryCreatedBy)
|
|
49
|
+
@JoinColumn({ name: 'created_by' })
|
|
50
|
+
createdBy: Users;
|
|
51
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BaseEntity,
|
|
6
|
+
Column,
|
|
7
|
+
CreateDateColumn,
|
|
8
|
+
Entity,
|
|
9
|
+
JoinColumn,
|
|
10
|
+
ManyToOne,
|
|
11
|
+
OneToOne,
|
|
12
|
+
PrimaryGeneratedColumn,
|
|
13
|
+
UpdateDateColumn,
|
|
14
|
+
} from 'typeorm';
|
|
15
|
+
import { Inventory } from './Inventory';
|
|
16
|
+
import { Brands } from '../Brands';
|
|
17
|
+
import { Product } from '../Products';
|
|
18
|
+
import { Attachement } from '../Attachments';
|
|
19
|
+
|
|
20
|
+
@Entity('inventory_details') // final table name
|
|
21
|
+
export class InventoryDetails extends BaseEntity {
|
|
22
|
+
@PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
|
|
23
|
+
id!: string;
|
|
24
|
+
|
|
25
|
+
@Column('bigint', { name: 'inventory_id', nullable: true }) // renamed FK
|
|
26
|
+
inventoryId?: string | null;
|
|
27
|
+
|
|
28
|
+
@Column('bigint', { name: 'brand_id', nullable: true })
|
|
29
|
+
brandId?: string | null;
|
|
30
|
+
|
|
31
|
+
@Column('bigint', { name: 'product_id', nullable: true })
|
|
32
|
+
productId?: string | null;
|
|
33
|
+
|
|
34
|
+
@Column({ type: 'datetime', nullable: true })
|
|
35
|
+
date!: Date;
|
|
36
|
+
|
|
37
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
38
|
+
quantity!: number;
|
|
39
|
+
|
|
40
|
+
@Column('tinyint', { name: 'status', nullable: true, default: 0 })
|
|
41
|
+
status?: number;
|
|
42
|
+
|
|
43
|
+
@CreateDateColumn({ type: 'datetime' })
|
|
44
|
+
created_at!: Date;
|
|
45
|
+
|
|
46
|
+
@UpdateDateColumn({ type: 'datetime' })
|
|
47
|
+
updated_at!: Date;
|
|
48
|
+
|
|
49
|
+
@ManyToOne(() => Inventory, (inventory) => inventory.inventoryDetails)
|
|
50
|
+
@JoinColumn([{ name: 'inventory_id' }]) // FK column
|
|
51
|
+
inventory?: Inventory;
|
|
52
|
+
|
|
53
|
+
@ManyToOne(() => Brands, (brand) => brand.product)
|
|
54
|
+
@JoinColumn([{ name: 'brand_id' }])
|
|
55
|
+
brand?: Brands;
|
|
56
|
+
|
|
57
|
+
@ManyToOne(() => Product, (product) => product.id)
|
|
58
|
+
@JoinColumn([{ name: 'product_id' }])
|
|
59
|
+
product?: Product;
|
|
60
|
+
|
|
61
|
+
@OneToOne(() => Attachement, (attachment) => attachment.inventoryDetails)
|
|
62
|
+
attachment?: Attachement;
|
|
63
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { StockRequestDetails } from './StockRequestDetails';
|
|
14
|
+
import { BeatPlanVisits } from '../BeatPlanVisits';
|
|
15
|
+
|
|
16
|
+
@Entity('stock') // final table name after migration
|
|
17
|
+
export class StockRequest extends BaseEntity {
|
|
18
|
+
// copy body from InventoryOld
|
|
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('tinyint', { name: 'status', nullable: true, default: 0 })
|
|
26
|
+
status?: number;
|
|
27
|
+
|
|
28
|
+
@CreateDateColumn({ type: 'datetime' })
|
|
29
|
+
created_at!: Date;
|
|
30
|
+
|
|
31
|
+
@UpdateDateColumn({ type: 'datetime' })
|
|
32
|
+
updated_at!: Date;
|
|
33
|
+
|
|
34
|
+
@ManyToOne(() => Users, (user) => user.stockrequest)
|
|
35
|
+
@JoinColumn({ name: 'user_id', referencedColumnName: 'id' })
|
|
36
|
+
user?: Users;
|
|
37
|
+
|
|
38
|
+
@Column('varchar', { name: 'latitude', nullable: true, length: 255 })
|
|
39
|
+
latitude?: string;
|
|
40
|
+
|
|
41
|
+
@Column('varchar', { name: 'longitude', nullable: true, length: 255 })
|
|
42
|
+
longitude?: string;
|
|
43
|
+
|
|
44
|
+
@OneToMany(() => StockRequestDetails, (d) => d.stockRequest)
|
|
45
|
+
stockRequestDetails?: StockRequestDetails[];
|
|
46
|
+
|
|
47
|
+
@ManyToOne(() => BeatPlanVisits, (visit) => visit.stockRequests)
|
|
48
|
+
@JoinColumn({ name: 'beat_plan_visits_id' })
|
|
49
|
+
beatPlanVisit!: BeatPlanVisits;
|
|
50
|
+
|
|
51
|
+
@Column('varchar', { name: 'full_address', nullable: true, length: 500 })
|
|
52
|
+
fullAddress?: string | null;
|
|
53
|
+
|
|
54
|
+
@Column('varchar', { name: 'city', nullable: true, length: 255 })
|
|
55
|
+
city?: string | null;
|
|
56
|
+
|
|
57
|
+
@Column('varchar', { name: 'state', nullable: true, length: 255 })
|
|
58
|
+
state?: string | null;
|
|
59
|
+
|
|
60
|
+
@Column('varchar', { name: 'pincode', nullable: true, length: 20 })
|
|
61
|
+
pincode?: string | null;
|
|
62
|
+
|
|
63
|
+
@Column('varchar', { name: 'country', nullable: true, length: 255 })
|
|
64
|
+
country?: string | null;
|
|
65
|
+
|
|
66
|
+
@Column('varchar', { name: 'area', nullable: true, length: 255 })
|
|
67
|
+
area?: string | null;
|
|
68
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BaseEntity,
|
|
5
|
+
Column,
|
|
6
|
+
CreateDateColumn,
|
|
7
|
+
Entity,
|
|
8
|
+
JoinColumn,
|
|
9
|
+
ManyToOne,
|
|
10
|
+
OneToOne,
|
|
11
|
+
PrimaryGeneratedColumn,
|
|
12
|
+
UpdateDateColumn,
|
|
13
|
+
} from 'typeorm';
|
|
14
|
+
import { StockRequest } from './StockRequest';
|
|
15
|
+
import { Brands } from '../Brands';
|
|
16
|
+
import { Product } from '../Products';
|
|
17
|
+
import { Attachement } from '../Attachments';
|
|
18
|
+
|
|
19
|
+
@Entity('stock_details') // final table name
|
|
20
|
+
export class StockRequestDetails extends BaseEntity {
|
|
21
|
+
// copy from InventoryDetailsOld
|
|
22
|
+
@PrimaryGeneratedColumn({ type: 'bigint', name: 'id' })
|
|
23
|
+
id!: string;
|
|
24
|
+
|
|
25
|
+
@Column('bigint', { name: 'stock_request_id', nullable: true })
|
|
26
|
+
stockRequestId?: string | null;
|
|
27
|
+
|
|
28
|
+
@Column('bigint', { name: 'brand_id', nullable: true })
|
|
29
|
+
brandId?: string | null;
|
|
30
|
+
|
|
31
|
+
@Column('bigint', { name: 'product_id', nullable: true })
|
|
32
|
+
productId?: string | null;
|
|
33
|
+
|
|
34
|
+
@Column({ type: 'datetime', nullable: true })
|
|
35
|
+
date!: Date;
|
|
36
|
+
|
|
37
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
38
|
+
quantity!: number;
|
|
39
|
+
|
|
40
|
+
@Column('tinyint', { name: 'status', nullable: true, default: 0 })
|
|
41
|
+
status?: number;
|
|
42
|
+
|
|
43
|
+
@CreateDateColumn({ type: 'datetime' })
|
|
44
|
+
created_at!: Date;
|
|
45
|
+
|
|
46
|
+
@UpdateDateColumn({ type: 'datetime' })
|
|
47
|
+
updated_at!: Date;
|
|
48
|
+
|
|
49
|
+
@ManyToOne(() => StockRequest, (sr) => sr.stockRequestDetails)
|
|
50
|
+
@JoinColumn({ name: 'stock_request_id' })
|
|
51
|
+
stockRequest!: StockRequest;
|
|
52
|
+
|
|
53
|
+
@ManyToOne(() => Brands, (brand) => brand.product)
|
|
54
|
+
@JoinColumn({ name: 'brand_id' })
|
|
55
|
+
brand!: Brands;
|
|
56
|
+
|
|
57
|
+
@ManyToOne(() => Product, (product) => product.id)
|
|
58
|
+
@JoinColumn({ name: 'product_id' })
|
|
59
|
+
product!: Product;
|
|
60
|
+
|
|
61
|
+
@OneToOne(() => Attachement, (attachment) => attachment.stockRequestDetails)
|
|
62
|
+
attachment: Attachement;
|
|
63
|
+
}
|