Compare commits

...

298 Commits

Author SHA1 Message Date
6f1a9cd892 solved the conflicts 2025-08-12 11:57:37 +05:30
44614f475b solve confilectes 2025-08-12 11:52:53 +05:30
37c91d4432 resolving the rebase errors 2025-08-11 16:54:47 +05:30
0ba2874041 solving rebase 2025-08-11 16:52:19 +05:30
4bd3e59427 Sloving the rebase 2025-08-11 16:50:55 +05:30
5c411602bc Merge pull request 'Expanses_Management_Feature' (#109) from Expanses_Management_Feature into main
Reviewed-on: #109
2025-08-08 06:14:47 +00:00
9b241a0c70 Made MPIN to be 4 digit 2025-08-07 15:03:52 +05:30
fb1f34f950 Added new condition for checking the permission for expense Action API 2025-08-06 12:14:18 +05:30
19aedfb648 Chnage the cache logic 2025-08-04 15:45:04 +05:30
33538c25b7 Chnaged get query 2025-08-04 14:51:05 +05:30
c3571f76b8 Changed the if condition in expense list API 2025-08-04 14:46:40 +05:30
b9f2bc53c8 Added updated at in action API 2025-08-04 12:26:33 +05:30
30fa924d0f added the date in update logs 2025-08-04 11:12:07 +05:30
2c94854f57 Showing the draft of self only 2025-08-04 09:46:56 +05:30
2ccae935f3 Sending the ExpenseLogs in Details API 2025-08-02 12:48:20 +05:30
a7392a515d Added new logs in expense update API 2025-08-01 17:50:59 +05:30
eaf6284a57 Order nextStatus by it name 2025-08-01 16:18:17 +05:30
555bb87779 Validating the null objects while saving the object in cache 2025-08-01 12:15:24 +05:30
0be021448d Added the date filert in mongo get function also 2025-08-01 11:34:23 +05:30
4808d6e77b COrrected the seppling mistake for projectDetails API 2025-08-01 09:03:12 +05:30
59459acaee Only sending 10 employees if project Id is not provided 2025-07-31 19:06:26 +05:30
732182a672 Added new API to fetch basic employee list 2025-07-31 17:26:09 +05:30
d001366d77 Merge branch 'main' of https://git.marcoaiot.com/admin/marco.pms.api into Expanses_Management_Feature 2025-07-31 11:30:38 +05:30
7fe8dc60cb Merge pull request 'Issues_July_4W' (#108) from Issues_July_4W into main
Reviewed-on: #108
the branch is deloyed on production
2025-07-31 05:52:51 +00:00
36db35d90e Sending every project exists in expense table 2025-07-31 11:15:37 +05:30
1c9008ca62 Added the search funcationality abd chnaged the cache object 2025-07-31 10:28:45 +05:30
1a0641162c Added the currency master table 2025-07-30 15:44:19 +05:30
d28f37714f Added new status and change expesne status from tenant scop to system scope 2025-07-30 12:24:19 +05:30
388979ef82 Chnage Reviewed to Mark as Reviewed in expenses status 2025-07-30 10:08:26 +05:30
4325dffc06 change ExpensesReimburse from list to single entity in expense details view model 2025-07-30 09:34:16 +05:30
0c1cb98f5b Added the code to save reimbursement in database 2025-07-29 18:11:33 +05:30
f4368ae4e3 change display name fo expense status from Paid to Mark as Paid 2025-07-29 17:17:57 +05:30
ce4e52e69d Chnage the name of Prosecc Pending to payment Payment pending 2025-07-29 15:59:12 +05:30
6c32a48095 Changed the display names of expense status 2025-07-29 15:47:49 +05:30
0b2883af0f Added proper reponse message in expense APIs 2025-07-28 18:00:37 +05:30
5b091a8d6f Rewrite the uf condiotn in get expense details API 2025-07-28 11:18:26 +05:30
61741331e0 Corrected the feaching logic for expense delete API 2025-07-28 10:37:18 +05:30
7619ce9820 FIltering the master list by active and inactive 2025-07-26 09:17:26 +05:30
57d2b03c02 Change the id else logic to show proper message upon deletion or resotation of master entity in expenses module 2025-07-26 09:11:04 +05:30
aa47bfe59c Added an API to modify isActive parameter in Payment mode master table for that tenant 2025-07-25 13:06:28 +05:30
f1e9a8655a Added an API to modify isActive parameter in Expense status master table for that tenant 2025-07-25 13:02:13 +05:30
b4931aafd6 Added an API to modify isActive parameter in Expense type master table for that tenant 2025-07-25 12:54:49 +05:30
e31e19ed74 Added an API to update expenses status to master table for that tenant 2025-07-25 12:28:06 +05:30
2ad0638d4f Added applied filters in response 2025-07-25 12:26:34 +05:30
a196906bf9 Added an API to update payment mode to master table for that tenant 2025-07-25 12:07:16 +05:30
5b5aa9f77a Added an API to update Expense type to master table for that tenant 2025-07-25 11:52:47 +05:30
cad631ec7a Added the end point for add expenses status API 2025-07-25 11:07:15 +05:30
9cd9bac975 Added an API to add new Expense status to master table for that tenant 2025-07-25 10:55:25 +05:30
1834c103f0 Added an API to add new payment mode to master table for that tenant 2025-07-25 10:36:57 +05:30
e1102c2978 Added an API to add new Expense type to master table for that tenant 2025-07-25 10:26:29 +05:30
62956d6b12 solved the mearge error 2025-07-24 17:28:27 +05:30
c2fe726f0c Added signalR in update expesne API 2025-07-24 16:16:30 +05:30
c881964ab1 Added proper validation and logs in get expesne status, expenses type and payment mode APIs 2025-07-24 16:07:39 +05:30
809d64e296 Added permission IDs in expesne status master View model 2025-07-24 16:03:23 +05:30
36163e97cc Merge pull request 'Added Designation Parameter in Contacts and Implement in Related APIs' (#104) from Ashutosh_Enhancement_#631 into Issues_July_4W
Reviewed-on: #104
2025-07-24 10:04:45 +00:00
57d7b4c07b Solved the issue of not showing final status in list and details API of expesne model 2025-07-24 10:38:31 +05:30
a1db851edd Added peoper return messages and validations in update expesnse API 2025-07-24 10:15:33 +05:30
8cc6584e7c will be pushed in another branch
revert Made MPIN to be 4 digit
2025-07-23 12:47:45 +00:00
5926ec6655 will be pushed in another branch
revert Changed the function from GetProjectDetailsAsync to GetProjectDetailsOldAsync
2025-07-23 12:47:22 +00:00
346f2cebcb Changed the function from GetProjectDetailsAsync to GetProjectDetailsOldAsync 2025-07-23 18:11:10 +05:30
468bfdf635 Made MPIN to be 4 digit 2025-07-23 18:09:52 +05:30
8b5b0aed4c Added proper logs to all Expesne APIs 2025-07-23 18:02:12 +05:30
ae1222bb96 Added the API to featch list of suppler names from expenses 2025-07-23 17:31:15 +05:30
b6dfb30f92 Create API base for delete expense API 2025-07-23 17:22:19 +05:30
4370d5a350 Adsing file to delete from S3 in mongoDB while update expenes 2025-07-23 16:24:59 +05:30
0095cd54f6 Added persigned Urls in Expesne Details API 2025-07-23 12:50:42 +05:30
4a762e4983 commented un wanted code 2025-07-23 10:58:16 +05:30
3083083148 Created the get Expense details API 2025-07-23 10:51:58 +05:30
73cf85a1cc Added cache to expenses get list and create expense APIs 2025-07-23 09:56:01 +05:30
d536b9c99c Added proper namespances and changed the getProjectdetails to getProjectDetailsOld 2025-07-22 14:23:39 +05:30
cfbfbf2e2b Renamed the CacheHelper To Helpers 2025-07-22 10:53:55 +05:30
5be154a9f1 Added totalPages , totalEntites and Currect page in response of get expenses list 2025-07-22 09:58:13 +05:30
2449d2a518 FIxed the database transaction error 2025-07-21 18:50:08 +05:30
1fffde6d7f Solved the database transcation error 2025-07-21 18:39:34 +05:30
f9213b6040 Completely optimmized the Action API 2025-07-21 18:21:51 +05:30
282d33d8b2 Optimized and enchance the created expense API 2025-07-21 13:05:04 +05:30
839bc360f3 Added skeleton for action and update API. 2025-07-21 12:29:33 +05:30
3b4b09783b Completed the get expenses list API with optimized code 2025-07-19 20:32:06 +05:30
c1845dd8b7 Change the ExpanseController to ExpenseController 2025-07-19 19:05:07 +05:30
741acb194e Added the status Mapping table in database 2025-07-19 17:10:02 +05:30
448d586b94 Changed the endpoint names in expense controller 2025-07-19 16:21:54 +05:30
c27ffe3a28 Addd a table to save logs of expenses 2025-07-19 16:13:37 +05:30
84f5da25f6 Added the get API in Expenses module 2025-07-19 15:49:23 +05:30
15f100308f Added created API to create expenses entity 2025-07-19 15:41:27 +05:30
8e69219e73 Added all get lsit for Expenses-Type, Expenses-Status and payment-mode 2025-07-19 15:02:48 +05:30
cc2e545442 Added created by and created at in expenses model 2025-07-19 15:00:21 +05:30
0b1d2669ca Improved the data seeder function 2025-07-19 14:58:47 +05:30
cf01fd1138 Added models for Expenses management models and migrations 2025-07-19 13:12:47 +05:30
51b379916f Solving the rebase errors 2025-07-18 18:43:22 +05:30
027d6a8c3b Solving the rebase error 2025-07-18 18:40:41 +05:30
1d5b0a9b06 Created an Utility function store logs in mogoDB 2025-07-18 18:39:05 +05:30
afe20b404a Merge pull request 'Ashutosh_Refactor' (#107) from Ashutosh_Refactor into main
Reviewed-on: #107
2025-07-18 13:01:28 +00:00
d84b01473a Merge pull request 'Created an Utility function store logs in mogoDB' (#106) from Ashutosh_Task#767 into Expanses_Management_Feature
Reviewed-on: #106
2025-07-18 11:05:02 +00:00
328c6ec4e3 When sending the report before data has been taken from cache not from database change it to both 2025-07-18 16:03:53 +05:30
b614ca93e6 Created an Utility function store logs in mogoDB 2025-07-18 13:00:50 +05:30
7b2a3887de Solved the rebase issues 2025-07-17 17:36:58 +05:30
0ac4c23e74 Merge branch 'Ashutosh_Refactor' of https://git.marcoaiot.com/admin/marco.pms.api into Ashutosh_Refactor 2025-07-17 17:23:08 +05:30
b71935dd1f Removed commented code from project Cache 2025-07-17 17:23:02 +05:30
c8978ee9b1 added new function delete all employee entries from cache 2025-07-17 17:23:02 +05:30
0ecf258661 Deleted the unused variable 2025-07-17 17:23:01 +05:30
30d614fa11 Added the logs setp in program.cs 2025-07-17 17:23:01 +05:30
5deb97d73b Added one more condition to check if active is false while removing the employee from buckets 2025-07-17 17:23:01 +05:30
6ac28de56a Removed the reassgining of same object 2025-07-17 17:23:01 +05:30
8735de3d93 Remove the projectHelper and ProjetsHelper and move its bussiness logic to project services 2025-07-17 17:23:01 +05:30
c8ca2d5c49 Optimization of WorkItem Delete API in Project Controller 2025-07-17 17:23:00 +05:30
eabd31f8cf Optimized the Manage infra API in Project Controller 2025-07-17 17:23:00 +05:30
57b7f941e6 Optimized the manage task API in projectController 2025-07-17 17:23:00 +05:30
c90f39082a Optimized the project allocation by employee Id Apis 2025-07-17 17:23:00 +05:30
c03fae4b65 Added Sonar files in git ignore 2025-07-17 17:23:00 +05:30
168922c278 Optimized the Project Allocation API 2025-07-17 17:22:59 +05:30
72dccc0c6a Added Employee ID of creater to bucket in Employee IDs 2025-07-17 17:22:59 +05:30
7914cf20d4 Removed unused code from employee cache class 2025-07-17 17:22:59 +05:30
80149f05f7 Solved the issue of project is not updating properly 2025-07-17 17:22:59 +05:30
560d2f2d4d adde functionality to delete workItems from cache 2025-07-17 17:22:59 +05:30
f4ca7670e3 Refactored: Moved business logic from ProjectController to ProjectService 2025-07-17 17:22:58 +05:30
36eb7aef7f Optimized the Update project API 2025-07-17 17:22:58 +05:30
ca34b01ab0 Optimized the Get project By ID API 2025-07-17 17:22:58 +05:30
b78f58c304 Solved Concurrency Issue 2025-07-17 17:22:58 +05:30
c359212ee5 Optimized both get Project list API and get Project list basic API 2025-07-17 17:22:58 +05:30
7d160a9a52 Refactored the function to add project in cache and added auto Mapper 2025-07-17 17:22:57 +05:30
3bc51f9cd9 Refactor project report APIs to improve performance and readability 2025-07-17 17:22:57 +05:30
3a45bded08 Merge pull request 'Attendance_Weidget_feature' (#105) from Attendance_Weidget_feature into main
Reviewed-on: #105
2025-07-17 11:50:32 +00:00
5e84ee9345 Removed commented code from project Cache 2025-07-17 17:16:16 +05:30
7c8a80addc Merge branch 'Ashutosh_Refactor' of https://git.marcoaiot.com/admin/marco.pms.api into Ashutosh_Refactor 2025-07-17 17:02:00 +05:30
079a380422 Deleted the unused variable 2025-07-17 17:01:51 +05:30
5b0e9ffb7c added new function delete all employee entries from cache 2025-07-17 16:38:39 +05:30
c6ba233e6d Added the logs setp in program.cs 2025-07-17 16:06:54 +05:30
0ec507c97c Included the jobrole when feaching employee list 2025-07-17 15:31:05 +05:30
760b4638e6 Added one more condition to check if active is false while removing the employee from buckets 2025-07-17 12:53:01 +05:30
2a3c75b0c8 Removed the reassgining of same object 2025-07-17 12:42:02 +05:30
d1106bc86b Can able update note of deleted not also 2025-07-17 12:01:47 +05:30
ccce0d48d5 Remove the projectHelper and ProjetsHelper and move its bussiness logic to project services 2025-07-17 10:17:57 +05:30
089ae7e9e5 Optimization of WorkItem Delete API in Project Controller 2025-07-16 18:39:29 +05:30
3f7925aa72 Optimized the Manage infra API in Project Controller 2025-07-16 18:15:43 +05:30
0859284f4a Merge branch 'Attendance_Weidget_feature' of https://git.marcoaiot.com/admin/marco.pms.api into Attendance_Weidget_feature 2025-07-16 18:00:27 +05:30
bbd2054867 only checking if the user have permission of project or not only 2025-07-16 18:00:15 +05:30
e4246df315 Changed the business logic of teams and tasks API in DashboardController to accept project ID and provide data according to project ID or project IDs assigned to logged in user 2025-07-16 18:00:15 +05:30
237b178107 Replace lazy loading with eager loading 2025-07-16 17:52:25 +05:30
c79cbf32ea Optimized the manage task API in projectController 2025-07-16 15:08:53 +05:30
2889620c1c only checking if the user have permission of project or not only 2025-07-16 14:49:34 +05:30
08e8e8d75f Changed the business logic of teams and tasks API in DashboardController to accept project ID and provide data according to project ID or project IDs assigned to logged in user 2025-07-16 12:39:16 +05:30
c3da83d165 Optimized the project allocation by employee Id Apis 2025-07-15 16:37:57 +05:30
9d0c16b887 Added Sonar files in git ignore 2025-07-15 15:37:15 +05:30
823deb17cc Optimized the Project Allocation API 2025-07-15 15:30:41 +05:30
f406a15508 Added Employee ID of creater to bucket in Employee IDs 2025-07-15 15:21:48 +05:30
a64ce4fb02 Removed unused code from employee cache class 2025-07-15 14:34:26 +05:30
5369bbae29 Solved the issue of project is not updating properly 2025-07-15 13:09:27 +05:30
73aa1d6181 adde functionality to delete workItems from cache 2025-07-15 12:44:38 +05:30
5de59f0292 Refactored: Moved business logic from ProjectController to ProjectService 2025-07-14 18:45:23 +05:30
e769c161f4 Optimized the Update project API 2025-07-14 17:00:28 +05:30
c5d9beec04 Optimized the Get project By ID API 2025-07-14 15:57:52 +05:30
0c84bb11a3 Solved Concurrency Issue 2025-07-14 15:08:31 +05:30
4ba533f647 Optimized both get Project list API and get Project list basic API 2025-07-14 12:02:45 +05:30
8bb8b3643f Refactored the function to add project in cache and added auto Mapper 2025-07-12 13:14:15 +05:30
d27cdee72d Refactor project report APIs to improve performance and readability 2025-07-12 13:13:29 +05:30
852b079428 Merge pull request 'ProjectDetails_Split_API' (#103) from ProjectDetails_Split_API into main
Reviewed-on: #103
2025-07-11 11:32:33 +00:00
5cb56b7a10 Sovled the rebase code errors 2025-07-11 11:06:29 +05:30
56161d302b Solving rebase issues 2025-07-11 11:04:28 +05:30
8e3eedbfa7 Removing the project stored in cache for employee who have the project manage permission 2025-07-11 11:03:33 +05:30
3c8a044d66 Added the workcategory in WorkItem 2025-07-11 11:03:33 +05:30
ff722503d5 Added new parameter in log "Origin" 2025-07-11 11:03:33 +05:30
669500e57e Added the caching project report API and added expiry in workItems in cache 2025-07-11 11:03:33 +05:30
3e316ef388 Changed the signalR keyword for work item 2025-07-11 11:03:33 +05:30
3ec4bd762f Added old project Details API 2025-07-11 11:03:33 +05:30
0be200e77a In Project Report Email only sending data of job role assigned to that project 2025-07-11 11:03:33 +05:30
3646163593 Implemented the cache in task allocation 2025-07-11 10:32:11 +05:30
cbcc3398c3 Storing workItem in cache and changing planned work and completed work for respective project, building, floor, and workarea 2025-07-11 10:30:39 +05:30
d8cf87aee4 Implemented the methods for deleting permission am asigned project from caches for certien employee 2025-07-11 10:30:39 +05:30
3d8e91d58d Added error handling in cache helper 2025-07-11 10:30:39 +05:30
129ccf7fae removed comented code from appsetting file 2025-07-11 10:30:39 +05:30
3e8ef856d4 Saving project details with infrastructure, employee permissions and assigned project for that employee in mongodb 2025-07-11 10:30:35 +05:30
de3fa6b929 project details API is split into three APIs. 2025-07-11 10:29:29 +05:30
bb76c45195 Removing the project stored in cache for employee who have the project manage permission 2025-07-10 15:57:08 +05:30
40ce4ced42 Added the workcategory in WorkItem 2025-07-10 14:59:28 +05:30
60517f3f60 Merge branch 'ProjectDetails_Split_API' of https://git.marcoaiot.com/admin/marco.pms.api into ProjectDetails_Split_API 2025-07-10 09:52:39 +05:30
c2a9a42af5 Added old project Details API 2025-07-10 09:52:18 +05:30
17c56be712 Added new parameter in log "Origin" 2025-07-09 15:11:08 +05:30
183d72017d Merge pull request 'vikas#387_code_review' (#102) from vikas#387_code_review into main
Reviewed-on: #102
2025-07-09 09:36:28 +00:00
c4ad3fdad5 Added the caching project report API and added expiry in workItems in cache 2025-07-09 12:39:27 +05:30
de5485b8f6 Changed the signalR keyword for work item 2025-07-09 10:35:35 +05:30
2304912bf8 Added all Feature permission in static file and use that static file to check the permission 2025-07-08 16:07:27 +05:30
5c1dcd89b5 directoryAdmin, directoryManager, and directoryUser are hard-coded in the helper class. Instead of hard-coding, we can create a static class and use it across the application.
Ref: https://redmine.marcoaiot.com/issues/387
2025-07-08 15:12:36 +05:30
856510baff In Project Report Email only sending data of job role assigned to that project 2025-07-08 12:48:13 +05:30
49b85c4df9 Rresloving rebase issues 2025-07-08 12:38:00 +05:30
aebb344a5a Implemented the cache in task allocation 2025-07-08 12:36:17 +05:30
56aca323e5 Storing workItem in cache and changing planned work and completed work for respective project, building, floor, and workarea 2025-07-08 12:22:29 +05:30
1d318c75d8 Implemented the methods for deleting permission am asigned project from caches for certien employee 2025-07-08 12:22:29 +05:30
8521a68c3e Added error handling in cache helper 2025-07-08 12:22:28 +05:30
8c85d92ba6 removed comented code from appsetting file 2025-07-08 12:22:28 +05:30
3ce9851a7f Saving project details with infrastructure, employee permissions and assigned project for that employee in mongodb 2025-07-08 12:22:28 +05:30
3dd5e7f626 project details API is split into three APIs. 2025-07-08 12:22:28 +05:30
67c8bee2c2 Implemented the cache in task allocation 2025-07-08 12:20:54 +05:30
bc0ef0b88b Merge pull request 'Image_Gallery' (#101) from Image_Gallery into main
Reviewed-on: #101
2025-07-08 06:42:02 +00:00
411902eef7 Merge branch 'ProjectDetails_Split_API' of https://git.marcoaiot.com/admin/marco.pms.api into ProjectDetails_Split_API 2025-07-07 17:48:09 +05:30
80a197b408 Storing workItem in cache and changing planned work and completed work for respective project, building, floor, and workarea 2025-07-07 17:47:37 +05:30
11b54debc6 Implemented the methods for deleting permission am asigned project from caches for certien employee 2025-07-07 17:47:37 +05:30
0654bca655 Added error handling in cache helper 2025-07-07 17:47:37 +05:30
8e67e801a3 removed comented code from appsetting file 2025-07-07 17:47:37 +05:30
c2354033b7 Saving project details with infrastructure, employee permissions and assigned project for that employee in mongodb 2025-07-07 17:47:37 +05:30
ec1e2dc59f Storing workItem in cache and changing planned work and completed work for respective project, building, floor, and workarea 2025-07-07 17:44:58 +05:30
43e2aeb097 Showing the comment added when task is reported 2025-07-07 13:15:27 +05:30
65f3376523 Added new paremeter of NumberOfImages in signalR message object 2025-07-07 11:21:31 +05:30
b8cba9f378 Implemented the methods for deleting permission am asigned project from caches for certien employee 2025-07-07 10:04:11 +05:30
558fd6bd5b Corrected Key for signalR 2025-07-05 17:24:57 +05:30
e4cc6c1578 Merge pull request 'Added SignalR Integration for Reporting, Commenting, and Approving Tasks' (#100) from Ashutosh_Task#663 into Image_Gallery
Reviewed-on: #100
2025-07-05 11:44:00 +00:00
6373da3144 Added SignalR Integration for Reporting, Commenting, and Approving Tasks 2025-07-05 17:11:59 +05:30
0052692283 Added error handling in cache helper 2025-07-05 15:25:01 +05:30
f9ab7bb3c8 Ordered by Uploaded at 2025-07-05 13:19:06 +05:30
800db99fd9 Removed double Deserialization 2025-07-05 12:33:10 +05:30
6d8939d942 Added Pagenation to Image List API 2025-07-05 12:23:28 +05:30
7be7d6f13d removed comented code from appsetting file 2025-07-04 17:50:27 +05:30
cd4ad6f4ac Saving project details with infrastructure, employee permissions and assigned project for that employee in mongodb 2025-07-04 17:49:25 +05:30
c9ff53a7ac Removed double Deserialize 2025-07-03 12:46:49 +05:30
a303625d59 Added a line which is missed while optimizing 2025-07-03 11:32:06 +05:30
62eb914456 Added filter in get image list API 2025-07-02 17:42:42 +05:30
3216318acb Added Designation Parameter in Contacts and Implement in Related APIs 2025-07-02 15:07:08 +05:30
1f5a71ef09 Added WorkCategoryName and WorkCategoryId Parameters in view models 2025-07-02 13:15:28 +05:30
8353c384a5 Added athorization in controller 2025-07-02 10:15:00 +05:30
85911c4536 Added an API to get persigned url for provided document 2025-07-02 10:04:00 +05:30
afdf51eae3 Added an API to get list of Images for provided batch ID 2025-07-02 10:03:20 +05:30
587e8d2b0b Added an API to get list of images in provided project. 2025-07-02 10:02:22 +05:30
b77a5b16cd Storing batch ID when saving any images as well stop storing base64 in database 2025-07-02 10:01:10 +05:30
ba1e644fd8 Added new parameter uploaded by in documents table 2025-07-02 09:59:56 +05:30
6b5c09c562 Merge branch 'ProjectDetails_Split_API' of https://git.marcoaiot.com/admin/marco.pms.api into ProjectDetails_Split_API 2025-07-01 15:59:54 +05:30
8055c04e4b project details API is split into three APIs. 2025-07-01 15:59:49 +05:30
65da812a97 Merge pull request 'Issues_June_3W' (#99) from Issues_June_3W into main
Reviewed-on: #99
2025-07-01 10:25:44 +00:00
2c445878d0 project details API is split into three APIs. 2025-07-01 12:39:07 +05:30
a3de905159 Chnaged the name of view employee feature permission to view team members 2025-06-30 16:58:28 +05:30
5f9ca98284 Implemented the view employee and view all employee permission to employee list API 2025-06-30 16:33:50 +05:30
00c30eb2cc Merge pull request 'Ashutosh_Enhancement_#622' (#98) from Ashutosh_Enhancement_#622 into Issues_June_3W
Reviewed-on: #98
2025-06-30 10:13:46 +00:00
2a507bf7b0 Implemented View all employee permission in employee list API 2025-06-30 15:29:29 +05:30
5a3dd42630 Added migration for new feature permissio and chnaged features for view infra and manage infra to project management 2025-06-30 13:13:12 +05:30
ea80176eec Merge pull request 'Added a return statement after saving the contact tag.' (#97) from Ashutosh_Task_#237 into Issues_June_3W
Reviewed-on: #97
2025-06-30 05:04:10 +00:00
d817170d0f Added a return statement after saving the contact tag. 2025-06-30 10:31:01 +05:30
b7386d0c98 Merge pull request 'Ashutosh_Task#513' (#96) from Ashutosh_Task#513 into Issues_June_3W
Reviewed-on: #96
2025-06-28 04:27:28 +00:00
8c691c5d3e Merge branch 'Ashutosh_Task#513' of https://git.marcoaiot.com/admin/marco.pms.api into Ashutosh_Task#513 2025-06-28 09:51:30 +05:30
8d35063ced Merge pull request 'Ashutosh_Task#513' (#95) from Ashutosh_Task#513 into Issues_June_3W
Reviewed-on: #95
2025-06-27 11:45:54 +00:00
2128e630d5 Added conatct name nd organization name in all contact note VMs 2025-06-27 17:14:20 +05:30
9149c4e546 Filtered conatct notes by projects and added contact name and organization name in list VM 2025-06-27 17:14:20 +05:30
d12f8ed0fb Added conatct name nd organization name in all contact note VMs 2025-06-27 11:50:51 +05:30
90c5308d76 Filtered conatct notes by projects and added contact name and organization name in list VM 2025-06-27 10:58:29 +05:30
70c1c6da9d Merge branch 'Issues_June_3W' of https://git.marcoaiot.com/admin/marco.pms.api into Issues_June_3W 2025-06-24 16:33:05 +05:30
e3ddcee8b3 Implemented An API to get list of all notes 2025-06-24 16:32:54 +05:30
0d49163d7b Merge pull request 'When task is approved stored approved tasks in reported task field not in completed task' (#93) from Ashutosh_Bug#529 into Approve_Task_Feature
Reviewed-on: #93
2025-06-24 06:06:37 +00:00
b94f4bdb63 When task is approved stored approved tasks in reported task field not in completed task 2025-06-24 11:30:50 +05:30
2ed0e6e5b6 Merge branch 'Issues_June_3W' of https://git.marcoaiot.com/admin/marco.pms.api into Issues_June_3W 2025-06-23 17:10:10 +05:30
72a92417b5 Implemented An API to get list of all notes 2025-06-23 17:10:05 +05:30
cb2856b2df Merge pull request 'Implemented An API to get list of all notes' (#92) from Ashutosh_Task#513 into Issues_June_3W
Reviewed-on: #92
2025-06-23 11:38:16 +00:00
b56478056e Implemented An API to get list of all notes 2025-06-23 14:50:50 +05:30
82ebd07d61 Added project validation in attendance Overview API 2025-06-20 13:09:13 +05:30
b78c5c07c5 Added a new API in dashbased ot check attendance overview of specifec project for give number of days 2025-06-20 12:45:35 +05:30
64a7cde69c Implemented signalR in record-mobile API 2025-06-19 18:28:57 +05:30
a6a842bf10 Fixed rebase issues 2025-06-19 07:30:55 -04:00
c3f5fe8e34 Fixing rebase issues 2025-06-19 07:07:54 -04:00
c9bb18d8e5 Optimized the task management API 2025-06-19 07:05:32 -04:00
2e925efcf7 Added code to validate the id received by path parameter with id received by payload 2025-06-19 06:53:02 -04:00
5bc13e215d Added CRUD operation APIs for work Status master table 2025-06-19 06:53:02 -04:00
Pramod Mahajan
f20b4a42a1 added new fields inside workItem- parentTaskId and Description 2025-06-19 06:53:02 -04:00
99818c42b0 Added new API to get list of work status 2025-06-19 06:53:02 -04:00
5d5579882f Added Functionality for approving the reported task 2025-06-19 06:53:01 -04:00
3dfde6d9a5 Added new entry in status master table 2025-06-19 11:43:10 +05:30
aa2bc674eb Optimized the task management API 2025-06-18 19:08:06 +05:30
4164c7d761 Cheange the message sending when manageing project infrastructure 2025-06-18 18:12:28 +05:30
Pramod Mahajan
692b1bfef3 Merge branch 'Approve_Task_Feature' of https://git.marcoaiot.com/admin/marco.pms.api into Approve_Task_Feature 2025-06-18 17:35:12 +05:30
Pramod Mahajan
1c58265a9f added new fields inside workItem- parentTaskId and Description 2025-06-18 17:34:33 +05:30
303f326773 Implemented signalR in Employee module 2025-06-18 12:00:35 +05:30
e2956c0c8c Added signalR functionality in Project Infrastructure 2025-06-17 17:05:52 +05:30
39378f3a88 Resolved rebase issues 2025-06-16 18:09:00 +05:30
caacb43aa8 Merge branch 'SingalR_Integration' of https://git.marcoaiot.com/admin/marco.pms.api into SingalR_Integration 2025-06-16 17:57:49 +05:30
29ea1698bc Implemented signalR in manage Task API 2025-06-16 17:57:44 +05:30
793877b8f8 Implemented signalR in project infrastructure APIs 2025-06-16 17:57:37 +05:30
f47586710b Add basic implementation and add in record attendance API for testing 2025-06-16 17:55:59 +05:30
b21d30c18e Changed the keyword for updating and creating project 2025-06-16 17:54:52 +05:30
d78a2fe3b2 Implemented signalR in project infrastructure APIs 2025-06-16 17:54:52 +05:30
6ebc74499f Add basic implementation and add in record attendance API for testing 2025-06-16 17:54:52 +05:30
ff9c7c9434 Added code to validate the id received by path parameter with id received by payload 2025-06-16 17:19:59 +05:30
e391c82659 Added CRUD operation APIs for work Status master table 2025-06-16 16:58:56 +05:30
1f56143142 Added new API to get list of work status 2025-06-16 16:24:49 +05:30
dc21b9d2c6 Added Functionality for approving the reported task 2025-06-16 15:57:04 +05:30
17ae02a0b3 Implemented signalR in manage Task API 2025-06-13 16:22:58 +05:30
9d5535edf1 Added description in list task API 2025-06-12 22:30:43 +05:30
c689f2dfd8 Merge branch 'Acititvity_Images' of https://git.marcoaiot.com/admin/marco.pms.api into Acititvity_Images 2025-06-12 21:40:36 +05:30
5c019a2ff6 Chnaged the name form presignedUrls to ReportedProsignedUrl 2025-06-12 21:40:31 +05:30
cb185db4f3 Sending pre signed url in task list API 2025-06-12 21:40:31 +05:30
1a51860517 Implemented the image capture while writing comment in task allocation and add presignedurl in task get by in API 2025-06-12 21:40:31 +05:30
f275d08215 Implemented image storing to S3 while reporting task 2025-06-12 21:40:31 +05:30
4ccc690560 Chnaged the name form presignedUrls to ReportedProsignedUrl 2025-06-12 21:35:40 +05:30
82f3fdbc23 Merge branch 'SingalR_Integration' of https://git.marcoaiot.com/admin/marco.pms.api into SingalR_Integration 2025-06-12 20:54:06 +05:30
790e9f63e1 Changed the keyword for updating and creating project 2025-06-12 20:54:00 +05:30
0636c8aedd Implemented signalR in project infrastructure APIs 2025-06-12 20:54:00 +05:30
8f2c828282 Add basic implementation and add in record attendance API for testing 2025-06-12 20:54:00 +05:30
169e7f6601 Changed the keyword for updating and creating project 2025-06-12 20:53:24 +05:30
691a670a28 Sending pre signed url in task list API 2025-06-12 18:32:50 +05:30
d8ee5940fd Add new API to only fetch project information to load in dropdowns. Full project details including progress will be fatched latter when required 2025-06-12 17:32:48 +05:30
76b6ac6581 Implemented the image capture while writing comment in task allocation and add presignedurl in task get by in API 2025-06-12 17:02:18 +05:30
abe7870ad5 Implemented image storing to S3 while reporting task 2025-06-12 16:09:28 +05:30
712c5e2a0a Implemented signalR in project infrastructure APIs 2025-06-12 11:04:24 +05:30
8814dc59d9 Add basic implementation and add in record attendance API for testing 2025-06-11 10:21:39 +05:30
194 changed files with 63796 additions and 2412 deletions

3
.gitignore vendored
View File

@ -361,3 +361,6 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# Sonar
/.sonarqube

View File

@ -1,11 +1,11 @@
using System.Globalization;
using Marco.Pms.Model.Activities;
using Marco.Pms.Model.Activities;
using Marco.Pms.Model.AttendanceModule;
using Marco.Pms.Model.Authentication;
using Marco.Pms.Model.Directory;
using Marco.Pms.Model.DocumentManager;
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Entitlements;
using Marco.Pms.Model.Expenses;
using Marco.Pms.Model.Forum;
using Marco.Pms.Model.Mail;
using Marco.Pms.Model.Master;
@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System.Globalization;
namespace Marco.Pms.DataAccess.Data
{
@ -44,6 +45,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<TaskAllocation> TaskAllocations { get; set; }
public DbSet<TaskComment> TaskComments { get; set; }
public DbSet<TaskMembers> TaskMembers { get; set; }
public DbSet<TaskAttachment> TaskAttachments { get; set; }
public DbSet<Attendance> Attendes { get; set; }
public DbSet<AttendanceLog> AttendanceLogs { get; set; }
public DbSet<Employee> Employees { get; set; }
@ -51,6 +53,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<Module> Modules { get; set; }
public DbSet<Feature> Features { get; set; }
public DbSet<FeaturePermission> FeaturePermissions { get; set; }
public DbSet<CurrencyMaster> CurrencyMaster { get; set; }
public DbSet<ApplicationRole> ApplicationRoles { get; set; }
public DbSet<JobRole> JobRoles { get; set; }
public DbSet<RolePermissionMappings> RolePermissionMappings { get; set; }
@ -68,6 +71,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<Document> Documents { get; set; }
public DbSet<TicketTag> TicketTags { get; set; }
public DbSet<WorkCategoryMaster> WorkCategoryMasters { get; set; }
public DbSet<WorkStatusMaster> WorkStatusMasters { get; set; }
public DbSet<Contact> Contacts { get; set; }
public DbSet<ContactCategoryMaster> ContactCategoryMasters { get; set; }
public DbSet<ContactEmail> ContactsEmails { get; set; }
@ -87,6 +91,17 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<OTPDetails> OTPDetails { get; set; }
public DbSet<MPINDetails> MPINDetails { get; set; }
public DbSet<Expenses> Expenses { get; set; }
public DbSet<ExpenseLog> ExpenseLogs { get; set; }
public DbSet<ExpensesTypeMaster> ExpensesTypeMaster { get; set; }
public DbSet<PaymentModeMatser> PaymentModeMatser { get; set; }
public DbSet<ExpensesStatusMaster> ExpensesStatusMaster { get; set; }
public DbSet<BillAttachments> BillAttachments { get; set; }
public DbSet<ExpensesReimburse> ExpensesReimburse { get; set; }
public DbSet<ExpensesReimburseMapping> ExpensesReimburseMapping { get; set; }
public DbSet<StatusPermissionMapping> StatusPermissionMapping { get; set; }
public DbSet<ExpensesStatusMapping> ExpensesStatusMapping { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
@ -95,49 +110,6 @@ namespace Marco.Pms.DataAccess.Data
ManageApplicationStructure(modelBuilder);
//modelBuilder.Entity<ApplicationRole>().HasData(
// new ApplicationRole
// {
// Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"),
// Role = "Super User",
// Description = "Super User",
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// },
// new ApplicationRole
// {
// Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"),
// Role = "Welder",
// Description = "",
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// },
// new ApplicationRole
// {
// Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"),
// Role = "Helper",
// Description = "",
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// },
// new ApplicationRole
// {
// Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"),
// Role = "Site Engineer",
// Description = "",
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }
// ,
// new ApplicationRole
// {
// Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"),
// Role = "Project Manager",
// Description = "",
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }
// );
modelBuilder.Entity<RefreshToken>(entity =>
{
entity.HasKey(e => e.Id);
@ -160,14 +132,19 @@ namespace Marco.Pms.DataAccess.Data
},
new StatusMaster
{
Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"),
Status = "In Progress",
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}, new StatusMaster
{
Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
Status = "On Hold",
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new StatusMaster
{
Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
Status = "On Hold",
Status = "In Active",
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new StatusMaster
@ -189,79 +166,11 @@ namespace Marco.Pms.DataAccess.Data
ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
//, new Project
//{
// Id = new Guid("3ef56a12-f5e5-4193-87d6-9e110ed10b86"),
// Name = "Project 2",
// ProjectAddress = "Project 2 Address",
// ContactPerson = "Project 2 Contact Person",
// StartDate = DateTime.ParseExact("2025-04-20 10:11:17.588000", "yyyy-MM-dd HH:mm:ss.ffffff", CultureInfo.InvariantCulture),
// EndDate = DateTime.ParseExact("2026-04-20 10:11:17.588000", "yyyy-MM-dd HH:mm:ss.ffffff", CultureInfo.InvariantCulture),
// ProjectStatusId = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
//}, new Project
//{
// Id = new Guid("54d013e3-0a2b-48be-85c7-5ef03492a18c"),
// Name = "Project 3",
// ProjectAddress = "Project 3 Address",
// ContactPerson = "Project 3 Contact Person",
// StartDate = DateTime.ParseExact("2025-04-20 10:11:17.588000", "yyyy-MM-dd HH:mm:ss.ffffff", CultureInfo.InvariantCulture),
// EndDate = DateTime.ParseExact("2026-04-20 10:11:17.588000", "yyyy-MM-dd HH:mm:ss.ffffff", CultureInfo.InvariantCulture),
// ProjectStatusId = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
//}
);
var tenantId = _httpContextAccessor.HttpContext?.Items["TenantId"]?.ToString();
//modelBuilder.Entity<ActivityMaster>()
// .HasData(
// new ActivityMaster
// {
// Id = new Guid("4117b7de-ef6c-461f-a2c2-64eaac5f9a11"),
// ActivityName = "Core Cutting",
// UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }, new ActivityMaster
// {
// Id = new Guid("1714f64d-7591-4419-bee5-118d21bb2855"),
// ActivityName = "Fabrication",
// UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }, new ActivityMaster
// {
// Id = new Guid("b3f51a93-dde6-45f9-8b22-f1bf017a640b"),
// ActivityName = "Welding",
// UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }, new ActivityMaster
// {
// Id = new Guid("53eedf44-4076-445f-be93-fedef17117e7"),
// ActivityName = "MS Support Fabrication",
// UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }, new ActivityMaster
// {
// Id = new Guid("715b9ddb-d9e2-4afa-8987-d9918905cea4"),
// ActivityName = "MS Support Hanging",
// UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }, new ActivityMaster
// {
// Id = new Guid("a3d191a7-a5aa-4dd8-a525-12c99263bbd6"),
// ActivityName = "Hydrant Volve",
// UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }, new ActivityMaster
// {
// Id = new Guid("c138a7de-713a-4bd4-8292-b0b265be77a3"),
// ActivityName = "Sprinkler Installation",
// UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
// TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
// }
// );
modelBuilder.Entity<Industry>().HasData(
new Industry { Id = Guid.Parse("15436ee3-a650-469e-bfc2-59993f7514bb"), Name = "Information Technology (IT) Services" },
new Industry { Id = Guid.Parse("0a63e657-2c5f-49b5-854b-42c978293154"), Name = "Manufacturing & Production" },
@ -307,7 +216,7 @@ namespace Marco.Pms.DataAccess.Data
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
Name = "In Review",
Description = "These issues are currently under review",
ColorCode = "#6c757d",
ColorCode = "#8592a3",
IsDefault = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
@ -428,6 +337,32 @@ namespace Marco.Pms.DataAccess.Data
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
modelBuilder.Entity<WorkStatusMaster>().HasData(
new WorkStatusMaster
{
Id = new Guid("030bb085-e230-4370-aec7-9a74d652864e"),
Name = "Approve",
Description = "Confirm the tasks are actually finished as reported",
IsSystem = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new WorkStatusMaster
{
Id = new Guid("2a1a5b96-cf93-4111-b4b1-76c19d6333b4"),
Name = "Partially Approve",
Description = "Not all tasks are actually finished as reported",
IsSystem = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new WorkStatusMaster
{
Id = new Guid("00a062e6-62e6-42c5-b6b1-024328651b72"),
Name = "NCR",
Description = "Tasks are not finished as reported or have any issues in al the tasks",
IsSystem = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
}
@ -454,6 +389,298 @@ namespace Marco.Pms.DataAccess.Data
modelBuilder.Entity<ExpensesStatusMaster>().HasData(
new ExpensesStatusMaster
{
Id = Guid.Parse("297e0d8f-f668-41b5-bfea-e03b354251c8"),
Name = "Draft",
DisplayName = "Draft",
Description = "Expense has been created but not yet submitted.",
Color = "#8592a3",
IsSystem = true,
IsActive = true
},
new ExpensesStatusMaster
{
Id = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7"),
Name = "Review Pending",
DisplayName = "Submit",
Description = "Reviewer is currently reviewing the expense.",
Color = "#696cff",
IsSystem = true,
IsActive = true
},
new ExpensesStatusMaster
{
Id = Guid.Parse("965eda62-7907-4963-b4a1-657fb0b2724b"),
Name = "Rejected by Reviewer",
DisplayName = "Reject",
Description = "Expense was declined, often with a reason(review rejected).",
Color = "#ff3e1d",
IsSystem = true,
IsActive = true
},
new ExpensesStatusMaster
{
Id = Guid.Parse("4068007f-c92f-4f37-a907-bc15fe57d4d8"),
Name = "Approval Pending",
DisplayName = "Mark as Reviewed",
Description = "Review is completed, waiting for action of approver.",
Color = "#03c3ec",
IsSystem = true,
IsActive = true
},
new ExpensesStatusMaster
{
Id = Guid.Parse("d1ee5eec-24b6-4364-8673-a8f859c60729"),
Name = "Rejected by Approver",
DisplayName = "Reject",
Description = "Expense was declined, often with a reason(approval rejected).",
Color = "#ff3e1d",
IsSystem = true,
IsActive = true
},
new ExpensesStatusMaster
{
Id = Guid.Parse("f18c5cfd-7815-4341-8da2-2c2d65778e27"),
Name = "Payment Pending",
DisplayName = "Mark as Approved",
Description = "Approved expense is awaiting final payment.",
Color = "#ffab00",
IsSystem = true,
IsActive = true
},
new ExpensesStatusMaster
{
Id = Guid.Parse("61578360-3a49-4c34-8604-7b35a3787b95"),
Name = "Processed",
DisplayName = "Mark as Processed",
Description = "Expense has been settled.",
Color = "#71dd37",
IsSystem = true,
IsActive = true
}
);
modelBuilder.Entity<ExpensesStatusMapping>().HasData(
// Process to processed
new ExpensesStatusMapping
{
Id = Guid.Parse("5cf7f1df-9d1f-4289-add0-1775ad614f25"),
StatusId = Guid.Parse("f18c5cfd-7815-4341-8da2-2c2d65778e27"),
NextStatusId = Guid.Parse("61578360-3a49-4c34-8604-7b35a3787b95")
},
// Rejected by Approver to Review
new ExpensesStatusMapping
{
Id = Guid.Parse("4ddddc10-0ffd-4884-accf-d4fa0bd97f54"),
StatusId = Guid.Parse("d1ee5eec-24b6-4364-8673-a8f859c60729"),
NextStatusId = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7")
},
// Approve to Rejected by Approver
new ExpensesStatusMapping
{
Id = Guid.Parse("36c00548-241c-43ec-bc95-cacebedb925c"),
StatusId = Guid.Parse("4068007f-c92f-4f37-a907-bc15fe57d4d8"),
NextStatusId = Guid.Parse("d1ee5eec-24b6-4364-8673-a8f859c60729")
},
// Approve to Process
new ExpensesStatusMapping
{
Id = Guid.Parse("1fca1700-1266-477d-bba4-9ac3753aa33c"),
StatusId = Guid.Parse("4068007f-c92f-4f37-a907-bc15fe57d4d8"),
NextStatusId = Guid.Parse("f18c5cfd-7815-4341-8da2-2c2d65778e27")
},
// Rejected by Reviewer to Review
new ExpensesStatusMapping
{
Id = Guid.Parse("9e2ec648-1ca2-4747-9329-e911b18edb3e"),
StatusId = Guid.Parse("965eda62-7907-4963-b4a1-657fb0b2724b"),
NextStatusId = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7")
},
// Review to Rejected by Reviewer
new ExpensesStatusMapping
{
Id = Guid.Parse("6b867bec-66e6-42a7-9611-f4595af9b9ce"),
StatusId = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7"),
NextStatusId = Guid.Parse("965eda62-7907-4963-b4a1-657fb0b2724b")
},
// Review to Aprrove
new ExpensesStatusMapping
{
Id = Guid.Parse("ef1fcfbc-60e0-4f17-9308-c583a05d48fd"),
StatusId = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7"),
NextStatusId = Guid.Parse("4068007f-c92f-4f37-a907-bc15fe57d4d8")
},
// Draft to Review
new ExpensesStatusMapping
{
Id = Guid.Parse("af1e4492-98ee-4451-8ab7-fd8323f29c32"),
StatusId = Guid.Parse("297e0d8f-f668-41b5-bfea-e03b354251c8"),
NextStatusId = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7")
}
);
modelBuilder.Entity<StatusPermissionMapping>().HasData(
// Draft Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("722b0c3c-5a78-456d-b9bb-b6ba1b21d59b"),
PermissionId = Guid.Parse("0f57885d-bcb2-4711-ac95-d841ace6d5a7"),
StatusId = Guid.Parse("297e0d8f-f668-41b5-bfea-e03b354251c8")
},
// Review Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("7deb0945-e1c9-411f-8b3c-c9bdbe3c3c2d"),
PermissionId = Guid.Parse("0f57885d-bcb2-4711-ac95-d841ace6d5a7"),
StatusId = Guid.Parse("6537018f-f4e9-4cb3-a210-6c3b2da999d7")
},
// Rejected by Reviewer Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("9e2ec648-1ca2-4747-9329-e911b18edb3e"),
PermissionId = Guid.Parse("1f4bda08-1873-449a-bb66-3e8222bd871b"),
StatusId = Guid.Parse("965eda62-7907-4963-b4a1-657fb0b2724b")
},
// Approval Pending Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("0b7926fc-a34b-4a5b-8c7d-1003480cf0fa"),
PermissionId = Guid.Parse("1f4bda08-1873-449a-bb66-3e8222bd871b"),
StatusId = Guid.Parse("4068007f-c92f-4f37-a907-bc15fe57d4d8")
},
// Rejected by Approver Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("cd15f9b9-be45-4deb-9c71-2f23f872dbcd"),
PermissionId = Guid.Parse("eaafdd76-8aac-45f9-a530-315589c6deca"),
StatusId = Guid.Parse("d1ee5eec-24b6-4364-8673-a8f859c60729")
},
// Payment Pending Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("f6f26b2f-2fa6-40b7-8601-cbd4bcdda0cc"),
PermissionId = Guid.Parse("eaafdd76-8aac-45f9-a530-315589c6deca"),
StatusId = Guid.Parse("f18c5cfd-7815-4341-8da2-2c2d65778e27")
},
// Processed Permission Mapping
new StatusPermissionMapping
{
Id = Guid.Parse("214354e5-daad-4569-ad69-eb5bf4e87fbc"),
PermissionId = Guid.Parse("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"),
StatusId = Guid.Parse("61578360-3a49-4c34-8604-7b35a3787b95")
});
modelBuilder.Entity<ExpensesTypeMaster>().HasData(
new ExpensesTypeMaster
{
Id = Guid.Parse("5e0c6227-d49d-41ff-9f1f-781f0aee2469"),
Name = "Procurement",
Description = "Materials, equipment and supplies purchased for site operations.",
NoOfPersonsRequired = false,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("2de53163-0dbd-404b-8e60-1b02e6b4886a"),
Name = "Transport",
Description = "Vehicle fuel, logistics services and delivery of goods or personnel.",
NoOfPersonsRequired = false,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("dd120bc4-ab0a-45ba-8450-5cd45ff221ca"),
Name = "Travelling",
Description = "Delivery of personnel.",
NoOfPersonsRequired = true,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("52484820-1b54-4865-8f0f-baa2b1d339b9"),
Name = "Mobilization",
Description = "Site setup costs including equipment deployment and temporary infrastructure.",
NoOfPersonsRequired = false,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("fc59eb90-98ea-481c-b421-54bfa9e42d8f"),
Name = "Employee Welfare",
Description = " Worker amenities like snacks, meals, safety gear, accommodation, medical support etc.",
NoOfPersonsRequired = true,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("77013784-9324-4d8b-bd36-d6f928e68942"),
Name = "Maintenance & Utilities",
Description = "Machinery servicing, electricity, water, and temporary office needs.",
NoOfPersonsRequired = false,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("1e2d697a-76b4-4be8-bc66-87144561a1a0"),
Name = "Vendor/Supplier Payments",
Description = "Scheduled payments for external services or goods.",
NoOfPersonsRequired = false,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new ExpensesTypeMaster
{
Id = Guid.Parse("4842fa61-64eb-4241-aebd-8282065af9f9"),
Name = "Compliance & Safety",
Description = "Government fees, insurance, inspections and safety-related expenditures.",
NoOfPersonsRequired = false,
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
modelBuilder.Entity<PaymentModeMatser>().HasData(
new PaymentModeMatser
{
Id = Guid.Parse("24e6b0df-7929-47d2-88a3-4cf14c1f28f9"),
Name = "Cash",
Description = "Physical currency; still used for small or informal transactions.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentModeMatser
{
Id = Guid.Parse("48d9b462-5d87-4dec-8dec-2bc943943172"),
Name = "Cheque",
Description = "Paper-based payment order; less common now due to processing delays and fraud risks.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentModeMatser
{
Id = Guid.Parse("ed667353-8eea-4fd1-8750-719405932480"),
Name = "NetBanking",
Description = "Online banking portals used to transfer funds directly between accounts",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new PaymentModeMatser
{
Id = Guid.Parse("2e919e94-694c-41d9-9489-0a2b4208a027"),
Name = "UPI",
Description = "Real-time bank-to-bank transfer using mobile apps; widely used for peer-to-peer and merchant payments.",
IsActive = true,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
modelBuilder.Entity<Module>().HasData(new Module
{
@ -475,54 +702,123 @@ namespace Marco.Pms.DataAccess.Data
Key = "504ec132-e6a9-422f-8f85-050602cfce05"
});
modelBuilder.Entity<Feature>().HasData(
new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
// Project Module
new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Project Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), Description = "Expense Management is the systematic process of tracking, controlling, and reporting business-related expenditures.", Name = "Expense Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
// Employee Module
new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true },
// Master Module
new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true },
new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }
//new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }
);
modelBuilder.Entity<FeaturePermission>().HasData(
// Project Management Feature
new FeaturePermission { Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "View Project", Description = "Access all information related to the project." },
new FeaturePermission { Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Project", Description = "Potentially edit the project name, description, start/end dates, or status." },
new FeaturePermission { Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Team", Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects." },
new FeaturePermission { Id = new Guid("8d7cc6e3-9147-41f7-aaa7-fa507e450bd4"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "View Project Infra", Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations" },
new FeaturePermission { Id = new Guid("cf2825ad-453b-46aa-91d9-27c124d63373"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Project Infra", Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure." },
new FeaturePermission { Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), IsEnabled = true, Name = "View Project Infra", Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations" },
new FeaturePermission { Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), IsEnabled = true, Name = "Manage Project Infra", Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure." },
// Task Management Feature
new FeaturePermission { Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "View Task", Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions." },
new FeaturePermission { Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Add/Edit Task", Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.)," },
new FeaturePermission { Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Assign/Report Progress", Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks" },
new FeaturePermission { Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Approve Task", Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria" },
new FeaturePermission { Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View Employee", Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
// Employee Management Feature
new FeaturePermission { Id = new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View All Employees", Description = "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
new FeaturePermission { Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View Team Members", Description = "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
new FeaturePermission { Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Add/Edit Employee", Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data" },
new FeaturePermission { Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Assign Roles", Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system." },
// Attendance Management Feature
new FeaturePermission { Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Team Attendance ", Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager." },
new FeaturePermission { Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Regularize Attendance", Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records" },
new FeaturePermission { Id = new Guid("ccb0589f-712b-43de-92ed-5b6088e7dc4e"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Self Attendance", Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager." },
// Masters Feature
new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" },
new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" },
// Directory Management Feature
new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." },
new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." },
new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." }
//new FeaturePermission { Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "Manage Masters", Description = "" }
new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." },
// Expense Management Feature
new FeaturePermission { Id = new Guid("385be49f-8fde-440e-bdbc-3dffeb8dd116"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "View Self", Description = "Allows a user to view only the expense records that they have personally submitted" },
new FeaturePermission { Id = new Guid("01e06444-9ca7-4df4-b900-8c3fa051b92f"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "View All", Description = "Allows a user to view all expense records across the organization or project, regardless of who submitted or paid them" },
new FeaturePermission { Id = new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Upload", Description = "Allows a user to create and submit new expense records, including attaching relevant documents like receipts or invoices." },
new FeaturePermission { Id = new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Review", Description = "Allows a user to examine submitted expenses for accuracy, completeness, and policy compliance before they are approved or rejected." },
new FeaturePermission { Id = new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Approve", Description = "Allows a user to authorize or reject submitted expenses, making them officially accepted or declined within the system." },
new FeaturePermission { Id = new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Process", Description = "Allows a user to handle post-approval actions such as recording payments, updating financial records, or marking expenses as reimbursed or settled." },
new FeaturePermission { Id = new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"), FeatureId = new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), IsEnabled = true, Name = "Manage", Description = "Allows a user to configure and control system settings, such as managing expense types, payment modes, permissions, and overall workflow rules." }
);
modelBuilder.Entity<CurrencyMaster>().HasData(
new CurrencyMaster
{
Id = Guid.Parse("78e96e4a-7ce0-4164-ae3a-c833ad45ec2c"),
CurrencyCode = "INR",
CurrencyName = "Indian Rupee",
Symbol = "₹",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("2f672568-a67b-4961-acb2-a8c7834e1762"),
CurrencyCode = "USD",
CurrencyName = "US Dollar",
Symbol = "$",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("4d1155bb-1448-4d97-a732-96c92eb99c45"),
CurrencyCode = "EUR",
CurrencyName = "Euro",
Symbol = "€",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("3e456237-ef06-4ea1-a261-188c9b0c6df6"),
CurrencyCode = "GBP",
CurrencyName = "Pound Sterling",
Symbol = "£",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("297e237a-56d3-48f6-b39d-ec3991dea8bf"),
CurrencyCode = "JPY",
CurrencyName = "Japanese Yen",
Symbol = "¥",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("efe9b4f6-64d6-446e-a42d-1c7aaf6dd70d"),
CurrencyCode = "RUB",
CurrencyName = "Russian Ruble",
Symbol = "₽",
IsActive = true
},
new CurrencyMaster
{
Id = Guid.Parse("b960166a-f7e9-49e3-bb4b-28511f126c08"),
CurrencyCode = "CNY",
CurrencyName = "Chinese Yuan (Renminbi)",
Symbol = "¥",
IsActive = true
}
);
}
}

View File

@ -1274,7 +1274,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1295,7 +1295,7 @@ namespace Marco.Pms.DataAccess.Migrations
columns: new[] { "Id", "ColorCode", "Description", "IsDefault", "Name", "TenantId" },
values: new object[,]
{
{ new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), "#6c757d", "These issues are currently under review", true, "In Review", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), "#8592a3", "These issues are currently under review", true, "In Review", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), "#FFCC99", "This is a newly created issue.", true, "New", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), "#E6FF99", "Assigned to employee or team of employees", true, "Assigned", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), "#99E6FF", "These issues are currently in progress", true, "In Progress", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },

View File

@ -1216,7 +1216,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1222,7 +1222,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1299,7 +1299,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1299,7 +1299,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1267,7 +1267,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1602,7 +1602,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1626,7 +1626,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1593,7 +1593,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1633,7 +1633,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1358,7 +1358,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1366,7 +1366,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1425,7 +1425,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1425,7 +1425,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1428,7 +1428,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

View File

@ -1428,7 +1428,7 @@ namespace Marco.Pms.DataAccess.Migrations
new
{
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
ColorCode = "#6c757d",
ColorCode = "#8592a3",
Description = "These issues are currently under review",
IsDefault = true,
Name = "In Review",

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_TaskAttachments_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TaskAttachments",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ReferenceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TaskAttachments", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TaskAttachments");
}
}
}

View File

@ -0,0 +1,188 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_Apporved_By_In_TaskAllocation_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "ApprovedById",
table: "TaskAllocations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<DateTime>(
name: "ApprovedDate",
table: "TaskAllocations",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ParentTaskId",
table: "TaskAllocations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "ReportedById",
table: "TaskAllocations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<double>(
name: "ReportedTask",
table: "TaskAllocations",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<Guid>(
name: "WorkStatusId",
table: "TaskAllocations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateTable(
name: "WorkStatusMasters",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_WorkStatusMasters", x => x.Id);
table.ForeignKey(
name: "FK_WorkStatusMasters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "WorkStatusMasters",
columns: new[] { "Id", "Description", "IsSystem", "Name", "TenantId" },
values: new object[,]
{
{ new Guid("00a062e6-62e6-42c5-b6b1-024328651b72"), "Tasks are not finished as reported or have any issues in al the tasks", true, "NCR", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("030bb085-e230-4370-aec7-9a74d652864e"), "Confirm the tasks are actually finished as reported", true, "Approve", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("2a1a5b96-cf93-4111-b4b1-76c19d6333b4"), "Not all tasks are actually finished as reported", true, "Partially Approve", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.CreateIndex(
name: "IX_TaskAllocations_ApprovedById",
table: "TaskAllocations",
column: "ApprovedById");
migrationBuilder.CreateIndex(
name: "IX_TaskAllocations_ReportedById",
table: "TaskAllocations",
column: "ReportedById");
migrationBuilder.CreateIndex(
name: "IX_TaskAllocations_WorkStatusId",
table: "TaskAllocations",
column: "WorkStatusId");
migrationBuilder.CreateIndex(
name: "IX_WorkStatusMasters_TenantId",
table: "WorkStatusMasters",
column: "TenantId");
migrationBuilder.AddForeignKey(
name: "FK_TaskAllocations_Employees_ApprovedById",
table: "TaskAllocations",
column: "ApprovedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_TaskAllocations_Employees_ReportedById",
table: "TaskAllocations",
column: "ReportedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_TaskAllocations_WorkStatusMasters_WorkStatusId",
table: "TaskAllocations",
column: "WorkStatusId",
principalTable: "WorkStatusMasters",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TaskAllocations_Employees_ApprovedById",
table: "TaskAllocations");
migrationBuilder.DropForeignKey(
name: "FK_TaskAllocations_Employees_ReportedById",
table: "TaskAllocations");
migrationBuilder.DropForeignKey(
name: "FK_TaskAllocations_WorkStatusMasters_WorkStatusId",
table: "TaskAllocations");
migrationBuilder.DropTable(
name: "WorkStatusMasters");
migrationBuilder.DropIndex(
name: "IX_TaskAllocations_ApprovedById",
table: "TaskAllocations");
migrationBuilder.DropIndex(
name: "IX_TaskAllocations_ReportedById",
table: "TaskAllocations");
migrationBuilder.DropIndex(
name: "IX_TaskAllocations_WorkStatusId",
table: "TaskAllocations");
migrationBuilder.DropColumn(
name: "ApprovedById",
table: "TaskAllocations");
migrationBuilder.DropColumn(
name: "ApprovedDate",
table: "TaskAllocations");
migrationBuilder.DropColumn(
name: "ParentTaskId",
table: "TaskAllocations");
migrationBuilder.DropColumn(
name: "ReportedById",
table: "TaskAllocations");
migrationBuilder.DropColumn(
name: "ReportedTask",
table: "TaskAllocations");
migrationBuilder.DropColumn(
name: "WorkStatusId",
table: "TaskAllocations");
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class EnhancedWorkItemForParentId_Description : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Description",
table: "WorkItems",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "ParentTaskId",
table: "WorkItems",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Description",
table: "WorkItems");
migrationBuilder.DropColumn(
name: "ParentTaskId",
table: "WorkItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_New_Status_Master_In_Progress : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
column: "Status",
value: "On Hold");
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
column: "Status",
value: "In Active");
migrationBuilder.InsertData(
table: "StatusMasters",
columns: new[] { "Id", "Status", "TenantId" },
values: new object[] { new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"), "In Progress", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"));
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
column: "Status",
value: "In Progress");
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
column: "Status",
value: "On Hold");
}
}
}

View File

@ -0,0 +1,101 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_UpdatedBy_In_Contacts_And_ContactNotes_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedAt",
table: "Contacts",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "UpdatedById",
table: "Contacts",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedAt",
table: "ContactNotes",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "UpdatedById",
table: "ContactNotes",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_Contacts_UpdatedById",
table: "Contacts",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_ContactNotes_UpdatedById",
table: "ContactNotes",
column: "UpdatedById");
migrationBuilder.AddForeignKey(
name: "FK_ContactNotes_Employees_UpdatedById",
table: "ContactNotes",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Contacts_Employees_UpdatedById",
table: "Contacts",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ContactNotes_Employees_UpdatedById",
table: "ContactNotes");
migrationBuilder.DropForeignKey(
name: "FK_Contacts_Employees_UpdatedById",
table: "Contacts");
migrationBuilder.DropIndex(
name: "IX_Contacts_UpdatedById",
table: "Contacts");
migrationBuilder.DropIndex(
name: "IX_ContactNotes_UpdatedById",
table: "ContactNotes");
migrationBuilder.DropColumn(
name: "UpdatedAt",
table: "Contacts");
migrationBuilder.DropColumn(
name: "UpdatedById",
table: "Contacts");
migrationBuilder.DropColumn(
name: "UpdatedAt",
table: "ContactNotes");
migrationBuilder.DropColumn(
name: "UpdatedById",
table: "ContactNotes");
}
}
}

View File

@ -0,0 +1,131 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_New_Feature_Permissiom_View_All_Employee : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("f2aee20a-b754-4537-8166-f9507b44585b"));
migrationBuilder.DeleteData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"));
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
column: "Description",
value: "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data");
migrationBuilder.InsertData(
table: "FeaturePermissions",
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
values: new object[,]
{
{ new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"), "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "View All Employee" },
{ new Guid("8d7cc6e3-9147-41f7-aaa7-fa507e450bd4"), "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "View Project Infra" },
{ new Guid("cf2825ad-453b-46aa-91d9-27c124d63373"), "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Project Infra" }
});
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"),
column: "Name",
value: "Attendance Management");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"),
column: "Name",
value: "Project Management");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"),
column: "Name",
value: "Masters");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("8d7cc6e3-9147-41f7-aaa7-fa507e450bd4"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("cf2825ad-453b-46aa-91d9-27c124d63373"));
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
column: "Description",
value: "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"),
column: "Name",
value: "Attendance");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"),
column: "Name",
value: "Manage Project");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"),
column: "Name",
value: "Global Masters");
migrationBuilder.InsertData(
table: "Features",
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
values: new object[] { new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), "Manage Infra", true, new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), "Manage Infra" });
migrationBuilder.InsertData(
table: "FeaturePermissions",
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
values: new object[,]
{
{ new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "View Project Infra" },
{ new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "Manage Project Infra" }
});
}
}
}

View File

@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Changed_Name_Of_Feature_Permission_To_ViewTeamMembers : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"),
column: "Name",
value: "View All Employees");
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
column: "Name",
value: "View Team Members");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"),
column: "Name",
value: "View All Employee");
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
column: "Name",
value: "View Employee");
}
}
}

View File

@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_UploadedBy_ForeginKey_In_Decuments_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "UploadedById",
table: "Documents",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_Documents_UploadedById",
table: "Documents",
column: "UploadedById");
migrationBuilder.AddForeignKey(
name: "FK_Documents_Employees_UploadedById",
table: "Documents",
column: "UploadedById",
principalTable: "Employees",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Documents_Employees_UploadedById",
table: "Documents");
migrationBuilder.DropIndex(
name: "IX_Documents_UploadedById",
table: "Documents");
migrationBuilder.DropColumn(
name: "UploadedById",
table: "Documents");
}
}
}

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_Designation_Paraneter_In_Contacts_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Designation",
table: "Contacts",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Designation",
table: "Contacts");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,664 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_Expense_Related_Tables : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ExpensesReimburse",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ReimburseTransactionId = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ReimburseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
ReimburseById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ReimburseNote = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpensesReimburse", x => x.Id);
table.ForeignKey(
name: "FK_ExpensesReimburse_Employees_ReimburseById",
column: x => x.ReimburseById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpensesReimburse_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ExpensesStatusMaster",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DisplayName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Color = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpensesStatusMaster", x => x.Id);
table.ForeignKey(
name: "FK_ExpensesStatusMaster_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ExpensesTypeMaster",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
NoOfPersonsRequired = table.Column<bool>(type: "tinyint(1)", nullable: false),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpensesTypeMaster", x => x.Id);
table.ForeignKey(
name: "FK_ExpensesTypeMaster_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "PaymentModeMatser",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentModeMatser", x => x.Id);
table.ForeignKey(
name: "FK_PaymentModeMatser_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ExpensesStatusMapping",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
StatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
NextStatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpensesStatusMapping", x => x.Id);
table.ForeignKey(
name: "FK_ExpensesStatusMapping_ExpensesStatusMaster_NextStatusId",
column: x => x.NextStatusId,
principalTable: "ExpensesStatusMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpensesStatusMapping_ExpensesStatusMaster_StatusId",
column: x => x.StatusId,
principalTable: "ExpensesStatusMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpensesStatusMapping_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "StatusPermissionMapping",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
StatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PermissionId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_StatusPermissionMapping", x => x.Id);
table.ForeignKey(
name: "FK_StatusPermissionMapping_ExpensesStatusMaster_StatusId",
column: x => x.StatusId,
principalTable: "ExpensesStatusMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StatusPermissionMapping_FeaturePermissions_PermissionId",
column: x => x.PermissionId,
principalTable: "FeaturePermissions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StatusPermissionMapping_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Expenses",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ProjectId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExpensesTypeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PaymentModeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PaidById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TransactionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
TransactionId = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Location = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
GSTNumber = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplerName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Amount = table.Column<double>(type: "double", nullable: false),
NoOfPersons = table.Column<int>(type: "int", nullable: true),
StatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PreApproved = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_Expenses", x => x.Id);
table.ForeignKey(
name: "FK_Expenses_Employees_CreatedById",
column: x => x.CreatedById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Expenses_Employees_PaidById",
column: x => x.PaidById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Expenses_ExpensesStatusMaster_StatusId",
column: x => x.StatusId,
principalTable: "ExpensesStatusMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Expenses_ExpensesTypeMaster_ExpensesTypeId",
column: x => x.ExpensesTypeId,
principalTable: "ExpensesTypeMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Expenses_PaymentModeMatser_PaymentModeId",
column: x => x.PaymentModeId,
principalTable: "PaymentModeMatser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Expenses_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Expenses_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "BillAttachments",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExpensesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_BillAttachments", x => x.Id);
table.ForeignKey(
name: "FK_BillAttachments_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BillAttachments_Expenses_ExpensesId",
column: x => x.ExpensesId,
principalTable: "Expenses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BillAttachments_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ExpenseLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExpenseId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Action = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Comment = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpenseLogs", x => x.Id);
table.ForeignKey(
name: "FK_ExpenseLogs_Employees_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpenseLogs_Expenses_ExpenseId",
column: x => x.ExpenseId,
principalTable: "Expenses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpenseLogs_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ExpensesReimburseMapping",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExpensesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ExpensesReimburseId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ExpensesReimburseMapping", x => x.Id);
table.ForeignKey(
name: "FK_ExpensesReimburseMapping_ExpensesReimburse_ExpensesReimburse~",
column: x => x.ExpensesReimburseId,
principalTable: "ExpensesReimburse",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpensesReimburseMapping_Expenses_ExpensesId",
column: x => x.ExpensesId,
principalTable: "Expenses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ExpensesReimburseMapping_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "ExpensesStatusMaster",
columns: new[] { "Id", "Color", "Description", "DisplayName", "IsActive", "IsSystem", "Name", "TenantId" },
values: new object[,]
{
{ new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8"), "#8592a3", "Expense has been created but not yet submitted.", "Draft", true, true, "Draft", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), "#03c3ec", "Review is completed, waiting for action of approver.", "Mark as Reviewed", true, true, "Approval Pending", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("61578360-3a49-4c34-8604-7b35a3787b95"), "#71dd37", "Expense has been settled.", "Mark as Paid", true, true, "Paid", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), "#696cff", "Reviewer is currently reviewing the expense.", "Submit", true, true, "Review Pending", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), "#ff3e1d", "Expense was declined, often with a reason(either review rejected or approval rejected.", "Reject", true, true, "Rejected", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), "#ffab00", "Approved expense is awaiting final payment.", "Mark as Approved", true, true, "Payment Pending", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.InsertData(
table: "ExpensesTypeMaster",
columns: new[] { "Id", "Description", "IsActive", "Name", "NoOfPersonsRequired", "TenantId" },
values: new object[,]
{
{ new Guid("1e2d697a-76b4-4be8-bc66-87144561a1a0"), "Scheduled payments for external services or goods.", true, "Vendor/Supplier Payments", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("2de53163-0dbd-404b-8e60-1b02e6b4886a"), "Vehicle fuel, logistics services and delivery of goods or personnel.", true, "Transport", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("4842fa61-64eb-4241-aebd-8282065af9f9"), "Government fees, insurance, inspections and safety-related expenditures.", true, "Compliance & Safety", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("52484820-1b54-4865-8f0f-baa2b1d339b9"), "Site setup costs including equipment deployment and temporary infrastructure.", true, "Mobilization", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("5e0c6227-d49d-41ff-9f1f-781f0aee2469"), "Materials, equipment and supplies purchased for site operations.", true, "Procurement", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("77013784-9324-4d8b-bd36-d6f928e68942"), "Machinery servicing, electricity, water, and temporary office needs.", true, "Maintenance & Utilities", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("dd120bc4-ab0a-45ba-8450-5cd45ff221ca"), "Delivery of personnel.", true, "Travelling", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("fc59eb90-98ea-481c-b421-54bfa9e42d8f"), " Worker amenities like snacks, meals, safety gear, accommodation, medical support etc.", true, "Employee Welfare", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.InsertData(
table: "Features",
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
values: new object[] { new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), "Expense Management is the systematic process of tracking, controlling, and reporting business-related expenditures.", true, new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), "Expense Management" });
migrationBuilder.InsertData(
table: "PaymentModeMatser",
columns: new[] { "Id", "Description", "IsActive", "Name", "TenantId" },
values: new object[,]
{
{ new Guid("24e6b0df-7929-47d2-88a3-4cf14c1f28f9"), "Physical currency; still used for small or informal transactions.", true, "Cash", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("2e919e94-694c-41d9-9489-0a2b4208a027"), "Real-time bank-to-bank transfer using mobile apps; widely used for peer-to-peer and merchant payments.", true, "UPI", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("48d9b462-5d87-4dec-8dec-2bc943943172"), "Paper-based payment order; less common now due to processing delays and fraud risks.", true, "Cheque", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("ed667353-8eea-4fd1-8750-719405932480"), "Online banking portals used to transfer funds directly between accounts", true, "NetBanking", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.InsertData(
table: "ExpensesStatusMapping",
columns: new[] { "Id", "NextStatusId", "StatusId", "TenantId" },
values: new object[,]
{
{ new Guid("1fca1700-1266-477d-bba4-9ac3753aa33c"), new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("36c00548-241c-43ec-bc95-cacebedb925c"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("5cf7f1df-9d1f-4289-add0-1775ad614f25"), new Guid("61578360-3a49-4c34-8604-7b35a3787b95"), new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("75bbda6a-6a53-47d1-ad71-5f5f9446a11e"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("af1e4492-98ee-4451-8ab7-fd8323f29c32"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("ef1fcfbc-60e0-4f17-9308-c583a05d48fd"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("fddaaf20-4ccc-4f4e-a724-dd310272b356"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.InsertData(
table: "FeaturePermissions",
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
values: new object[,]
{
{ new Guid("01e06444-9ca7-4df4-b900-8c3fa051b92f"), "Allows a user to view all expense records across the organization or project, regardless of who submitted or paid them", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "View All" },
{ new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), "Allows a user to create and submit new expense records, including attaching relevant documents like receipts or invoices.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Upload" },
{ new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), "Allows a user to examine submitted expenses for accuracy, completeness, and policy compliance before they are approved or rejected.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Review" },
{ new Guid("385be49f-8fde-440e-bdbc-3dffeb8dd116"), "Allows a user to view only the expense records that they have personally submitted", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "View Self" },
{ new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"), "Allows a user to configure and control system settings, such as managing expense types, payment modes, permissions, and overall workflow rules.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Manage" },
{ new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), "Allows a user to handle post-approval actions such as recording payments, updating financial records, or marking expenses as reimbursed or settled.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Process" },
{ new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), "Allows a user to authorize or reject submitted expenses, making them officially accepted or declined within the system.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Approve" }
});
migrationBuilder.InsertData(
table: "StatusPermissionMapping",
columns: new[] { "Id", "PermissionId", "StatusId", "TenantId" },
values: new object[,]
{
{ new Guid("214354e5-daad-4569-ad69-eb5bf4e87fbc"), new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), new Guid("61578360-3a49-4c34-8604-7b35a3787b95"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("4652d73f-fc71-4fe1-9f2f-1e48b342d741"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("cd15f9b9-be45-4deb-9c71-2f23f872dbcd"), new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("ed893799-1a5f-4311-a077-de93c86ca8fd"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("f6f26b2f-2fa6-40b7-8601-cbd4bcdda0cc"), new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.CreateIndex(
name: "IX_BillAttachments_DocumentId",
table: "BillAttachments",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_BillAttachments_ExpensesId",
table: "BillAttachments",
column: "ExpensesId");
migrationBuilder.CreateIndex(
name: "IX_BillAttachments_TenantId",
table: "BillAttachments",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpenseLogs_ExpenseId",
table: "ExpenseLogs",
column: "ExpenseId");
migrationBuilder.CreateIndex(
name: "IX_ExpenseLogs_TenantId",
table: "ExpenseLogs",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpenseLogs_UpdatedById",
table: "ExpenseLogs",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_Expenses_CreatedById",
table: "Expenses",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_Expenses_ExpensesTypeId",
table: "Expenses",
column: "ExpensesTypeId");
migrationBuilder.CreateIndex(
name: "IX_Expenses_PaidById",
table: "Expenses",
column: "PaidById");
migrationBuilder.CreateIndex(
name: "IX_Expenses_PaymentModeId",
table: "Expenses",
column: "PaymentModeId");
migrationBuilder.CreateIndex(
name: "IX_Expenses_ProjectId",
table: "Expenses",
column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_Expenses_StatusId",
table: "Expenses",
column: "StatusId");
migrationBuilder.CreateIndex(
name: "IX_Expenses_TenantId",
table: "Expenses",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesReimburse_ReimburseById",
table: "ExpensesReimburse",
column: "ReimburseById");
migrationBuilder.CreateIndex(
name: "IX_ExpensesReimburse_TenantId",
table: "ExpensesReimburse",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesReimburseMapping_ExpensesId",
table: "ExpensesReimburseMapping",
column: "ExpensesId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesReimburseMapping_ExpensesReimburseId",
table: "ExpensesReimburseMapping",
column: "ExpensesReimburseId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesReimburseMapping_TenantId",
table: "ExpensesReimburseMapping",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesStatusMapping_NextStatusId",
table: "ExpensesStatusMapping",
column: "NextStatusId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesStatusMapping_StatusId",
table: "ExpensesStatusMapping",
column: "StatusId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesStatusMapping_TenantId",
table: "ExpensesStatusMapping",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesStatusMaster_TenantId",
table: "ExpensesStatusMaster",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesTypeMaster_TenantId",
table: "ExpensesTypeMaster",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_PaymentModeMatser_TenantId",
table: "PaymentModeMatser",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_StatusPermissionMapping_PermissionId",
table: "StatusPermissionMapping",
column: "PermissionId");
migrationBuilder.CreateIndex(
name: "IX_StatusPermissionMapping_StatusId",
table: "StatusPermissionMapping",
column: "StatusId");
migrationBuilder.CreateIndex(
name: "IX_StatusPermissionMapping_TenantId",
table: "StatusPermissionMapping",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BillAttachments");
migrationBuilder.DropTable(
name: "ExpenseLogs");
migrationBuilder.DropTable(
name: "ExpensesReimburseMapping");
migrationBuilder.DropTable(
name: "ExpensesStatusMapping");
migrationBuilder.DropTable(
name: "StatusPermissionMapping");
migrationBuilder.DropTable(
name: "ExpensesReimburse");
migrationBuilder.DropTable(
name: "Expenses");
migrationBuilder.DropTable(
name: "ExpensesStatusMaster");
migrationBuilder.DropTable(
name: "ExpensesTypeMaster");
migrationBuilder.DropTable(
name: "PaymentModeMatser");
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("01e06444-9ca7-4df4-b900-8c3fa051b92f"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("385be49f-8fde-440e-bdbc-3dffeb8dd116"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"));
migrationBuilder.DeleteData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"));
}
}
}

View File

@ -0,0 +1,437 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Change_ExpenseStatus_To_Be_System_Scope : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ExpensesStatusMapping_Tenants_TenantId",
table: "ExpensesStatusMapping");
migrationBuilder.DropForeignKey(
name: "FK_ExpensesStatusMaster_Tenants_TenantId",
table: "ExpensesStatusMaster");
migrationBuilder.DropForeignKey(
name: "FK_StatusPermissionMapping_Tenants_TenantId",
table: "StatusPermissionMapping");
migrationBuilder.DropIndex(
name: "IX_StatusPermissionMapping_TenantId",
table: "StatusPermissionMapping");
migrationBuilder.DropIndex(
name: "IX_ExpensesStatusMaster_TenantId",
table: "ExpensesStatusMaster");
migrationBuilder.DropIndex(
name: "IX_ExpensesStatusMapping_TenantId",
table: "ExpensesStatusMapping");
migrationBuilder.DeleteData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("75bbda6a-6a53-47d1-ad71-5f5f9446a11e"));
migrationBuilder.DeleteData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("fddaaf20-4ccc-4f4e-a724-dd310272b356"));
migrationBuilder.DeleteData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("4652d73f-fc71-4fe1-9f2f-1e48b342d741"));
migrationBuilder.DeleteData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("ed893799-1a5f-4311-a077-de93c86ca8fd"));
migrationBuilder.DropColumn(
name: "TenantId",
table: "StatusPermissionMapping");
migrationBuilder.DropColumn(
name: "TenantId",
table: "ExpensesStatusMaster");
migrationBuilder.DropColumn(
name: "TenantId",
table: "ExpensesStatusMapping");
migrationBuilder.AddColumn<Guid>(
name: "ApprovedById",
table: "Expenses",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "ProcessedById",
table: "Expenses",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "ReviewedById",
table: "Expenses",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.InsertData(
table: "ExpensesStatusMapping",
columns: new[] { "Id", "NextStatusId", "StatusId" },
values: new object[] { new Guid("4ddddc10-0ffd-4884-accf-d4fa0bd97f54"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729") });
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("61578360-3a49-4c34-8604-7b35a3787b95"),
columns: new[] { "DisplayName", "Name" },
values: new object[] { "Mark as Processed", "Processed" });
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"),
columns: new[] { "Description", "Name" },
values: new object[] { "Expense was declined, often with a reason(approval rejected).", "Rejected by Approver" });
migrationBuilder.InsertData(
table: "ExpensesStatusMaster",
columns: new[] { "Id", "Color", "Description", "DisplayName", "IsActive", "IsSystem", "Name" },
values: new object[] { new Guid("965eda62-7907-4963-b4a1-657fb0b2724b"), "#ff3e1d", "Expense was declined, often with a reason(review rejected).", "Reject", true, true, "Rejected by Reviewer" });
migrationBuilder.InsertData(
table: "StatusPermissionMapping",
columns: new[] { "Id", "PermissionId", "StatusId" },
values: new object[,]
{
{ new Guid("0b7926fc-a34b-4a5b-8c7d-1003480cf0fa"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8") },
{ new Guid("722b0c3c-5a78-456d-b9bb-b6ba1b21d59b"), new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8") },
{ new Guid("7deb0945-e1c9-411f-8b3c-c9bdbe3c3c2d"), new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7") }
});
migrationBuilder.InsertData(
table: "ExpensesStatusMapping",
columns: new[] { "Id", "NextStatusId", "StatusId" },
values: new object[,]
{
{ new Guid("6b867bec-66e6-42a7-9611-f4595af9b9ce"), new Guid("965eda62-7907-4963-b4a1-657fb0b2724b"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7") },
{ new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("965eda62-7907-4963-b4a1-657fb0b2724b") }
});
migrationBuilder.InsertData(
table: "StatusPermissionMapping",
columns: new[] { "Id", "PermissionId", "StatusId" },
values: new object[] { new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("965eda62-7907-4963-b4a1-657fb0b2724b") });
migrationBuilder.CreateIndex(
name: "IX_Expenses_ApprovedById",
table: "Expenses",
column: "ApprovedById");
migrationBuilder.CreateIndex(
name: "IX_Expenses_ProcessedById",
table: "Expenses",
column: "ProcessedById");
migrationBuilder.CreateIndex(
name: "IX_Expenses_ReviewedById",
table: "Expenses",
column: "ReviewedById");
migrationBuilder.AddForeignKey(
name: "FK_Expenses_Employees_ApprovedById",
table: "Expenses",
column: "ApprovedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Expenses_Employees_ProcessedById",
table: "Expenses",
column: "ProcessedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Expenses_Employees_ReviewedById",
table: "Expenses",
column: "ReviewedById",
principalTable: "Employees",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Expenses_Employees_ApprovedById",
table: "Expenses");
migrationBuilder.DropForeignKey(
name: "FK_Expenses_Employees_ProcessedById",
table: "Expenses");
migrationBuilder.DropForeignKey(
name: "FK_Expenses_Employees_ReviewedById",
table: "Expenses");
migrationBuilder.DropIndex(
name: "IX_Expenses_ApprovedById",
table: "Expenses");
migrationBuilder.DropIndex(
name: "IX_Expenses_ProcessedById",
table: "Expenses");
migrationBuilder.DropIndex(
name: "IX_Expenses_ReviewedById",
table: "Expenses");
migrationBuilder.DeleteData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("4ddddc10-0ffd-4884-accf-d4fa0bd97f54"));
migrationBuilder.DeleteData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("6b867bec-66e6-42a7-9611-f4595af9b9ce"));
migrationBuilder.DeleteData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"));
migrationBuilder.DeleteData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("0b7926fc-a34b-4a5b-8c7d-1003480cf0fa"));
migrationBuilder.DeleteData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("722b0c3c-5a78-456d-b9bb-b6ba1b21d59b"));
migrationBuilder.DeleteData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("7deb0945-e1c9-411f-8b3c-c9bdbe3c3c2d"));
migrationBuilder.DeleteData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"));
migrationBuilder.DeleteData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("965eda62-7907-4963-b4a1-657fb0b2724b"));
migrationBuilder.DropColumn(
name: "ApprovedById",
table: "Expenses");
migrationBuilder.DropColumn(
name: "ProcessedById",
table: "Expenses");
migrationBuilder.DropColumn(
name: "ReviewedById",
table: "Expenses");
migrationBuilder.AddColumn<Guid>(
name: "TenantId",
table: "StatusPermissionMapping",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "TenantId",
table: "ExpensesStatusMaster",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "TenantId",
table: "ExpensesStatusMapping",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.UpdateData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("1fca1700-1266-477d-bba4-9ac3753aa33c"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("36c00548-241c-43ec-bc95-cacebedb925c"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("5cf7f1df-9d1f-4289-add0-1775ad614f25"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("af1e4492-98ee-4451-8ab7-fd8323f29c32"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMapping",
keyColumn: "Id",
keyValue: new Guid("ef1fcfbc-60e0-4f17-9308-c583a05d48fd"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.InsertData(
table: "ExpensesStatusMapping",
columns: new[] { "Id", "NextStatusId", "StatusId", "TenantId" },
values: new object[,]
{
{ new Guid("75bbda6a-6a53-47d1-ad71-5f5f9446a11e"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("fddaaf20-4ccc-4f4e-a724-dd310272b356"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("61578360-3a49-4c34-8604-7b35a3787b95"),
columns: new[] { "DisplayName", "Name", "TenantId" },
values: new object[] { "Mark as Paid", "Paid", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") });
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"),
columns: new[] { "Description", "Name", "TenantId" },
values: new object[] { "Expense was declined, often with a reason(either review rejected or approval rejected.", "Rejected", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") });
migrationBuilder.UpdateData(
table: "ExpensesStatusMaster",
keyColumn: "Id",
keyValue: new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("214354e5-daad-4569-ad69-eb5bf4e87fbc"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("cd15f9b9-be45-4deb-9c71-2f23f872dbcd"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusPermissionMapping",
keyColumn: "Id",
keyValue: new Guid("f6f26b2f-2fa6-40b7-8601-cbd4bcdda0cc"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.InsertData(
table: "StatusPermissionMapping",
columns: new[] { "Id", "PermissionId", "StatusId", "TenantId" },
values: new object[,]
{
{ new Guid("4652d73f-fc71-4fe1-9f2f-1e48b342d741"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("ed893799-1a5f-4311-a077-de93c86ca8fd"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.CreateIndex(
name: "IX_StatusPermissionMapping_TenantId",
table: "StatusPermissionMapping",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesStatusMaster_TenantId",
table: "ExpensesStatusMaster",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ExpensesStatusMapping_TenantId",
table: "ExpensesStatusMapping",
column: "TenantId");
migrationBuilder.AddForeignKey(
name: "FK_ExpensesStatusMapping_Tenants_TenantId",
table: "ExpensesStatusMapping",
column: "TenantId",
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ExpensesStatusMaster_Tenants_TenantId",
table: "ExpensesStatusMaster",
column: "TenantId",
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_StatusPermissionMapping_Tenants_TenantId",
table: "StatusPermissionMapping",
column: "TenantId",
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_CurrencyMaster_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CurrencyMaster",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CurrencyCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CurrencyName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Symbol = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CurrencyMaster", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "CurrencyMaster",
columns: new[] { "Id", "CurrencyCode", "CurrencyName", "IsActive", "Symbol" },
values: new object[,]
{
{ new Guid("297e237a-56d3-48f6-b39d-ec3991dea8bf"), "JPY", "Japanese Yen", true, "¥" },
{ new Guid("2f672568-a67b-4961-acb2-a8c7834e1762"), "USD", "US Dollar", true, "$" },
{ new Guid("3e456237-ef06-4ea1-a261-188c9b0c6df6"), "GBP", "Pound Sterling", true, "£" },
{ new Guid("4d1155bb-1448-4d97-a732-96c92eb99c45"), "EUR", "Euro", true, "€" },
{ new Guid("78e96e4a-7ce0-4164-ae3a-c833ad45ec2c"), "INR", "Indian Rupee", true, "₹" },
{ new Guid("b960166a-f7e9-49e3-bb4b-28511f126c08"), "CNY", "Chinese Yuan (Renminbi)", true, "¥" },
{ new Guid("efe9b4f6-64d6-446e-a42d-1c7aaf6dd70d"), "RUB", "Russian Ruble", true, "₽" }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CurrencyMaster");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_Updated_At_In_UpdateLogs : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "UpdateAt",
table: "ExpenseLogs",
type: "datetime(6)",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UpdateAt",
table: "ExpenseLogs");
}
}
}

View File

@ -0,0 +1,201 @@
using Marco.Pms.Model.MongoDBModels.Employees;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MongoDB.Driver;
namespace Marco.Pms.Helpers.CacheHelper
{
public class EmployeeCache
{
private readonly IMongoCollection<EmployeePermissionMongoDB> _collection;
public EmployeeCache(IConfiguration configuration)
{
var connectionString = configuration["MongoDB:ConnectionString"];
var mongoUrl = new MongoUrl(connectionString);
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
_collection = mongoDB.GetCollection<EmployeePermissionMongoDB>("EmployeeProfile");
}
public async Task<bool> AddApplicationRoleToCache(Guid employeeId, List<string> newRoleIds, List<string> newPermissionIds)
{
// 2. Perform database queries concurrently for better performance.
var employeeIdString = employeeId.ToString();
// 5. Build a single, efficient update operation.
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeIdString);
var update = Builders<EmployeePermissionMongoDB>.Update
.AddToSetEach(e => e.ApplicationRoleIds, newRoleIds)
.Set(r => r.ExpireAt, DateTime.UtcNow.Date.AddDays(1))
.AddToSetEach(e => e.PermissionIds, newPermissionIds);
var options = new UpdateOptions { IsUpsert = true };
var result = await _collection.UpdateOneAsync(filter, update, options);
await InitializeCollectionAsync();
// 6. Return a more accurate result indicating success for both updates and upserts.
// The operation is successful if an existing document was modified OR a new one was created.
return result.IsAcknowledged && (result.ModifiedCount > 0 || result.UpsertedId != null);
}
public async Task<bool> AddProjectsToCache(Guid employeeId, List<Guid> projectIds)
{
var newprojectIds = projectIds.Select(p => p.ToString()).ToList();
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update
.Set(r => r.ExpireAt, DateTime.UtcNow.Date.AddDays(1))
.AddToSetEach(e => e.ProjectIds, newprojectIds);
var result = await _collection.UpdateOneAsync(filter, update, new UpdateOptions { IsUpsert = true });
if (result.MatchedCount == 0)
{
return false;
}
await InitializeCollectionAsync();
return true;
}
public async Task<List<Guid>> GetProjectsFromCache(Guid employeeId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeId.ToString());
var result = await _collection
.Find(filter)
.FirstOrDefaultAsync();
var projectIds = new List<Guid>();
if (result != null)
{
projectIds = result.ProjectIds.Select(Guid.Parse).ToList();
}
return projectIds;
}
public async Task<List<Guid>> GetPermissionsFromCache(Guid employeeId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeId.ToString());
var result = await _collection
.Find(filter)
.FirstOrDefaultAsync();
var permissionIds = new List<Guid>();
if (result != null)
{
permissionIds = result.PermissionIds.Select(Guid.Parse).ToList();
}
return permissionIds;
}
public async Task<bool> ClearAllProjectIdsFromCache(Guid employeeId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter
.Eq(e => e.Id, employeeId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update
.Set(e => e.ProjectIds, new List<string>());
var result = await _collection.UpdateOneAsync(filter, update);
if (result.ModifiedCount == 0)
return false;
return true;
}
public async Task<bool> ClearAllProjectIdsByRoleIdFromCache(Guid roleId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter.AnyEq(e => e.ApplicationRoleIds, roleId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update
.Set(e => e.ProjectIds, new List<string>());
var result = await _collection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
return false;
return true;
}
public async Task<bool> ClearAllProjectIdsByPermissionIdFromCache(Guid permissionId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter.AnyEq(e => e.PermissionIds, permissionId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update.Set(e => e.ProjectIds, new List<string>());
var result = await _collection.UpdateManyAsync(filter, update).ConfigureAwait(false);
return result.IsAcknowledged && result.ModifiedCount > 0;
}
public async Task<bool> RemoveRoleIdFromCache(Guid employeeId, Guid roleId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter
.Eq(e => e.Id, employeeId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update
.Pull(e => e.ApplicationRoleIds, roleId.ToString());
var result = await _collection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
return false;
if (result.ModifiedCount == 0)
return false;
return true;
}
public async Task<bool> ClearAllPermissionIdsByEmployeeIDFromCache(Guid employeeId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter
.Eq(e => e.Id, employeeId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update
.Set(e => e.PermissionIds, new List<string>());
var result = await _collection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
return false;
return true;
}
public async Task<bool> ClearAllPermissionIdsByRoleIdFromCache(Guid roleId)
{
var filter = Builders<EmployeePermissionMongoDB>.Filter.AnyEq(e => e.ApplicationRoleIds, roleId.ToString());
var update = Builders<EmployeePermissionMongoDB>.Update
.Set(e => e.PermissionIds, new List<string>());
var result = await _collection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
return false;
return true;
}
public async Task<bool> ClearAllEmployeesFromCache()
{
var result = await _collection.DeleteManyAsync(FilterDefinition<EmployeePermissionMongoDB>.Empty);
if (result.DeletedCount == 0)
return false;
return true;
}
// A private method to handle the one-time setup of the collection's indexes.
private async Task InitializeCollectionAsync()
{
var indexKeys = Builders<EmployeePermissionMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
var indexOptions = new CreateIndexOptions
{
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
};
var indexModel = new CreateIndexModel<EmployeePermissionMongoDB>(indexKeys, indexOptions);
await _collection.Indexes.CreateOneAsync(indexModel);
}
}
}

View File

@ -0,0 +1,178 @@
using Marco.Pms.Model.MongoDBModels.Expenses;
using Marco.Pms.Model.Utilities;
using Microsoft.Extensions.Configuration;
using MongoDB.Bson;
using MongoDB.Driver;
namespace Marco.Pms.Helpers.CacheHelper
{
public class ExpenseCache
{
private readonly IMongoCollection<ExpenseDetailsMongoDB> _collection;
public ExpenseCache(IConfiguration configuration)
{
var connectionString = configuration["MongoDB:ConnectionString"];
var mongoUrl = new MongoUrl(connectionString);
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
_collection = mongoDB.GetCollection<ExpenseDetailsMongoDB>("Expenses");
}
public async Task AddExpenseToCacheAsync(ExpenseDetailsMongoDB expense)
{
await _collection.InsertOneAsync(expense);
await InitializeCollectionAsync();
}
public async Task AddExpensesListToCacheAsync(List<ExpenseDetailsMongoDB> expenses)
{
// 1. Add a guard clause to avoid an unnecessary database call for an empty list.
if (expenses == null || !expenses.Any())
{
return;
}
// 2. Perform the insert operation. This is the only responsibility of this method.
await _collection.InsertManyAsync(expenses);
await InitializeCollectionAsync();
}
public async Task<(int totalPages, long totalCount, List<ExpenseDetailsMongoDB> expenseList)> GetExpenseListFromCacheAsync(Guid tenantId, Guid loggedInEmployeeId, bool viewAll,
bool viewSelf, int pageNumber, int pageSize, ExpensesFilter? expenseFilter, string? searchString)
{
var filterBuilder = Builders<ExpenseDetailsMongoDB>.Filter;
var filter = filterBuilder.Empty;
// Permission-based filter
if (!viewAll && viewSelf)
{
filter &= filterBuilder.Eq(e => e.CreatedBy.Id, loggedInEmployeeId.ToString());
}
else
{
filter &= filterBuilder.Or(
filterBuilder.Eq(e => e.CreatedBy.Id, loggedInEmployeeId.ToString()),
filterBuilder.Ne(e => e.Status.Id, "297e0d8f-f668-41b5-bfea-e03b354251c8")
);
}
// Apply filters
if (expenseFilter != null)
{
if (expenseFilter.StartDate.HasValue && expenseFilter.EndDate.HasValue && expenseFilter.IsTransactionDate == false)
{
filter &= filterBuilder.Gte(e => e.CreatedAt, expenseFilter.StartDate.Value.Date)
& filterBuilder.Lte(e => e.CreatedAt, expenseFilter.EndDate.Value.Date.AddDays(1).AddTicks(-1));
}
if (expenseFilter.StartDate.HasValue && expenseFilter.EndDate.HasValue && expenseFilter.IsTransactionDate)
{
filter &= filterBuilder.Gte(e => e.TransactionDate, expenseFilter.StartDate.Value.Date)
& filterBuilder.Lte(e => e.TransactionDate, expenseFilter.EndDate.Value.Date.AddDays(1).AddTicks(-1));
}
if (expenseFilter.ProjectIds?.Any() == true)
{
filter &= filterBuilder.In(e => e.Project.Id, expenseFilter.ProjectIds.Select(p => p.ToString()).ToList());
}
if (expenseFilter.StatusIds?.Any() == true)
{
filter &= filterBuilder.In(e => e.Status.Id, expenseFilter.StatusIds.Select(p => p.ToString()).ToList());
}
if (expenseFilter.PaidById?.Any() == true)
{
filter &= filterBuilder.In(e => e.PaidBy.Id, expenseFilter.PaidById.Select(p => p.ToString()).ToList());
}
if (expenseFilter.CreatedByIds?.Any() == true && viewAll)
{
filter &= filterBuilder.In(e => e.CreatedBy.Id, expenseFilter.CreatedByIds.Select(p => p.ToString()).ToList());
}
}
if (!string.IsNullOrWhiteSpace(searchString))
{
var searchPattern = new BsonRegularExpression(searchString, "i");
// The base text searches remain the same
var searchClauses = new List<FilterDefinition<ExpenseDetailsMongoDB>>
{
filterBuilder.Regex(e => e.Description, searchPattern),
filterBuilder.Regex(e => e.TransactionId, searchPattern)
};
// Build the complex filter for PaidBy.FullName
var paidByFilter = new BsonDocument("$expr",
new BsonDocument("$regexMatch", new BsonDocument
{
{ "input", new BsonDocument("$concat", new BsonArray { "$PaidBy.FirstName", " ", "$PaidBy.LastName" }) },
{ "regex", searchString }, // BsonRegularExpression can't be used here, pass the string
{ "options", "i" } // Case-insensitivity option
})
);
searchClauses.Add(paidByFilter);
// Build the complex filter for CreatedBy.FullName
var createdByFilter = new BsonDocument("$expr",
new BsonDocument("$regexMatch", new BsonDocument
{
{ "input", new BsonDocument("$concat", new BsonArray { "$CreatedBy.FirstName", " ", "$CreatedBy.LastName" }) },
{ "regex", searchString },
{ "options", "i" }
})
);
searchClauses.Add(createdByFilter);
// Combine all clauses with an OR
filter &= filterBuilder.Or(searchClauses);
}
// Total count
var totalCount = await _collection.CountDocumentsAsync(filter);
var totalPages = (int)Math.Ceiling((double)totalCount / pageSize);
// Fetch paginated data
var expenses = await _collection
.Find(filter)
.Skip((pageNumber - 1) * pageSize)
.Limit(pageSize)
.SortByDescending(e => e.CreatedAt)
.ToListAsync();
return (totalPages, totalCount, expenses);
}
public async Task<ExpenseDetailsMongoDB> GetExpenseDetailsByIdAsync(Guid id, Guid tenantId)
{
var filter = Builders<ExpenseDetailsMongoDB>.Filter.And(
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.Id, id.ToString()),
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.TenantId, tenantId.ToString())
);
var expense = await _collection.Find(filter).FirstOrDefaultAsync();
return expense;
}
public async Task<bool> DeleteExpenseFromCacheAsync(Guid id, Guid tenantId)
{
var filter = Builders<ExpenseDetailsMongoDB>.Filter.And(
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.Id, id.ToString()),
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.TenantId, tenantId.ToString())
);
var result = await _collection.DeleteOneAsync(filter);
return result.DeletedCount > 0;
}
private async Task InitializeCollectionAsync()
{
var indexKeys = Builders<ExpenseDetailsMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
var indexOptions = new CreateIndexOptions
{
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
};
var indexModel = new CreateIndexModel<ExpenseDetailsMongoDB>(indexKeys, indexOptions);
await _collection.Indexes.CreateOneAsync(indexModel);
}
}
}

View File

@ -0,0 +1,496 @@
using Marco.Pms.DataAccess.Data;
using Marco.Pms.Model.Master;
using Marco.Pms.Model.MongoDBModels.Masters;
using Marco.Pms.Model.MongoDBModels.Project;
using Marco.Pms.Model.Projects;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MongoDB.Bson;
using MongoDB.Driver;
namespace Marco.Pms.Helpers
{
public class ProjectCache
{
private readonly IMongoCollection<ProjectMongoDB> _projectCollection;
private readonly IMongoCollection<WorkItemMongoDB> _taskCollection;
public ProjectCache(ApplicationDbContext context, IConfiguration configuration)
{
var connectionString = configuration["MongoDB:ConnectionString"];
var mongoUrl = new MongoUrl(connectionString);
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
_projectCollection = mongoDB.GetCollection<ProjectMongoDB>("ProjectDetails");
_taskCollection = mongoDB.GetCollection<WorkItemMongoDB>("WorkItemDetails");
}
#region=================================================================== Project Cache Helper ===================================================================
public async Task AddProjectDetailsToCache(ProjectMongoDB projectDetails)
{
await _projectCollection.InsertOneAsync(projectDetails);
await InitializeCollectionAsync();
}
public async Task AddProjectDetailsListToCache(List<ProjectMongoDB> projectDetailsList)
{
// 1. Add a guard clause to avoid an unnecessary database call for an empty list.
if (projectDetailsList == null || !projectDetailsList.Any())
{
return;
}
// 2. Perform the insert operation. This is the only responsibility of this method.
await _projectCollection.InsertManyAsync(projectDetailsList);
await InitializeCollectionAsync();
}
private async Task InitializeCollectionAsync()
{
var indexKeys = Builders<ProjectMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
var indexOptions = new CreateIndexOptions
{
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
};
var indexModel = new CreateIndexModel<ProjectMongoDB>(indexKeys, indexOptions);
await _projectCollection.Indexes.CreateOneAsync(indexModel);
}
public async Task<bool> UpdateProjectDetailsOnlyToCache(Project project, StatusMaster projectStatus)
{
// Build the update definition
var updates = Builders<ProjectMongoDB>.Update.Combine(
Builders<ProjectMongoDB>.Update.Set(r => r.Name, project.Name),
Builders<ProjectMongoDB>.Update.Set(r => r.ProjectAddress, project.ProjectAddress),
Builders<ProjectMongoDB>.Update.Set(r => r.ShortName, project.ShortName),
Builders<ProjectMongoDB>.Update.Set(r => r.ProjectStatus, new StatusMasterMongoDB
{
Id = projectStatus.Id.ToString(),
Status = projectStatus.Status
}),
Builders<ProjectMongoDB>.Update.Set(r => r.StartDate, project.StartDate),
Builders<ProjectMongoDB>.Update.Set(r => r.EndDate, project.EndDate),
Builders<ProjectMongoDB>.Update.Set(r => r.ContactPerson, project.ContactPerson)
);
// Perform the update
var result = await _projectCollection.UpdateOneAsync(
filter: r => r.Id == project.Id.ToString(),
update: updates
);
if (result.MatchedCount == 0)
{
return false;
}
return true;
}
public async Task<ProjectMongoDB?> GetProjectDetailsFromCache(Guid projectId)
{
// Build filter and projection to exclude large 'Buildings' list
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, projectId.ToString());
var projection = Builders<ProjectMongoDB>.Projection.Exclude(p => p.Buildings);
// Perform query
var project = await _projectCollection
.Find(filter)
.Project<ProjectMongoDB>(projection)
.FirstOrDefaultAsync();
return project;
}
public async Task<ProjectMongoDB?> GetProjectDetailsWithBuildingsFromCache(Guid projectId)
{
// Build filter and projection to exclude large 'Buildings' list
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, projectId.ToString());
// Perform query
var project = await _projectCollection
.Find(filter)
.FirstOrDefaultAsync();
return project;
}
public async Task<List<ProjectMongoDB>> GetProjectDetailsListFromCache(List<Guid> projectIds)
{
List<string> stringProjectIds = projectIds.Select(p => p.ToString()).ToList();
var filter = Builders<ProjectMongoDB>.Filter.In(p => p.Id, stringProjectIds);
var projection = Builders<ProjectMongoDB>.Projection.Exclude(p => p.Buildings);
var projects = await _projectCollection
.Find(filter)
.Project<ProjectMongoDB>(projection)
.ToListAsync();
return projects;
}
public async Task<bool> DeleteProjectByIdFromCacheAsync(Guid projectId)
{
var filter = Builders<ProjectMongoDB>.Filter.Eq(e => e.Id, projectId.ToString());
var result = await _projectCollection.DeleteOneAsync(filter);
return result.DeletedCount > 0;
}
public async Task<bool> RemoveProjectsFromCacheAsync(List<Guid> projectIds)
{
var stringIds = projectIds.Select(id => id.ToString()).ToList();
var filter = Builders<ProjectMongoDB>.Filter.In(p => p.Id, stringIds);
var result = await _projectCollection.DeleteManyAsync(filter);
return result.DeletedCount > 0;
}
#endregion
#region=================================================================== Project infrastructure Cache Helper ===================================================================
public async Task AddBuildngInfraToCache(Guid projectId, Building? building, Floor? floor, WorkArea? workArea, Guid? buildingId)
{
var stringProjectId = projectId.ToString();
// Add Building
if (building != null)
{
var buildingMongo = new BuildingMongoDB
{
Id = building.Id.ToString(),
BuildingName = building.Name,
Description = building.Description,
PlannedWork = 0,
CompletedWork = 0,
Floors = new List<FloorMongoDB>()
};
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
var update = Builders<ProjectMongoDB>.Update.Push("Buildings", buildingMongo);
var result = await _projectCollection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
{
return;
}
return;
}
// Add Floor
if (floor != null)
{
var floorMongo = new FloorMongoDB
{
Id = floor.Id.ToString(),
FloorName = floor.FloorName,
PlannedWork = 0,
CompletedWork = 0,
WorkAreas = new List<WorkAreaMongoDB>()
};
var filter = Builders<ProjectMongoDB>.Filter.And(
Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId),
Builders<ProjectMongoDB>.Filter.Eq("Buildings._id", floor.BuildingId.ToString())
);
var update = Builders<ProjectMongoDB>.Update.Push("Buildings.$.Floors", floorMongo);
var result = await _projectCollection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
{
return;
}
return;
}
// Add WorkArea
if (workArea != null && buildingId != null)
{
var workAreaMongo = new WorkAreaMongoDB
{
Id = workArea.Id.ToString(),
AreaName = workArea.AreaName,
PlannedWork = 0,
CompletedWork = 0
};
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
var arrayFilters = new List<ArrayFilterDefinition>
{
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + buildingId + "' }"),
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + workArea.FloorId + "' }")
};
var update = Builders<ProjectMongoDB>.Update.Push("Buildings.$[b].Floors.$[f].WorkAreas", workAreaMongo);
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
if (result.MatchedCount == 0)
{
return;
}
return;
}
}
public async Task<bool> UpdateBuildngInfraToCache(Guid projectId, Building? building, Floor? floor, WorkArea? workArea, Guid? buildingId)
{
var stringProjectId = projectId.ToString();
// Update Building
if (building != null)
{
var filter = Builders<ProjectMongoDB>.Filter.And(
Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId),
Builders<ProjectMongoDB>.Filter.Eq("Buildings._id", building.Id.ToString())
);
var update = Builders<ProjectMongoDB>.Update.Combine(
Builders<ProjectMongoDB>.Update.Set("Buildings.$.BuildingName", building.Name),
Builders<ProjectMongoDB>.Update.Set("Buildings.$.Description", building.Description)
);
var result = await _projectCollection.UpdateOneAsync(filter, update);
if (result.MatchedCount == 0)
{
return false;
}
return true;
}
// Update Floor
if (floor != null)
{
var arrayFilters = new List<ArrayFilterDefinition>
{
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + floor.BuildingId + "' }"),
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + floor.Id + "' }")
};
var update = Builders<ProjectMongoDB>.Update.Set("Buildings.$[b].Floors.$[f].FloorName", floor.FloorName);
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
if (result.MatchedCount == 0)
{
return false;
}
return true;
}
// Update WorkArea
if (workArea != null && buildingId != null)
{
var arrayFilters = new List<ArrayFilterDefinition>
{
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + buildingId + "' }"),
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + workArea.FloorId + "' }"),
new JsonArrayFilterDefinition<BsonDocument>("{ 'a._id': '" + workArea.Id + "' }")
};
var update = Builders<ProjectMongoDB>.Update.Set("Buildings.$[b].Floors.$[f].WorkAreas.$[a].AreaName", workArea.AreaName);
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
if (result.MatchedCount == 0)
{
return false;
}
return true;
}
return false;
}
public async Task<List<BuildingMongoDB>?> GetBuildingInfraFromCache(Guid projectId)
{
// Filter by project ID
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, projectId.ToString());
// Project only the "Buildings" field from the document
var buildings = await _projectCollection
.Find(filter)
.Project(p => p.Buildings)
.FirstOrDefaultAsync();
return buildings;
}
public async Task UpdatePlannedAndCompleteWorksInBuildingFromCache(Guid workAreaId, double plannedWork, double completedWork)
{
var filter = Builders<ProjectMongoDB>.Filter.Eq("Buildings.Floors.WorkAreas._id", workAreaId.ToString());
var project = await _projectCollection.Find(filter).FirstOrDefaultAsync();
string? selectedBuildingId = null;
string? selectedFloorId = null;
string? selectedWorkAreaId = null;
foreach (var building in project.Buildings)
{
foreach (var floor in building.Floors)
{
foreach (var area in floor.WorkAreas)
{
if (area.Id == workAreaId.ToString())
{
selectedWorkAreaId = area.Id;
selectedFloorId = floor.Id;
selectedBuildingId = building.Id;
}
}
}
}
var arrayFilters = new List<ArrayFilterDefinition>
{
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + selectedBuildingId + "' }"),
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + selectedFloorId + "' }"),
new JsonArrayFilterDefinition<BsonDocument>("{ 'a._id': '" + selectedWorkAreaId + "' }")
};
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
var update = Builders<ProjectMongoDB>.Update
.Inc("Buildings.$[b].Floors.$[f].WorkAreas.$[a].PlannedWork", plannedWork)
.Inc("Buildings.$[b].Floors.$[f].WorkAreas.$[a].CompletedWork", completedWork)
.Inc("Buildings.$[b].Floors.$[f].PlannedWork", plannedWork)
.Inc("Buildings.$[b].Floors.$[f].CompletedWork", completedWork)
.Inc("Buildings.$[b].PlannedWork", plannedWork)
.Inc("Buildings.$[b].CompletedWork", completedWork)
.Inc("PlannedWork", plannedWork)
.Inc("CompletedWork", completedWork);
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
}
public async Task<WorkAreaInfoMongoDB?> GetBuildingAndFloorByWorkAreaIdFromCache(Guid workAreaId)
{
var pipeline = new[]
{
new BsonDocument("$unwind", "$Buildings"),
new BsonDocument("$unwind", "$Buildings.Floors"),
new BsonDocument("$unwind", "$Buildings.Floors.WorkAreas"),
new BsonDocument("$match", new BsonDocument("Buildings.Floors.WorkAreas._id", workAreaId.ToString())),
new BsonDocument("$project", new BsonDocument
{
{ "_id", 0 },
{ "ProjectId", "$_id" },
{ "ProjectName", "$Name" },
{ "PlannedWork", "$PlannedWork" },
{ "CompletedWork", "$CompletedWork" },
{
"Building", new BsonDocument
{
{ "_id", "$Buildings._id" },
{ "BuildingName", "$Buildings.BuildingName" },
{ "Description", "$Buildings.Description" },
{ "PlannedWork", "$Buildings.PlannedWork" },
{ "CompletedWork", "$Buildings.CompletedWork" }
}
},
{
"Floor", new BsonDocument
{
{ "_id", "$Buildings.Floors._id" },
{ "FloorName", "$Buildings.Floors.FloorName" },
{ "PlannedWork", "$Buildings.Floors.PlannedWork" },
{ "CompletedWork", "$Buildings.Floors.CompletedWork" }
}
},
{ "WorkArea", "$Buildings.Floors.WorkAreas" }
})
};
var result = await _projectCollection.Aggregate<WorkAreaInfoMongoDB>(pipeline).FirstOrDefaultAsync();
if (result == null)
return null;
return result;
}
#endregion
#region=================================================================== WorkItem Cache Helper ===================================================================
public async Task<List<WorkItemMongoDB>> GetWorkItemsByWorkAreaIdsFromCache(List<Guid> workAreaIds)
{
var stringWorkAreaIds = workAreaIds.Select(wa => wa.ToString()).ToList();
var filter = Builders<WorkItemMongoDB>.Filter.In(w => w.WorkAreaId, stringWorkAreaIds);
var workItems = await _taskCollection // replace with your actual collection name
.Find(filter)
.ToListAsync();
return workItems;
}
public async Task ManageWorkItemDetailsToCache(List<WorkItemMongoDB> workItems)
{
foreach (WorkItemMongoDB workItem in workItems)
{
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.Id, workItem.Id.ToString());
var updates = Builders<WorkItemMongoDB>.Update.Combine(
Builders<WorkItemMongoDB>.Update.Set(r => r.WorkAreaId, workItem.WorkAreaId.ToString()),
Builders<WorkItemMongoDB>.Update.Set(r => r.ParentTaskId, (workItem.ParentTaskId != null ? workItem.ParentTaskId.ToString() : null)),
Builders<WorkItemMongoDB>.Update.Set(r => r.PlannedWork, workItem.PlannedWork),
Builders<WorkItemMongoDB>.Update.Set(r => r.TodaysAssigned, workItem.TodaysAssigned),
Builders<WorkItemMongoDB>.Update.Set(r => r.CompletedWork, workItem.CompletedWork),
Builders<WorkItemMongoDB>.Update.Set(r => r.Description, workItem.Description),
Builders<WorkItemMongoDB>.Update.Set(r => r.TaskDate, workItem.TaskDate),
Builders<WorkItemMongoDB>.Update.Set(r => r.ExpireAt, DateTime.UtcNow.Date.AddDays(1)),
Builders<WorkItemMongoDB>.Update.Set(r => r.ActivityMaster, workItem.ActivityMaster),
Builders<WorkItemMongoDB>.Update.Set(r => r.WorkCategoryMaster, workItem.WorkCategoryMaster)
);
var options = new UpdateOptions { IsUpsert = true };
var result = await _taskCollection.UpdateOneAsync(filter, updates, options);
if (result.UpsertedId != null)
{
var indexKeys = Builders<WorkItemMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
var indexOptions = new CreateIndexOptions
{
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
};
var indexModel = new CreateIndexModel<WorkItemMongoDB>(indexKeys, indexOptions);
await _taskCollection.Indexes.CreateOneAsync(indexModel);
}
}
}
public async Task<List<WorkItemMongoDB>> GetWorkItemDetailsByWorkAreaFromCache(Guid workAreaId)
{
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.WorkAreaId, workAreaId.ToString());
var options = new UpdateOptions { IsUpsert = true };
var workItems = await _taskCollection
.Find(filter)
.ToListAsync();
return workItems;
}
public async Task<WorkItemMongoDB> GetWorkItemDetailsByIdFromCache(Guid id)
{
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.Id, id.ToString());
var options = new UpdateOptions { IsUpsert = true };
var workItem = await _taskCollection
.Find(filter)
.FirstOrDefaultAsync();
return workItem;
}
public async Task<bool> UpdatePlannedAndCompleteWorksInWorkItemToCache(Guid id, double plannedWork, double completedWork, double todaysAssigned)
{
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.Id, id.ToString());
var updates = Builders<WorkItemMongoDB>.Update
.Inc("PlannedWork", plannedWork)
.Inc("CompletedWork", completedWork)
.Inc("TodaysAssigned", todaysAssigned);
var result = await _taskCollection.UpdateOneAsync(filter, updates);
if (result.ModifiedCount > 0)
{
return true;
}
return false;
}
public async Task<bool> DeleteWorkItemByIdFromCacheAsync(Guid workItemId)
{
var filter = Builders<WorkItemMongoDB>.Filter.Eq(e => e.Id, workItemId.ToString());
var result = await _taskCollection.DeleteOneAsync(filter);
return result.DeletedCount > 0;
}
#endregion
}
}

View File

@ -0,0 +1,42 @@
using Marco.Pms.Model.MongoDBModels.Utility;
using Microsoft.Extensions.Configuration;
using MongoDB.Driver;
namespace Marco.Pms.Helpers.CacheHelper
{
public class ReportCache
{
private readonly IMongoCollection<ProjectReportEmailMongoDB> _projectReportCollection;
public ReportCache(IConfiguration configuration)
{
var connectionString = configuration["MongoDB:ConnectionString"];
var mongoUrl = new MongoUrl(connectionString);
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
_projectReportCollection = mongoDB.GetCollection<ProjectReportEmailMongoDB>("ProjectReportMail");
}
/// <summary>
/// Retrieves project report emails from the cache based on their sent status.
/// </summary>
/// <param name="isSent">True to get sent reports, false to get unsent reports.</param>
/// <returns>A list of ProjectReportEmailMongoDB objects.</returns>
public async Task<List<ProjectReportEmailMongoDB>> GetProjectReportMailFromCache(bool isSent)
{
var filter = Builders<ProjectReportEmailMongoDB>.Filter.Eq(p => p.IsSent, isSent);
var reports = await _projectReportCollection.Find(filter).ToListAsync();
return reports;
}
/// <summary>
/// Adds a project report email to the cache.
/// </summary>
/// <param name="report">The ProjectReportEmailMongoDB object to add.</param>
/// <returns>A Task representing the asynchronous operation.</returns>
public async Task AddProjectReportMailToCache(ProjectReportEmailMongoDB report)
{
// Consider adding validation or logging here.
await _projectReportCollection.InsertOneAsync(report);
}
}
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Marco.Pms.DataAccess\Marco.Pms.DataAccess.csproj" />
<ProjectReference Include="..\Marco.Pms.Model\Marco.Pms.Model.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,128 @@
using Marco.Pms.Model.MongoDBModels.Utility;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MongoDB.Bson;
using MongoDB.Driver;
using System.Collections;
namespace Marco.Pms.Helpers.Utility
{
public class UtilityMongoDBHelper
{
private readonly IMongoDatabase _mongoDatabase;
private readonly IConfiguration _configuration;
private readonly ILogger<UtilityMongoDBHelper> _logger;
public UtilityMongoDBHelper(IConfiguration configuration, ILogger<UtilityMongoDBHelper> logger)
{
_configuration = configuration;
_logger = logger;
var connectionString = configuration["MongoDB:ModificationConnectionString"];
var mongoUrl = new MongoUrl(connectionString);
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
_mongoDatabase = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
}
#region =================================================================== Update Log Helper Functions ===================================================================
public async Task PushToUpdateLogsAsync(UpdateLogsObject oldObject, string collectionName)
{
var collection = _mongoDatabase.GetCollection<UpdateLogsObject>(collectionName);
await collection.InsertOneAsync(oldObject);
}
public async Task<List<UpdateLogsObject>> GetFromUpdateLogsByEntityIdAsync(Guid entityId, string collectionName)
{
var collection = _mongoDatabase.GetCollection<UpdateLogsObject>(collectionName);
var filter = Builders<UpdateLogsObject>.Filter.Eq(p => p.EntityId, entityId.ToString());
List<UpdateLogsObject> result = await collection
.Find(filter)
.ToListAsync();
return result;
}
public async Task<List<UpdateLogsObject>> GetFromUpdateLogsByUpdetedByIdAsync(Guid updatedById, string collectionName)
{
var collection = _mongoDatabase.GetCollection<UpdateLogsObject>(collectionName);
var filter = Builders<UpdateLogsObject>.Filter.Eq(p => p.UpdatedById, updatedById.ToString());
List<UpdateLogsObject> result = await collection
.Find(filter)
.ToListAsync();
return result;
}
public BsonDocument EntityToBsonDocument(object entity)
{
var bson = new BsonDocument();
var props = entity.GetType().GetProperties();
foreach (var prop in props)
{
var value = prop.GetValue(entity);
if (value == null)
{
bson[prop.Name] = BsonNull.Value;
continue;
}
if (value is Guid guidValue)
{
bson[prop.Name] = guidValue.ToString(); // store Guid as string
}
else if (value is string || value.GetType().IsPrimitive || value is DateTime)
{
bson[prop.Name] = BsonValue.Create(value); // simple types
}
else if (value is IEnumerable list && !(value is string))
{
var array = new BsonArray();
foreach (var item in list)
{
array.Add(EntityToBsonDocument(item)); // recursive
}
bson[prop.Name] = array;
}
else
{
// nested object
continue;
}
}
return bson;
}
#endregion
#region =================================================================== S3 deletion Helper Functions ===================================================================
public async Task PushToS3DeletionAsync(List<S3DeletionObject> deletionObject)
{
var bucketName = _configuration["AWS:BucketName"];
if (bucketName != null)
{
deletionObject = deletionObject.Select(d => new S3DeletionObject
{
BucketName = bucketName,
Key = d.Key,
Deleted = false
}).ToList();
}
_logger.LogInformation("Delection object for bucket {BucketName} added to mongoDB", bucketName);
try
{
var collection = _mongoDatabase.GetCollection<S3DeletionObject>("S3Delection");
await collection.InsertManyAsync(deletionObject);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error occured while saving delection object for S3 to MogoDB");
}
_logger.LogInformation("Delection Objects added to MongoDB Successfully");
}
#endregion
}
}

View File

@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Master;
using Marco.Pms.Model.Projects;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
@ -10,29 +11,43 @@ namespace Marco.Pms.Model.Activities
public class TaskAllocation : TenantRelation
{
public Guid Id { get; set; }
public Guid? ParentTaskId { get; set; }
public DateTime AssignmentDate { get; set; }
public double PlannedTask { get; set; }
public double CompletedTask { get; set; }
public double ReportedTask { get; set; }
public DateTime? ReportedDate { get; set; }
public DateTime? ApprovedDate { get; set; }
public string? Description { get; set; }
//public int? WorkItemMappingId { get; set; }
//[ForeignKey("WorkItemMappingId")]
//[ValidateNever]
//public WorkItemMapping? WorkItemMapping { get; set; }
public Guid AssignedBy { get; set; } //Employee Id
[ForeignKey("AssignedBy")]
[ValidateNever]
public Employee? Employee { get; set; }
public Guid? ReportedById { get; set; } //Employee Id
[ForeignKey("ReportedById")]
[ValidateNever]
public Employee? ReportedBy { get; set; }
public Guid? ApprovedById { get; set; } //Employee Id
[ForeignKey("ApprovedById")]
[ValidateNever]
public Employee? ApprovedBy { get; set; }
public Guid WorkItemId { get; set; }
[ForeignKey("WorkItemId")]
[ValidateNever]
public WorkItem? WorkItem { get; set; }
public Guid? WorkStatusId { get; set; }
[ForeignKey("WorkStatusId")]
[ValidateNever]
public WorkStatusMaster? WorkStatus { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace Marco.Pms.Model.Activities
{
public class TaskAttachment
{
public Guid Id { get; set; }
public Guid ReferenceId { get; set; }
public Guid DocumentId { get; set; }
}
}

View File

@ -1,17 +0,0 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.Activities
{
public class TaskImages
{
public Guid Id { get; set; }
public Guid TaskAllocationId { get; set; }
[ValidateNever]
[ForeignKey(nameof(TaskAllocationId))]
public TaskAllocation? TaskAllocation { get; set; }
public string? ImagePath { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Master
{
public class WorkStatusMaster : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsSystem { get; set; } = false;
}
}

View File

@ -12,6 +12,7 @@ namespace Marco.Pms.Model.Directory
//public Guid? ProjectId { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string Designation { get; set; } = string.Empty;
public string Organization { get; set; } = string.Empty;
public string? Address { get; set; }
public bool IsActive { get; set; } = true;
@ -20,6 +21,11 @@ namespace Marco.Pms.Model.Directory
[ValidateNever]
[ForeignKey("CreatedById")]
public Employee? CreatedBy { get; set; }
public Guid? UpdatedById { get; set; }
[ValidateNever]
[ForeignKey("UpdatedById")]
public Employee? UpdatedBy { get; set; }
[DisplayName("ContactCategoryId")]
public Guid? ContactCategoryId { get; set; }
@ -27,5 +33,6 @@ namespace Marco.Pms.Model.Directory
[ForeignKey(nameof(ContactCategoryId))]
public ContactCategoryMaster? ContactCategory { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
}
}

View File

@ -14,7 +14,13 @@ namespace Marco.Pms.Model.Directory
[ValidateNever]
[ForeignKey("CreatedById")]
public Employee? Createdby { get; set; }
public Guid? UpdatedById { get; set; }
[ValidateNever]
[ForeignKey("UpdatedById")]
public Employee? UpdatedBy { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? UpdatedAt { get; set; }
public Guid ContactId { get; set; }
[ValidateNever]

View File

@ -1,4 +1,7 @@
using Marco.Pms.Model.Utilities;
using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.DocumentManager
{
@ -16,10 +19,15 @@ namespace Marco.Pms.Model.DocumentManager
/// </summary>
public string? ThumbS3Key { get; set; }
public string? Base64Data { get; set; }
public string? Base64Data { get; set; } = null;
public long FileSize { get; set; }
public string ContentType { get; set; } = string.Empty;
public Guid? UploadedById { get; set; }
[ValidateNever]
[ForeignKey("UploadedById")]
public Employee? UploadedBy { get; set; }
public DateTime UploadedAt { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Dtos.Activities
{
public class ApproveTaskDto
{
public Guid Id { get; set; }
public Guid WorkStatus { get; set; }
public long ApprovedTask { get; set; }
public string? Comment { get; set; }
public List<FileUploadModel>? Images { get; set; }
}
}

View File

@ -3,6 +3,7 @@
public class AssignTaskDto
{
public DateTime AssignmentDate { get; set; }
public Guid? ParentTaskId { get; set; }
public double PlannedTask { get; set; }
public string? Description { get; set; }
public List<Guid>? TaskTeam { get; set; } //Employee Ids

View File

@ -1,11 +1,12 @@
namespace Marco.Pms.Model.Dtos.Activities
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Dtos.Activities
{
public class CreateCommentDto
{
public Guid TaskAllocationId { get; set; }
public DateTime CommentDate { get; set; }
public string? Comment { get; set; }
public List<FileUploadModel>? Images { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace Marco.Pms.Model.Dtos.Master
{
public class CreateWorkStatusMasterDto
{
public string? Name { get; set; }
public string? Description { get; set; }
}
}

View File

@ -1,11 +1,15 @@
namespace Marco.Pms.Model.Dtos.Activities
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Dtos.Activities
{
public class ReportTaskDto
{
public Guid Id { get; set; }
public Guid? ParentTaskId { get; set; }
public double CompletedTask { get; set; }
public DateTime ReportedDate { get; set; }
public string? Comment { get; set; }
public List<ReportCheckListDto>? CheckList { get; set; }
public List<FileUploadModel>? Images { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace Marco.Pms.Model.Dtos.Master
{
public class UpdateWorkStatusMasterDto
{
public Guid Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
}
}

View File

@ -2,9 +2,8 @@
{
public class LoginDto
{
public string? Username { get; set; }
public string? Password { get; set; }
public string? DeviceToken { get; set; }
public required string Username { get; set; }
public required string Password { get; set; }
public required string DeviceToken { get; set; }
}
}

View File

@ -9,6 +9,7 @@
public List<Guid>? BucketIds { get; set; }
public Guid? ContactCategoryId { get; set; }
public string? Description { get; set; }
public string? Designation { get; set; }
public string? Organization { get; set; }
public string? Address { get; set; }
public List<ContactTagDto>? Tags { get; set; }

View File

@ -8,8 +8,9 @@
public List<UpdateContactPhoneDto>? ContactPhones { get; set; }
public List<UpdateContactEmailDto>? ContactEmails { get; set; }
public List<Guid>? BucketIds { get; set; }
public Guid ContactCategoryId { get; set; }
public Guid? ContactCategoryId { get; set; }
public string? Description { get; set; }
public string? Designation { get; set; }
public string? Organization { get; set; }
public string? Address { get; set; }
public List<ContactTagDto>? Tags { get; set; }

View File

@ -0,0 +1,10 @@
using Marco.Pms.Model.DocumentManager;
namespace Marco.Pms.Model.Dtos.DocumentManager
{
public class DocumentBatchDto
{
public Guid? BatchId { get; set; }
public List<Document>? Documents { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Dtos.Expenses
{
public class CreateExpensesDto
{
public required Guid ProjectId { get; set; }
public required Guid ExpensesTypeId { get; set; }
public required Guid PaymentModeId { get; set; }
public required Guid PaidById { get; set; }
public DateTime TransactionDate { get; set; } = DateTime.Now;
public string? TransactionId { get; set; }
public required string Description { get; set; }
public string? Location { get; set; }
public string? GSTNumber { get; set; }
public required string SupplerName { get; set; }
public required double Amount { get; set; }
public int? NoOfPersons { get; set; } = 0;
public bool PreApproved { get; set; } = false;
public required List<FileUploadModel> BillAttachments { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace Marco.Pms.Model.Dtos.Expenses
{
public class ExpenseRecordDto
{
public Guid ExpenseId { get; set; }
public Guid StatusId { get; set; }
public string? Comment { get; set; }
public string? ReimburseTransactionId { get; set; }
public DateTime? ReimburseDate { get; set; }
public Guid? ReimburseById { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Dtos.Expenses
{
public class UpdateExpensesDto
{
public required Guid Id { get; set; }
public required Guid ProjectId { get; set; }
public required Guid ExpensesTypeId { get; set; }
public required Guid PaymentModeId { get; set; }
public required Guid PaidById { get; set; }
public DateTime TransactionDate { get; set; } = DateTime.Now;
public string? TransactionId { get; set; }
public required string Description { get; set; }
public string? Location { get; set; }
public string? GSTNumber { get; set; }
public required string SupplerName { get; set; }
public required double Amount { get; set; }
public int? NoOfPersons { get; set; } = 0;
public bool PreApproved { get; set; } = false;
public List<FileUploadModel>? BillAttachments { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace Marco.Pms.Model.Dtos.Master
{
public class ExpensesStatusMasterDto
{
public Guid? Id { get; set; }
public required string Name { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public List<Guid>? PermissionIds { get; set; }
public required string? Color { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace Marco.Pms.Model.Dtos.Master
{
public class ExpensesTypeMasterDto
{
public Guid? Id { get; set; }
public required string Name { get; set; }
public required bool NoOfPersonsRequired { get; set; }
public string? Description { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace Marco.Pms.Model.Dtos.Master
{
public class PaymentModeMatserDto
{
public Guid? Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
}

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace Marco.Pms.Model.Dtos.Project
{
public class BuildingDot
public class BuildingDto
{
[Key]
public Guid? Id { get; set; }

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace Marco.Pms.Model.Dtos.Project
{
public class FloorDot
public class FloorDto
{
public Guid? Id { get; set; }

View File

@ -1,9 +0,0 @@
namespace Marco.Pms.Model.Dtos.Project
{
public class InfraDot
{
public BuildingDot? Building { get; set; }
public FloorDot? Floor { get; set; }
public WorkAreaDot? WorkArea { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace Marco.Pms.Model.Dtos.Project
{
public class InfraDto
{
public BuildingDto? Building { get; set; }
public FloorDto? Floor { get; set; }
public WorkAreaDto? WorkArea { get; set; }
}
}

View File

@ -5,7 +5,6 @@
public Guid EmpID { get; set; }
public Guid JobRoleId { get; set; }
public Guid ProjectId { get; set; }
public bool Status { get; set; }
}
@ -14,7 +13,6 @@
{
public Guid ProjectId { get; set; }
public Guid JobRoleId { get; set; }
public bool Status { get; set; }
}
}

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace Marco.Pms.Model.Dtos.Project
{
public class WorkAreaDot
public class WorkAreaDto
{
[Key]
public Guid? Id { get; set; }

View File

@ -2,7 +2,7 @@
namespace Marco.Pms.Model.Dtos.Project
{
public class WorkItemDot
public class WorkItemDto
{
[Key]
public Guid? Id { get; set; }
@ -11,5 +11,7 @@ namespace Marco.Pms.Model.Dtos.Project
public Guid ActivityID { get; set; }
public int PlannedWork { get; set; }
public int CompletedWork { get; set; }
public Guid? ParentTaskId { get; set; }
public string? Comment { get; set; }
}
}

View File

@ -0,0 +1,35 @@
namespace Marco.Pms.Model.Entitlements
{
public static class PermissionsMaster
{
public static readonly Guid DirectoryAdmin = Guid.Parse("4286a13b-bb40-4879-8c6d-18e9e393beda");
public static readonly Guid DirectoryManager = Guid.Parse("62668630-13ce-4f52-a0f0-db38af2230c5");
public static readonly Guid DirectoryUser = Guid.Parse("0f919170-92d4-4337-abd3-49b66fc871bb");
public static readonly Guid ViewProject = Guid.Parse("6ea44136-987e-44ba-9e5d-1cf8f5837ebc");
public static readonly Guid ManageProject = Guid.Parse("172fc9b6-755b-4f62-ab26-55c34a330614");
public static readonly Guid ManageTeam = Guid.Parse("b94802ce-0689-4643-9e1d-11c86950c35b");
public static readonly Guid ViewProjectInfra = Guid.Parse("8d7cc6e3-9147-41f7-aaa7-fa507e450bd4");
public static readonly Guid ManageProjectInfra = Guid.Parse("cf2825ad-453b-46aa-91d9-27c124d63373");
public static readonly Guid ViewTask = Guid.Parse("9fcc5f87-25e3-4846-90ac-67a71ab92e3c");
public static readonly Guid AddAndEditTask = Guid.Parse("08752f33-3b29-4816-b76b-ea8a968ed3c5");
public static readonly Guid AssignAndReportProgress = Guid.Parse("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2");
public static readonly Guid ApproveTask = Guid.Parse("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c");
public static readonly Guid ViewAllEmployees = Guid.Parse("60611762-7f8a-4fb5-b53f-b1139918796b");
public static readonly Guid ViewTeamMembers = Guid.Parse("b82d2b7e-0d52-45f3-997b-c008ea460e7f");
public static readonly Guid AddAndEditEmployee = Guid.Parse("a97d366a-c2bb-448d-be93-402bd2324566");
public static readonly Guid AssignRoles = Guid.Parse("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3");
public static readonly Guid TeamAttendance = Guid.Parse("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e");
public static readonly Guid RegularizeAttendance = Guid.Parse("57802c4a-00aa-4a1f-a048-fd2f70dd44b6");
public static readonly Guid SelfAttendance = Guid.Parse("ccb0589f-712b-43de-92ed-5b6088e7dc4e");
public static readonly Guid ViewMasters = Guid.Parse("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d");
public static readonly Guid ManageMasters = Guid.Parse("588a8824-f924-4955-82d8-fc51956cf323");
public static readonly Guid ExpenseViewSelf = Guid.Parse("385be49f-8fde-440e-bdbc-3dffeb8dd116");
public static readonly Guid ExpenseViewAll = Guid.Parse("01e06444-9ca7-4df4-b900-8c3fa051b92f");
public static readonly Guid ExpenseUpload = Guid.Parse("0f57885d-bcb2-4711-ac95-d841ace6d5a7");
public static readonly Guid ExpenseReview = Guid.Parse("1f4bda08-1873-449a-bb66-3e8222bd871b");
public static readonly Guid ExpenseApprove = Guid.Parse("eaafdd76-8aac-45f9-a530-315589c6deca");
public static readonly Guid ExpenseProcess = Guid.Parse("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11");
public static readonly Guid ExpenseManage = Guid.Parse("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3");
}
}

View File

@ -0,0 +1,22 @@
using Marco.Pms.Model.DocumentManager;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class BillAttachments : TenantRelation
{
public Guid Id { get; set; }
public Guid ExpensesId { get; set; }
[ValidateNever]
[ForeignKey("ExpensesId")]
public Expenses? Expenses { get; set; }
public Guid DocumentId { get; set; }
[ValidateNever]
[ForeignKey("DocumentId")]
public Document? Document { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class ExpenseLog : TenantRelation
{
public Guid Id { get; set; }
public Guid ExpenseId { get; set; }
[ValidateNever]
[ForeignKey("ExpenseId")]
public Expenses? Expense { get; set; }
public Guid UpdatedById { get; set; }
[ValidateNever]
[ForeignKey("UpdatedById")]
public Employee? UpdatedBy { get; set; }
public DateTime? UpdateAt { get; set; }
public string Action { get; set; } = string.Empty;
public string? Comment { get; set; }
}
}

View File

@ -0,0 +1,70 @@
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Master;
using Marco.Pms.Model.Projects;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class Expenses : TenantRelation
{
public Guid Id { get; set; }
public Guid ProjectId { get; set; }
[ValidateNever]
[ForeignKey("ProjectId")]
public Project? Project { get; set; }
public Guid ExpensesTypeId { get; set; }
[ValidateNever]
[ForeignKey("ExpensesTypeId")]
public ExpensesTypeMaster? ExpensesType { get; set; }
public Guid PaymentModeId { get; set; }
[ValidateNever]
[ForeignKey("PaymentModeId")]
public PaymentModeMatser? PaymentMode { get; set; }
public Guid PaidById { get; set; }
[ValidateNever]
[ForeignKey("PaidById")]
public Employee? PaidBy { get; set; }
public Guid CreatedById { get; set; }
[ValidateNever]
[ForeignKey("CreatedById")]
public Employee? CreatedBy { get; set; }
public Guid? ReviewedById { get; set; }
[ValidateNever]
[ForeignKey("ReviewedById")]
public Employee? ReviewedBy { get; set; }
public Guid? ApprovedById { get; set; }
[ValidateNever]
[ForeignKey("ApprovedById")]
public Employee? ApprovedBy { get; set; }
public Guid? ProcessedById { get; set; }
[ValidateNever]
[ForeignKey("ProcessedById")]
public Employee? ProcessedBy { get; set; }
public DateTime TransactionDate { get; set; }
public DateTime CreatedAt { get; set; }
public string? TransactionId { get; set; }
public string Description { get; set; } = string.Empty;
public string? Location { get; set; }
public string? GSTNumber { get; set; }
public string SupplerName { get; set; } = string.Empty;
public double Amount { get; set; }
public int? NoOfPersons { get; set; }
public Guid StatusId { get; set; }
[ValidateNever]
[ForeignKey("StatusId")]
public ExpensesStatusMaster? Status { get; set; }
public bool PreApproved { get; set; } = false;
public bool IsActive { get; set; } = true;
}
}

View File

@ -0,0 +1,20 @@
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class ExpensesReimburse : TenantRelation
{
public Guid Id { get; set; }
public string ReimburseTransactionId { get; set; } = string.Empty;
public DateTime ReimburseDate { get; set; }
public Guid ReimburseById { get; set; }
[ValidateNever]
[ForeignKey("ReimburseById")]
public Employee? ReimburseBy { get; set; }
public string ReimburseNote { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,21 @@
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class ExpensesReimburseMapping : TenantRelation
{
public Guid Id { get; set; }
public Guid ExpensesId { get; set; }
[ValidateNever]
[ForeignKey("ExpensesId")]
public Expenses? Expenses { get; set; }
public Guid ExpensesReimburseId { get; set; }
[ValidateNever]
[ForeignKey("ExpensesReimburseId")]
public ExpensesReimburse? ExpensesReimburse { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using Marco.Pms.Model.Master;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class ExpensesStatusMapping
{
public Guid Id { get; set; }
public Guid StatusId { get; set; }
[ValidateNever]
[ForeignKey("StatusId")]
public ExpensesStatusMaster? Status { get; set; }
public Guid NextStatusId { get; set; }
[ValidateNever]
[ForeignKey("NextStatusId")]
public ExpensesStatusMaster? NextStatus { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using Marco.Pms.Model.Entitlements;
using Marco.Pms.Model.Master;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Expenses
{
public class StatusPermissionMapping
{
public Guid Id { get; set; }
public Guid StatusId { get; set; }
[ValidateNever]
[ForeignKey("StatusId")]
public ExpensesStatusMaster? Status { get; set; }
public Guid PermissionId { get; set; }
[ValidateNever]
[ForeignKey("PermissionId")]
public FeaturePermission? Permission { get; set; }
}
}

View File

@ -13,6 +13,7 @@ namespace Marco.Pms.Model.Mapper
return new TaskAllocation
{
AssignmentDate = assignTask.AssignmentDate,
ParentTaskId = assignTask.ParentTaskId,
PlannedTask = assignTask.PlannedTask,
CompletedTask = 0,
Description = assignTask.Description,
@ -43,18 +44,23 @@ namespace Marco.Pms.Model.Mapper
TenantId = tenantId
};
}
public static TaskVM TaskAllocationToTaskVM(this TaskAllocation taskAllocation, string employeeName)
public static TaskVM TaskAllocationToTaskVM(this TaskAllocation taskAllocation)
{
return new TaskVM
{
Id = taskAllocation.Id,
AssignmentDate = taskAllocation.AssignmentDate,
ReportedDate = taskAllocation.ReportedDate,
ApprovedDate = taskAllocation.ApprovedDate,
PlannedTask = taskAllocation.PlannedTask,
CompletedTask = taskAllocation.CompletedTask,
ReportedDate = taskAllocation.ReportedDate,
NotApprovedTask = taskAllocation.ApprovedById == null ? taskAllocation.CompletedTask : (taskAllocation.CompletedTask - taskAllocation.ReportedTask),
Description = taskAllocation.Description,
AssignBy = employeeName,
WorkItem = taskAllocation.WorkItem
AssignedBy = taskAllocation.Employee?.ToBasicEmployeeVMFromEmployee(),
ReportedBy = taskAllocation.ReportedBy?.ToBasicEmployeeVMFromEmployee(),
ApprovedBy = taskAllocation.ApprovedBy?.ToBasicEmployeeVMFromEmployee(),
WorkItem = taskAllocation.WorkItem,
WorkStatus = taskAllocation.WorkStatus
};
}
public static AssignedTaskVM ToAssignTaskVMFromTaskAllocation(this TaskAllocation taskAllocation)
@ -100,11 +106,18 @@ namespace Marco.Pms.Model.Mapper
return new ListTaskVM
{
Id = taskAllocation.Id,
ParentTaskId = taskAllocation.ParentTaskId,
AssignmentDate = taskAllocation.AssignmentDate,
ApprovedDate = taskAllocation.ApprovedDate,
Description = taskAllocation.Description,
PlannedTask = taskAllocation.PlannedTask,
ReportedDate = taskAllocation.ReportedDate,
WorkStatus = taskAllocation.WorkStatus,
CompletedTask = taskAllocation.CompletedTask,
AssignedBy = taskAllocation.Employee != null ? taskAllocation.Employee.ToBasicEmployeeVMFromEmployee() : new BasicEmployeeVM(),
NotApprovedTask = taskAllocation.ApprovedById == null ? taskAllocation.CompletedTask : (taskAllocation.CompletedTask - taskAllocation.ReportedTask),
AssignedBy = taskAllocation.Employee?.ToBasicEmployeeVMFromEmployee(),
ReportedBy = taskAllocation.ReportedBy?.ToBasicEmployeeVMFromEmployee(),
ApprovedBy = taskAllocation.ApprovedBy?.ToBasicEmployeeVMFromEmployee(),
WorkItemId = taskAllocation.WorkItemId,
WorkItem = taskAllocation.WorkItem
};

View File

@ -16,6 +16,7 @@ namespace Marco.Pms.Model.Mapper
Name = createContactDto.Name ?? string.Empty,
ContactCategoryId = createContactDto.ContactCategoryId,
Description = createContactDto.Description ?? string.Empty,
Designation = createContactDto.Designation ?? string.Empty,
Organization = createContactDto?.Organization ?? string.Empty,
Address = createContactDto != null ? createContactDto.Address : string.Empty,
CreatedById = employeeId,
@ -34,6 +35,7 @@ namespace Marco.Pms.Model.Mapper
CreatedAt = contact.CreatedAt,
CreatedById = contact.CreatedById,
Description = updateContactDto.Description ?? string.Empty,
Designation = updateContactDto.Designation ?? string.Empty,
Organization = updateContactDto?.Organization ?? string.Empty,
Address = updateContactDto != null ? updateContactDto.Address : string.Empty,
TenantId = tenantId
@ -47,6 +49,7 @@ namespace Marco.Pms.Model.Mapper
Name = contact.Name,
ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null,
Description = contact.Description ?? string.Empty,
Designation = contact.Designation ?? string.Empty,
Organization = contact.Organization ?? string.Empty,
Address = contact.Address ?? string.Empty
};
@ -59,6 +62,7 @@ namespace Marco.Pms.Model.Mapper
Name = contact.Name,
ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null,
Description = contact.Description ?? string.Empty,
Designation = contact.Designation ?? string.Empty,
Organization = contact.Organization ?? string.Empty,
Address = contact.Address ?? string.Empty,
CreatedAt = contact.CreatedAt,
@ -232,9 +236,13 @@ namespace Marco.Pms.Model.Mapper
{
Id = note.Id,
Note = note.Note,
ContactName = note.Contact?.Name,
OrganizationName = note.Contact?.Organization,
ContactId = note.ContactId,
CreatedAt = note.CreatedAt,
UpdatedAt = note.UpdatedAt,
CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null,
UpdatedBy = note.UpdatedBy != null ? note.UpdatedBy.ToBasicEmployeeVMFromEmployee() : null,
IsActive = note.IsActive
};
}

View File

@ -90,29 +90,35 @@ namespace Marco.Pms.Model.Mapper
};
}
public static Document ToDocumentFromForumAttachmentDto(this ForumAttachmentDto AttachmentDto, string objectKey, string thumbS3Key, DateTime uploadedAt, Guid tenantId)
public static Document ToDocumentFromForumAttachmentDto(this ForumAttachmentDto AttachmentDto, string objectKey, string thumbS3Key, DateTime uploadedAt,
Guid tenantId, Guid batchId, Guid loggedInEmployeeId)
{
return new Document
{
BatchId = batchId,
UploadedById = loggedInEmployeeId,
FileName = AttachmentDto.FileName,
ContentType = AttachmentDto.ContentType,
S3Key = objectKey,
ThumbS3Key = thumbS3Key,
Base64Data = AttachmentDto.Base64Data,
//Base64Data = AttachmentDto.Base64Data,
FileSize = AttachmentDto.FileSize,
UploadedAt = uploadedAt,
TenantId = tenantId
};
}
public static Document ToDocumentFromUpdateAttachmentDto(this UpdateAttachmentDto AttachmentDto, string objectKey, string thumbS3Key, DateTime uploadedAt, Guid tenantId)
public static Document ToDocumentFromUpdateAttachmentDto(this UpdateAttachmentDto AttachmentDto, string objectKey, string thumbS3Key, DateTime uploadedAt,
Guid tenantId, Guid batchId, Guid loggedInEmployeeId)
{
return new Document
{
BatchId = batchId,
UploadedById = loggedInEmployeeId,
FileName = AttachmentDto.FileName,
ContentType = AttachmentDto.ContentType,
S3Key = objectKey,
ThumbS3Key = thumbS3Key,
Base64Data = AttachmentDto.Base64Data,
//Base64Data = AttachmentDto.Base64Data,
FileSize = AttachmentDto.FileSize,
UploadedAt = uploadedAt,
TenantId = tenantId

View File

@ -5,7 +5,7 @@ namespace Marco.Pms.Model.Mapper
{
public static class BuildingMapper
{
public static Building ToBuildingFromBuildingDto(this BuildingDot model, Guid tenantId)
public static Building ToBuildingFromBuildingDto(this BuildingDto model, Guid tenantId)
{
return new Building
{
@ -20,7 +20,7 @@ namespace Marco.Pms.Model.Mapper
public static class FloorMapper
{
public static Floor ToFloorFromFloorDto(this FloorDot model, Guid tenantId)
public static Floor ToFloorFromFloorDto(this FloorDto model, Guid tenantId)
{
return new Floor
{
@ -34,7 +34,7 @@ namespace Marco.Pms.Model.Mapper
public static class WorAreaMapper
{
public static WorkArea ToWorkAreaFromWorkAreaDto(this WorkAreaDot model, Guid tenantId)
public static WorkArea ToWorkAreaFromWorkAreaDto(this WorkAreaDto model, Guid tenantId)
{
return new WorkArea
{
@ -48,7 +48,7 @@ namespace Marco.Pms.Model.Mapper
}
public static class WorkItemMapper
{
public static WorkItem ToWorkItemFromWorkItemDto(this WorkItemDot model, Guid tenantId)
public static WorkItem ToWorkItemFromWorkItemDto(this WorkItemDto model, Guid tenantId)
{
return new WorkItem
{
@ -59,7 +59,9 @@ namespace Marco.Pms.Model.Mapper
WorkCategoryId = model.WorkCategoryId,
TaskDate = DateTime.Now,
TenantId = tenantId,
WorkAreaId = model.WorkAreaID
WorkAreaId = model.WorkAreaID,
ParentTaskId = model.ParentTaskId,
Description = model.Comment
};
}

View File

@ -91,5 +91,19 @@ namespace Marco.Pms.Model.Mapper
EndDate = project.EndDate,
};
}
public static ProjectInfoVM ToProjectInfoVMFromProject(this Project project)
{
return new ProjectInfoVM
{
Id = project.Id,
Name = project.Name,
ShortName = project.ShortName,
ProjectAddress = project.ProjectAddress,
ProjectStatusId = project.ProjectStatusId,
ContactPerson = project.ContactPerson,
StartDate = project.StartDate,
EndDate = project.EndDate,
};
}
}
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
@ -10,6 +10,7 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.20" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
<PackageReference Include="MongoDB.Bson" Version="3.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,11 @@
namespace Marco.Pms.Model.Master
{
public class CurrencyMaster
{
public Guid Id { get; set; }
public string CurrencyCode { get; set; } = string.Empty;
public string CurrencyName { get; set; } = string.Empty;
public string Symbol { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
}
}

View File

@ -0,0 +1,13 @@
namespace Marco.Pms.Model.Master
{
public class ExpensesStatusMaster
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string Color { get; set; } = string.Empty;
public bool IsSystem { get; set; } = false;
public bool IsActive { get; set; } = true;
}
}

View File

@ -0,0 +1,13 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Master
{
public class ExpensesTypeMaster : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public bool NoOfPersonsRequired { get; set; }
public string Description { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
}
}

View File

@ -0,0 +1,12 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.Master
{
public class PaymentModeMatser : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
}
}

Some files were not shown because too many files have changed in this diff Show More