From bf4712823d37c952667aef753bd25ed115864d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Sat, 31 May 2025 19:32:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Major=20refactor:=20Reorganize?= =?UTF-8?q?=20project=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move WebAPI/ → src/Backend/DiunaBI.WebAPI/ - Move Frontend/ → src/Frontend/ - Move Deployment/ → deploy/ - Add proper .NET 8 solution structure - Add plugin architecture with DiunaBI.Plugins.Morska - Clean --- Deployment/build.yml | 81 -- Deployment/release.yml | 62 -- DiunaBI.sln | 25 - Frontend/.vscode/extensions.json | 4 - Frontend/.vscode/launch.json | 13 - Frontend/.vscode/tasks.json | 42 - WebAPI/.DS_Store | Bin 8196 -> 0 bytes WebAPI/AppDbContext.cs | 33 - WebAPI/Calculators/BaseCalc.cs | 144 --- WebAPI/Controllers/AdminController.cs | 27 - WebAPI/Controllers/AuthController.cs | 59 -- WebAPI/Controllers/DataInboxController.cs | 169 ---- WebAPI/Controllers/LayersController.cs | 853 ------------------ WebAPI/Controllers/LogsController.cs | 45 - WebAPI/Controllers/PingController.cs | 25 - WebAPI/DiunaBI-WebAPI.csproj | 46 - WebAPI/Exports/googleSheet.export.cs | 121 --- WebAPI/GoogleDriveHelper.cs | 36 - WebAPI/GoogleSheetsHelper.cs | 35 - .../20221205190148_Initial.Designer.cs | 51 -- WebAPI/Migrations/20221205190148_Initial.cs | 36 - ...1211210507_DataSetsAndDataRows.Designer.cs | 192 ---- .../20221211210507_DataSetsAndDataRows.cs | 121 --- .../20221219163620_RenameFields.Designer.cs | 197 ---- .../Migrations/20221219163620_RenameFields.cs | 73 -- ...21221165749_DataSetIdOnDataRow.Designer.cs | 199 ---- .../20221221165749_DataSetIdOnDataRow.cs | 60 -- .../20230106095427_RenameModels.Designer.cs | 199 ---- .../Migrations/20230106095427_RenameModels.cs | 227 ----- .../20230626171614_LayerType.Designer.cs | 201 ----- WebAPI/Migrations/20230626171614_LayerType.cs | 29 - .../20230821105757_Record.Values.Designer.cs | 291 ------ .../20230821105757_Record.Values.cs | 339 ------- .../20230917110252_Layer.parent.Designer.cs | 302 ------- .../Migrations/20230917110252_Layer.parent.cs | 49 - .../20230918090621_ProcessSource.Designer.cs | 330 ------- .../20230918090621_ProcessSource.cs | 45 - .../20230918093055_TypeO.Designer.cs | 330 ------- WebAPI/Migrations/20230918093055_TypeO.cs | 60 -- .../20231030142419_Record.Value32.Designer.cs | 333 ------- .../20231030142419_Record.Value32.cs | 28 - ...75645_Change record value type.Designer.cs | 333 ------- ...20240309075645_Change record value type.cs | 594 ------------ ...240703171630_AfterCodeRefactor.Designer.cs | 319 ------- .../20240703171630_AfterCodeRefactor.cs | 135 --- .../20240703173337_DataInboxModel.Designer.cs | 348 ------- .../20240703173337_DataInboxModel.cs | 37 - .../20240825144443_QueueJobs.Designer.cs | 381 -------- WebAPI/Migrations/20240825144443_QueueJobs.cs | 40 - .../20250317114722_LongerDesc1.Designer.cs | 381 -------- .../Migrations/20250317114722_LongerDesc1.cs | 40 - ...250529093632_LayersIsCancelled.Designer.cs | 384 -------- .../20250529093632_LayersIsCancelled.cs | 29 - .../Migrations/AppDbContextModelSnapshot.cs | 381 -------- WebAPI/Models/DataInbox.cs | 18 - WebAPI/Models/Layer.cs | 44 - WebAPI/Models/LogEntry.cs | 34 - WebAPI/Models/ProcessSource.cs | 14 - WebAPI/Models/QueueJob.cs | 29 - WebAPI/Models/Record.cs | 61 -- WebAPI/Models/User.cs | 16 - WebAPI/Program.cs | 98 -- WebAPI/Properties/launchSettings.json | 12 - WebAPI/appsettings.Development.json | 31 - WebAPI/appsettings.json | 31 - WebAPI/client_secrets.Development.json | 12 - WebAPI/client_secrets.json | 12 - WebAPI/dataImporters/morska.d1.importer.cs | 109 --- WebAPI/dataImporters/morska.d3.importer.cs | 77 -- WebAPI/dataImporters/morska.fk2.importer.cs | 93 -- WebAPI/dataImporters/morska.importer.cs | 82 -- WebAPI/dataProcessors/ProcessHelper.cs | 212 ----- WebAPI/dataProcessors/t1.r1.processor.cs | 277 ------ WebAPI/dataProcessors/t1.r3.processor.cs | 193 ---- ....MultiSourceCopySelectedCodes.processor.cs | 98 -- ...eCopySelectedCodesYearSummary.processor.cs | 101 --- .../t3.MultiSourceSummary.processor.cs | 167 ---- .../t3.MultiSourceYearSummary.processor.cs | 187 ---- .../t3.SingleSource.processor.cs | 141 --- .../t3.SourceYearSummary.processor.cs | 101 --- .../t4.SingleSource.processor.cs | 94 -- WebAPI/dataProcessors/t4.r2.processor.cs | 358 -------- .../dataProcessors/t5.LastValues.processor.cs | 95 -- WebAPI/diunabi-admin-firebase.json | 13 - azure-pipelines.yml | 81 -- {Deployment => deploy}/dev.service | 0 {Deployment => deploy}/morska.service | 0 {Deployment => deploy}/staging.service | 0 {Deployment => deploy}/updateSWHash.sh | 0 global.json | 7 - {Frontend => src/Frontend}/.editorconfig | 0 {Frontend => src/Frontend}/.eslintrc.json | 0 {Frontend => src/Frontend}/.gitignore | 0 {Frontend => src/Frontend}/README.md | 0 {Frontend => src/Frontend}/angular.json | 0 {Frontend => src/Frontend}/karma.conf.js | 0 {Frontend => src/Frontend}/ngsw-config.json | 0 {Frontend => src/Frontend}/package.json | 0 .../Frontend}/src/app/app.component.html | 0 .../Frontend}/src/app/app.component.scss | 0 .../Frontend}/src/app/app.component.ts | 0 .../Frontend}/src/app/app.routes.ts | 0 .../Frontend}/src/app/auth/auth.guard.ts | 0 .../Frontend}/src/app/auth/auth.service.ts | 0 .../main-menu/main-menu.component.html | 0 .../main-menu/main-menu.component.scss | 0 .../main-menu/main-menu.component.ts | 0 .../notifications.component.html | 0 .../notifications.component.scss | 0 .../notifications.component.spec.ts | 0 .../notifications/notifications.component.ts | 0 .../app/directives/scroll-end.directive.ts | 0 .../src/app/interceptors/auth.interceptor.ts | 0 .../app/interceptors/loader.interceptor.ts | 0 .../Frontend}/src/app/models/base.model.ts | 0 .../src/app/models/deserializable.model.ts | 0 .../Frontend}/src/app/models/layer.model.ts | 0 .../Frontend}/src/app/models/record.model.ts | 0 .../src/app/models/serializable.model.ts | 0 .../Frontend}/src/app/models/user.model.ts | 0 .../dashboard/board/board.component.html | 0 .../dashboard/board/board.component.scss | 0 .../dashboard/board/board.component.ts | 0 .../app/modules/dashboard/dashboard.routes.ts | 0 .../layer-detail/layer-detail.component.html | 0 .../layer-detail/layer-detail.component.scss | 0 .../layer-detail/layer-detail.component.ts | 0 .../layer-edit/layer-edit.component.html | 0 .../layer-edit/layer-edit.component.scss | 0 .../layers/layer-edit/layer-edit.component.ts | 0 .../layers-list/layers-list.component.html | 0 .../layers-list/layers-list.component.scss | 0 .../layers-list/layers-list.component.ts | 0 .../src/app/modules/layers/layers.routes.ts | 0 .../src/app/services/data.service.ts | 0 .../src/app/services/device.service.ts | 0 .../src/app/services/notifications.service.ts | 0 .../app/views/login/login-view.component.html | 0 .../app/views/login/login-view.component.scss | 0 .../app/views/login/login-view.component.ts | 0 .../app/views/main/main-view.component.html | 0 .../app/views/main/main-view.component.scss | 0 .../src/app/views/main/main-view.component.ts | 0 .../Frontend}/src/assets/.gitkeep | 0 {Frontend => src/Frontend}/src/assets/bg.jpg | Bin .../src/assets/icons/icon-128x128.png | Bin .../src/assets/icons/icon-144x144.png | Bin .../src/assets/icons/icon-152x152.png | Bin .../src/assets/icons/icon-192x192.png | Bin .../src/assets/icons/icon-384x384.png | Bin .../Frontend}/src/assets/icons/icon-48x48.png | Bin .../src/assets/icons/icon-512x512.png | Bin .../Frontend}/src/assets/icons/icon-72x72.png | Bin .../Frontend}/src/assets/icons/icon-96x96.png | Bin .../Frontend}/src/assets/loader.gif | Bin .../Frontend}/src/assets/logo.png | Bin .../src/environments/environment.prod.ts | 0 .../Frontend}/src/environments/environment.ts | 0 {Frontend => src/Frontend}/src/favicon.ico | Bin {Frontend => src/Frontend}/src/index.html | 0 {Frontend => src/Frontend}/src/main.ts | 0 .../Frontend}/src/manifest.webmanifest | 0 {Frontend => src/Frontend}/src/polyfills.ts | 0 {Frontend => src/Frontend}/src/styles.scss | 0 {Frontend => src/Frontend}/src/test.ts | 0 {Frontend => src/Frontend}/tsconfig.app.json | 0 {Frontend => src/Frontend}/tsconfig.json | 0 {Frontend => src/Frontend}/tsconfig.spec.json | 0 {Frontend => src/Frontend}/yarn.lock | 0 .../http-tests}/AddDataInbox.http | 0 .../http-tests}/AddDataInboxProd.http | 0 .../http-tests}/AddToQueue.http | 0 .../http-tests}/AutoImport.http | 0 .../http-tests}/AutoProcess.http | 0 .../http-tests}/BackupDatabase.http | 0 .../http-tests}/CMMorska-Pacjenci.http | 0 .../http-tests}/DiunaBI-endpoints_2.http | 0 .../http-tests}/GetQueue.http | 0 .../http-tests}/ProcessQueue.http | 0 .../http-tests}/getForPowerBI.http | 0 .../http-tests}/getMorskaClients.http | 0 .../CreateDataInboxImportWorker .sql | 0 .../admin-monthly}/CreateImportWorker.sql | 0 ...eProcessWorker-T3MultiSourceSummary-AA.sql | 0 .../CreateProcessWorker-T3SingleSource.sql | 0 .../CreateProcessWorker-T4SingleSource.sql | 0 .../CreateProcessWorker-T5LastValue.sql | 0 .../Depracated-CreateImportWorkerD1.sql | 0 .../Deprecated-CreateImportWorkerFK2.sql | 0 .../CreateProcessWorker-T1-R1.sql | 0 .../CreateProcessWorker-T1-R3.sql | 0 ...cessWorker-T3MultiSourceYearSummary-AA.sql | 0 ...reateProcessWorker-T3SourceYearSummary.sql | 0 .../CreateProcessWorker-T4-R2.sql | 0 .../sql-scripts/utlis}/CreateConfig.sql | 0 .../sql-scripts/utlis}/CreateDictionary.sql | 0 .../sql-scripts/utlis}/CreateRecord.sql | 0 .../sql-scripts/utlis}/RemoveLayer.sql | 0 198 files changed, 11812 deletions(-) delete mode 100644 Deployment/build.yml delete mode 100644 Deployment/release.yml delete mode 100644 DiunaBI.sln delete mode 100644 Frontend/.vscode/extensions.json delete mode 100644 Frontend/.vscode/launch.json delete mode 100644 Frontend/.vscode/tasks.json delete mode 100644 WebAPI/.DS_Store delete mode 100644 WebAPI/AppDbContext.cs delete mode 100644 WebAPI/Calculators/BaseCalc.cs delete mode 100644 WebAPI/Controllers/AdminController.cs delete mode 100644 WebAPI/Controllers/AuthController.cs delete mode 100644 WebAPI/Controllers/DataInboxController.cs delete mode 100644 WebAPI/Controllers/LayersController.cs delete mode 100644 WebAPI/Controllers/LogsController.cs delete mode 100644 WebAPI/Controllers/PingController.cs delete mode 100644 WebAPI/DiunaBI-WebAPI.csproj delete mode 100644 WebAPI/Exports/googleSheet.export.cs delete mode 100644 WebAPI/GoogleDriveHelper.cs delete mode 100644 WebAPI/GoogleSheetsHelper.cs delete mode 100644 WebAPI/Migrations/20221205190148_Initial.Designer.cs delete mode 100644 WebAPI/Migrations/20221205190148_Initial.cs delete mode 100644 WebAPI/Migrations/20221211210507_DataSetsAndDataRows.Designer.cs delete mode 100644 WebAPI/Migrations/20221211210507_DataSetsAndDataRows.cs delete mode 100644 WebAPI/Migrations/20221219163620_RenameFields.Designer.cs delete mode 100644 WebAPI/Migrations/20221219163620_RenameFields.cs delete mode 100644 WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.Designer.cs delete mode 100644 WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.cs delete mode 100644 WebAPI/Migrations/20230106095427_RenameModels.Designer.cs delete mode 100644 WebAPI/Migrations/20230106095427_RenameModels.cs delete mode 100644 WebAPI/Migrations/20230626171614_LayerType.Designer.cs delete mode 100644 WebAPI/Migrations/20230626171614_LayerType.cs delete mode 100644 WebAPI/Migrations/20230821105757_Record.Values.Designer.cs delete mode 100644 WebAPI/Migrations/20230821105757_Record.Values.cs delete mode 100644 WebAPI/Migrations/20230917110252_Layer.parent.Designer.cs delete mode 100644 WebAPI/Migrations/20230917110252_Layer.parent.cs delete mode 100644 WebAPI/Migrations/20230918090621_ProcessSource.Designer.cs delete mode 100644 WebAPI/Migrations/20230918090621_ProcessSource.cs delete mode 100644 WebAPI/Migrations/20230918093055_TypeO.Designer.cs delete mode 100644 WebAPI/Migrations/20230918093055_TypeO.cs delete mode 100644 WebAPI/Migrations/20231030142419_Record.Value32.Designer.cs delete mode 100644 WebAPI/Migrations/20231030142419_Record.Value32.cs delete mode 100644 WebAPI/Migrations/20240309075645_Change record value type.Designer.cs delete mode 100644 WebAPI/Migrations/20240309075645_Change record value type.cs delete mode 100644 WebAPI/Migrations/20240703171630_AfterCodeRefactor.Designer.cs delete mode 100644 WebAPI/Migrations/20240703171630_AfterCodeRefactor.cs delete mode 100644 WebAPI/Migrations/20240703173337_DataInboxModel.Designer.cs delete mode 100644 WebAPI/Migrations/20240703173337_DataInboxModel.cs delete mode 100644 WebAPI/Migrations/20240825144443_QueueJobs.Designer.cs delete mode 100644 WebAPI/Migrations/20240825144443_QueueJobs.cs delete mode 100644 WebAPI/Migrations/20250317114722_LongerDesc1.Designer.cs delete mode 100644 WebAPI/Migrations/20250317114722_LongerDesc1.cs delete mode 100644 WebAPI/Migrations/20250529093632_LayersIsCancelled.Designer.cs delete mode 100644 WebAPI/Migrations/20250529093632_LayersIsCancelled.cs delete mode 100644 WebAPI/Migrations/AppDbContextModelSnapshot.cs delete mode 100644 WebAPI/Models/DataInbox.cs delete mode 100644 WebAPI/Models/Layer.cs delete mode 100644 WebAPI/Models/LogEntry.cs delete mode 100644 WebAPI/Models/ProcessSource.cs delete mode 100644 WebAPI/Models/QueueJob.cs delete mode 100644 WebAPI/Models/Record.cs delete mode 100644 WebAPI/Models/User.cs delete mode 100644 WebAPI/Program.cs delete mode 100644 WebAPI/Properties/launchSettings.json delete mode 100644 WebAPI/appsettings.Development.json delete mode 100644 WebAPI/appsettings.json delete mode 100644 WebAPI/client_secrets.Development.json delete mode 100644 WebAPI/client_secrets.json delete mode 100644 WebAPI/dataImporters/morska.d1.importer.cs delete mode 100644 WebAPI/dataImporters/morska.d3.importer.cs delete mode 100644 WebAPI/dataImporters/morska.fk2.importer.cs delete mode 100644 WebAPI/dataImporters/morska.importer.cs delete mode 100644 WebAPI/dataProcessors/ProcessHelper.cs delete mode 100644 WebAPI/dataProcessors/t1.r1.processor.cs delete mode 100644 WebAPI/dataProcessors/t1.r3.processor.cs delete mode 100644 WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodes.processor.cs delete mode 100644 WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodesYearSummary.processor.cs delete mode 100644 WebAPI/dataProcessors/t3.MultiSourceSummary.processor.cs delete mode 100644 WebAPI/dataProcessors/t3.MultiSourceYearSummary.processor.cs delete mode 100644 WebAPI/dataProcessors/t3.SingleSource.processor.cs delete mode 100644 WebAPI/dataProcessors/t3.SourceYearSummary.processor.cs delete mode 100644 WebAPI/dataProcessors/t4.SingleSource.processor.cs delete mode 100644 WebAPI/dataProcessors/t4.r2.processor.cs delete mode 100644 WebAPI/dataProcessors/t5.LastValues.processor.cs delete mode 100644 WebAPI/diunabi-admin-firebase.json delete mode 100644 azure-pipelines.yml rename {Deployment => deploy}/dev.service (100%) rename {Deployment => deploy}/morska.service (100%) rename {Deployment => deploy}/staging.service (100%) rename {Deployment => deploy}/updateSWHash.sh (100%) delete mode 100644 global.json rename {Frontend => src/Frontend}/.editorconfig (100%) rename {Frontend => src/Frontend}/.eslintrc.json (100%) rename {Frontend => src/Frontend}/.gitignore (100%) rename {Frontend => src/Frontend}/README.md (100%) rename {Frontend => src/Frontend}/angular.json (100%) rename {Frontend => src/Frontend}/karma.conf.js (100%) rename {Frontend => src/Frontend}/ngsw-config.json (100%) rename {Frontend => src/Frontend}/package.json (100%) rename {Frontend => src/Frontend}/src/app/app.component.html (100%) rename {Frontend => src/Frontend}/src/app/app.component.scss (100%) rename {Frontend => src/Frontend}/src/app/app.component.ts (100%) rename {Frontend => src/Frontend}/src/app/app.routes.ts (100%) rename {Frontend => src/Frontend}/src/app/auth/auth.guard.ts (100%) rename {Frontend => src/Frontend}/src/app/auth/auth.service.ts (100%) rename {Frontend => src/Frontend}/src/app/components/main-menu/main-menu.component.html (100%) rename {Frontend => src/Frontend}/src/app/components/main-menu/main-menu.component.scss (100%) rename {Frontend => src/Frontend}/src/app/components/main-menu/main-menu.component.ts (100%) rename {Frontend => src/Frontend}/src/app/components/notifications/notifications.component.html (100%) rename {Frontend => src/Frontend}/src/app/components/notifications/notifications.component.scss (100%) rename {Frontend => src/Frontend}/src/app/components/notifications/notifications.component.spec.ts (100%) rename {Frontend => src/Frontend}/src/app/components/notifications/notifications.component.ts (100%) rename {Frontend => src/Frontend}/src/app/directives/scroll-end.directive.ts (100%) rename {Frontend => src/Frontend}/src/app/interceptors/auth.interceptor.ts (100%) rename {Frontend => src/Frontend}/src/app/interceptors/loader.interceptor.ts (100%) rename {Frontend => src/Frontend}/src/app/models/base.model.ts (100%) rename {Frontend => src/Frontend}/src/app/models/deserializable.model.ts (100%) rename {Frontend => src/Frontend}/src/app/models/layer.model.ts (100%) rename {Frontend => src/Frontend}/src/app/models/record.model.ts (100%) rename {Frontend => src/Frontend}/src/app/models/serializable.model.ts (100%) rename {Frontend => src/Frontend}/src/app/models/user.model.ts (100%) rename {Frontend => src/Frontend}/src/app/modules/dashboard/board/board.component.html (100%) rename {Frontend => src/Frontend}/src/app/modules/dashboard/board/board.component.scss (100%) rename {Frontend => src/Frontend}/src/app/modules/dashboard/board/board.component.ts (100%) rename {Frontend => src/Frontend}/src/app/modules/dashboard/dashboard.routes.ts (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layer-detail/layer-detail.component.html (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layer-detail/layer-detail.component.scss (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layer-detail/layer-detail.component.ts (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layer-edit/layer-edit.component.html (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layer-edit/layer-edit.component.scss (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layer-edit/layer-edit.component.ts (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layers-list/layers-list.component.html (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layers-list/layers-list.component.scss (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layers-list/layers-list.component.ts (100%) rename {Frontend => src/Frontend}/src/app/modules/layers/layers.routes.ts (100%) rename {Frontend => src/Frontend}/src/app/services/data.service.ts (100%) rename {Frontend => src/Frontend}/src/app/services/device.service.ts (100%) rename {Frontend => src/Frontend}/src/app/services/notifications.service.ts (100%) rename {Frontend => src/Frontend}/src/app/views/login/login-view.component.html (100%) rename {Frontend => src/Frontend}/src/app/views/login/login-view.component.scss (100%) rename {Frontend => src/Frontend}/src/app/views/login/login-view.component.ts (100%) rename {Frontend => src/Frontend}/src/app/views/main/main-view.component.html (100%) rename {Frontend => src/Frontend}/src/app/views/main/main-view.component.scss (100%) rename {Frontend => src/Frontend}/src/app/views/main/main-view.component.ts (100%) rename {Frontend => src/Frontend}/src/assets/.gitkeep (100%) rename {Frontend => src/Frontend}/src/assets/bg.jpg (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-128x128.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-144x144.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-152x152.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-192x192.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-384x384.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-48x48.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-512x512.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-72x72.png (100%) rename {Frontend => src/Frontend}/src/assets/icons/icon-96x96.png (100%) rename {Frontend => src/Frontend}/src/assets/loader.gif (100%) rename {Frontend => src/Frontend}/src/assets/logo.png (100%) rename {Frontend => src/Frontend}/src/environments/environment.prod.ts (100%) rename {Frontend => src/Frontend}/src/environments/environment.ts (100%) rename {Frontend => src/Frontend}/src/favicon.ico (100%) rename {Frontend => src/Frontend}/src/index.html (100%) rename {Frontend => src/Frontend}/src/main.ts (100%) rename {Frontend => src/Frontend}/src/manifest.webmanifest (100%) rename {Frontend => src/Frontend}/src/polyfills.ts (100%) rename {Frontend => src/Frontend}/src/styles.scss (100%) rename {Frontend => src/Frontend}/src/test.ts (100%) rename {Frontend => src/Frontend}/tsconfig.app.json (100%) rename {Frontend => src/Frontend}/tsconfig.json (100%) rename {Frontend => src/Frontend}/tsconfig.spec.json (100%) rename {Frontend => src/Frontend}/yarn.lock (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/AddDataInbox.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/AddDataInboxProd.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/AddToQueue.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/AutoImport.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/AutoProcess.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/BackupDatabase.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/CMMorska-Pacjenci.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/DiunaBI-endpoints_2.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/GetQueue.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/ProcessQueue.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/getForPowerBI.http (100%) rename {WebAPI/Helpers/HttpRequests => tools/http-tests}/getMorskaClients.http (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/CreateDataInboxImportWorker .sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/CreateImportWorker.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/CreateProcessWorker-T3MultiSourceSummary-AA.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/CreateProcessWorker-T3SingleSource.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/CreateProcessWorker-T4SingleSource.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/CreateProcessWorker-T5LastValue.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/Depracated-CreateImportWorkerD1.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Monthly => tools/sql-scripts/admin-monthly}/Deprecated-CreateImportWorkerFK2.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Yearly => tools/sql-scripts/admin-yearly}/CreateProcessWorker-T1-R1.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Yearly => tools/sql-scripts/admin-yearly}/CreateProcessWorker-T1-R3.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Yearly => tools/sql-scripts/admin-yearly}/CreateProcessWorker-T3MultiSourceYearSummary-AA.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Yearly => tools/sql-scripts/admin-yearly}/CreateProcessWorker-T3SourceYearSummary.sql (100%) rename {WebAPI/Helpers/DbSeed/Admin-Yearly => tools/sql-scripts/admin-yearly}/CreateProcessWorker-T4-R2.sql (100%) rename {WebAPI/Helpers/DbSeed/Utlis => tools/sql-scripts/utlis}/CreateConfig.sql (100%) rename {WebAPI/Helpers/DbSeed/Utlis => tools/sql-scripts/utlis}/CreateDictionary.sql (100%) rename {WebAPI/Helpers/DbSeed/Utlis => tools/sql-scripts/utlis}/CreateRecord.sql (100%) rename {WebAPI/Helpers/DbSeed/Utlis => tools/sql-scripts/utlis}/RemoveLayer.sql (100%) diff --git a/Deployment/build.yml b/Deployment/build.yml deleted file mode 100644 index e0ec733..0000000 --- a/Deployment/build.yml +++ /dev/null @@ -1,81 +0,0 @@ -# ASP.NET -# Build and test ASP.NET projects. -# Add steps that publish symbols, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 - -trigger: -- deploy - -pool: - vmImage: 'ubuntu-latest' - -variables: - buildConfiguration: 'Release' - targetRuntime: 'linux-x64' - selfContained: false - dotNetFramework: 'net7.0' - dotNetVersion: '7.0.x' - buildId: $(Build.BuildNumber) - -steps: -# Start: Build WebAPI -- task: UseDotNet@2 - inputs: - version: $(dotNetVersion) -- script: dotnet build --configuration $(buildConfiguration) "WebAPI/DiunaBI-WebAPI.csproj" - displayName: 'Build .NET 6 Application' - -- task: DotNetCoreCLI@2 - displayName: 'dotnet publish $(buildConfiguration)' - inputs: - command: publish - publishWebProjects: True - arguments: '--configuration $(BuildConfiguration) --framework $(dotNetFramework) --runtime $(targetRuntime) --self-contained $(selfContained) --output $(Build.ArtifactStagingDirectory)' - workingDirectory: 'WebAPI' - zipAfterPublish: False -- task: DeleteFiles@1 - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/WebAPI' - Contents: | - appsettings.Development.json - client_secrets.Development.json -# End: Build WebAPI -# Start: Build Frontend -- task: NodeTool@0 - inputs: - versionSpec: '18.x' - displayName: 'Install Node.js' -- script: | - npm install -g @angular/cli - npm install -g yarn - yarn install - ng config --global cli.packageManager yarn - ng build --configuration production - workingDirectory: 'Frontend' - displayName: 'npm install and build' -- task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.Repository.LocalPath)/Frontend/dist/diunaBI' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Frontend' -- task: replacetokens@5 - inputs: - rootDirectory: '$(Build.ArtifactStagingDirectory)/Frontend' - targetFiles: '**/*.js' - encoding: 'auto' - tokenPattern: 'default' - writeBOM: true - actionOnMissing: 'warn' - keepToken: true - actionOnNoFiles: 'warn' - enableTransforms: false - enableRecursion: false - useLegacyPattern: false - enableTelemetry: true -# End: Build Frontend -# Publish results -- task: PublishBuildArtifacts@1 - displayName: 'publish artifacts' - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - diff --git a/Deployment/release.yml b/Deployment/release.yml deleted file mode 100644 index d5cd8f7..0000000 --- a/Deployment/release.yml +++ /dev/null @@ -1,62 +0,0 @@ -Prepare config: - -steps: -- task: qetza.replacetokens.replacetokens-task.replacetokens@5 - displayName: 'Prepare config' - inputs: - rootDirectory: '$(System.DefaultWorkingDirectory)/_Duina/drop' - targetFiles: | - Frontend/main*.js - WebAPI/appsettings.json - WebAPI/client_secrets.json - verbosity: detailed - actionOnMissing: fail - actionOnNoFiles: warn - - -Create fronternd archive: - -steps: -- task: ArchiveFiles@2 - displayName: 'Create Frontend archive' - inputs: - rootFolderOrFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/Frontend' - archiveFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/zip/DiunaBI-Staging-Frontend.zip' - -Create backend archive: - -steps: -- task: ArchiveFiles@2 - displayName: 'Create Backend archive' - inputs: - rootFolderOrFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/WebAPI' - archiveFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/zip/DiunaBI-Staging-WebAPI.zip' - -Securely copy files to the remote machine: - -steps: -- task: ArchiveFiles@2 - displayName: 'Create Backend archive' - inputs: - rootFolderOrFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/WebAPI' - archiveFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/zip/DiunaBI-Staging-WebAPI.zip' - -Run shell commands on remote machine: - -steps: -- task: SSH@0 - displayName: 'Run shell commands on remote machine' - inputs: - sshEndpoint: 'crm.bim-it.pl' - commands: | - rm -rf /srv/diunabi.bim-it.pl/* - unzip -o /home/mz/deployment/DiunaBI-Staging-Frontend.zip -d /home/mz/deployment - bash /home/mz/deployment/updateSWHash.sh - cp -R /home/mz/deployment/Frontend/* /srv/diunabi.bim-it.pl/ - sudo systemctl stop DiunaBI-WebAPI - rm -rf /home/mz/services/DiunaBI-WebAPI/* - unzip -o /home/mz/deployment/DiunaBI-Staging-WebAPI.zip -d /home/mz/deployment - cp -R /home/mz/deployment/WebAPI/* /home/mz/services/DiunaBI-WebAPI/ - sudo systemctl start DiunaBI-WebAPI - rm -rf /home/mz/deployment/Frontend - rm -rf /home/mz/deployment/WebAPI diff --git a/DiunaBI.sln b/DiunaBI.sln deleted file mode 100644 index 1a7ee88..0000000 --- a/DiunaBI.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.4.33110.190 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiunaBI-WebAPI", "WebAPI\DiunaBI-WebAPI.csproj", "{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2CFA03A7-56D9-4ADE-9B6A-1A3383A1C104} - EndGlobalSection -EndGlobal diff --git a/Frontend/.vscode/extensions.json b/Frontend/.vscode/extensions.json deleted file mode 100644 index 77b3745..0000000 --- a/Frontend/.vscode/extensions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 - "recommendations": ["angular.ng-template"] -} diff --git a/Frontend/.vscode/launch.json b/Frontend/.vscode/launch.json deleted file mode 100644 index f982ce8..0000000 --- a/Frontend/.vscode/launch.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "type": "chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:4200", - "webRoot": "${workspaceFolder}", - "userDataDir": false - } - ] - } \ No newline at end of file diff --git a/Frontend/.vscode/tasks.json b/Frontend/.vscode/tasks.json deleted file mode 100644 index a298b5b..0000000 --- a/Frontend/.vscode/tasks.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "start", - "isBackground": true, - "problemMatcher": { - "owner": "typescript", - "pattern": "$tsc", - "background": { - "activeOnStart": true, - "beginsPattern": { - "regexp": "(.*?)" - }, - "endsPattern": { - "regexp": "bundle generation complete" - } - } - } - }, - { - "type": "npm", - "script": "test", - "isBackground": true, - "problemMatcher": { - "owner": "typescript", - "pattern": "$tsc", - "background": { - "activeOnStart": true, - "beginsPattern": { - "regexp": "(.*?)" - }, - "endsPattern": { - "regexp": "bundle generation complete" - } - } - } - } - ] -} diff --git a/WebAPI/.DS_Store b/WebAPI/.DS_Store deleted file mode 100644 index e8ba1c4ba1d8f14134893a4fba5fe81a0191b3fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMK~EDw6n;aiT_9i+A;G9&6AxY}0x_WRQc8((Fd^2+K~3GI6&9DBrrS~yLejJT z2mgZc<{#1j;z_?Zv((+~HiS!K!pvso?asdM&CK^^X8Wc@Br4s;D$xQFS;#Dl(GnA7zX|a2Jp@1WR3Xl>$j#f3>XHk zB?G)a*vKr)k?d=!whk031c1z=S|!{g4p107lI2MDwNy~p)X{^8pdtz}gofk2&FYZl zNcOeVa1t6$B5GMg5sFZ)17|CB5@jt-X&5jJ3^Ty7`z_j}7OrX{em_MNzfAiS?)Y-w z^`#3GP&Gq>rmPJhF+ODbx%#6blaRU{9l#7TZJg`6EA zccCpYh9f5%*kyw&`@hebycm=WdRk z!=}W(!XB=o1yAiPFYx5U3i~c=ui`x=Zf8DWr$&cB>iK+$CAGW6Efpw^NcCUMo4EEA zy+n@>&`Vx@9!3(R*Pq&%;+UJjNO+M)n6j@{Q(QL(O*hTCS}k#{DR_x}qx*53#h6+v zSs2YR_Z>4n64K~Si098!hjkb^%Aac@JFG37}1wL}fl*bf5! T{f;o-|Dov4eE-#?yavTzgp?|d diff --git a/WebAPI/AppDbContext.cs b/WebAPI/AppDbContext.cs deleted file mode 100644 index f0e910b..0000000 --- a/WebAPI/AppDbContext.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using WebAPI.Models; - -namespace WebAPI; - -public class AppDbContext(DbContextOptions options) : DbContext(options) -{ - public DbSet Users { get; init; } - public DbSet Layers { get; init; } - public DbSet Records { get; init; } - public DbSet ProcessSources { get; init; } - public DbSet DataInbox { get; init; } - public DbSet QueueJobs { get; init; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity().HasKey(x => new - { - x.LayerId, - x.SourceId - }); - } - - private static readonly LoggerFactory MyLoggerFactory = - new(new[] { - new Microsoft.Extensions.Logging.Debug.DebugLoggerProvider() - }); - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder.UseLoggerFactory(MyLoggerFactory); - } -} \ No newline at end of file diff --git a/WebAPI/Calculators/BaseCalc.cs b/WebAPI/Calculators/BaseCalc.cs deleted file mode 100644 index 75f2972..0000000 --- a/WebAPI/Calculators/BaseCalc.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System.Globalization; -using DiunaBIWebAPI.dataProcessors; -using WebAPI.Models; -using AngouriMath; - -namespace WebAPI.Calculator; - -public class BaseCalc -{ - public string Expression { get; } - private string ResultCode { get; set; } - private string Formula { get; } - - public BaseCalc(string expression) - { - Expression = expression; - Formula = Expression.Split("=")[1]; - ResultCode = Expression.Split("=")[0]; - } - - public bool IsFormulaCorrect() - { - // check left side of expression - if (!ResultCode.StartsWith('[') || !ResultCode.EndsWith(']')) - { - return false; - } - - if (!ResultCode.Substring(1, ResultCode.Length - 2).All(char.IsDigit)) - { - return false; - } - - ResultCode = ResultCode.Substring(1, ResultCode.Length - 2); - - // check right side of expression - return !string.IsNullOrEmpty(Formula) && - Formula.All(c => char.IsDigit(c) || c == '[' || c == ']' || c == '+' || c == '-'); - } - - public Record CalculateT3(List records) - { - var resultCode = ResultCode; - { - var result = new Record - { - Id = Guid.NewGuid(), - Code = resultCode, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - var codes = GetCodes(); - var ingredients = new List(); - foreach (var code in codes) - { - var ingredient = records.FirstOrDefault(r => r.Code == code); - if (ingredient == null) - { - throw new Exception($"Record for code {code} not found."); - } - - ingredients.Add(ingredient); - } - - for (var i = 1; i <= 32; i++) - { - var formula = ingredients.Aggregate(Formula, - (current, ingredient) => current.Replace($"[{ingredient.Code}]", - ProcessHelper.GetValue(ingredient, i)?.ToString(CultureInfo.InvariantCulture))); - if (formula.Contains('[')) - { - throw new Exception($"Not all placeholders were replaced. Value{i} [{formula}]"); - } - - Entity expr = formula; - ProcessHelper.SetValue(result, i, (double)expr.EvalNumerical()); - } - - return result; - } - } - - public Record CalculateT1(List records) - { - var resultCode = ResultCode; - { - var result = new Record - { - Id = Guid.NewGuid(), - Code = resultCode, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - var codes = GetCodes(); - var ingredients = new List(); - foreach (var code in codes) - { - var ingredient = records.FirstOrDefault(r => r.Code == code); - if (ingredient == null) - { - throw new Exception($"Record for code {code} not found."); - } - - ingredients.Add(ingredient); - } - - - var formula = ingredients.Aggregate(Formula, - (current, ingredient) => current.Replace($"[{ingredient.Code}]", - ProcessHelper.GetValue(ingredient, 32)?.ToString(CultureInfo.InvariantCulture))); - if (formula.Contains('[')) - { - throw new Exception($"Not all placeholders were replaced. Value{1} [{formula}]"); - } - - Entity expr = formula; - ProcessHelper.SetValue(result, 32, (double)expr.EvalNumerical()); - - return result; - } - } - - private List GetCodes() - { - var codes = new List(); - var endIndex = -1; - - while (true) - { - var startIndex = Formula.IndexOf("[", endIndex + 1, StringComparison.CurrentCulture); - endIndex = Formula.IndexOf("]", startIndex + 1, StringComparison.CurrentCulture); - - if (startIndex == -1 || endIndex == -1) - { - break; - } - - var valueCode = Formula.Substring(startIndex + 1, endIndex - startIndex - 1); - codes.Add(valueCode); - } - - return codes; - } -} \ No newline at end of file diff --git a/WebAPI/Controllers/AdminController.cs b/WebAPI/Controllers/AdminController.cs deleted file mode 100644 index fea5d1c..0000000 --- a/WebAPI/Controllers/AdminController.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Data; -using Google.Cloud.Firestore; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Data.SqlClient; -using WebAPI.Models; - -namespace WebAPI.Controllers; - -[ApiController] -[Route("api/[controller]")] -public class AdminController : Controller { - - private readonly IConfiguration _configuration; - - public AdminController( - IConfiguration configuration) - { - _configuration = configuration; - } - - [HttpGet] - [Route("Version")] - public IActionResult GetVersion() { - return Ok(new { version = _configuration["app-version"] }); - } -} \ No newline at end of file diff --git a/WebAPI/Controllers/AuthController.cs b/WebAPI/Controllers/AuthController.cs deleted file mode 100644 index 0be3a18..0000000 --- a/WebAPI/Controllers/AuthController.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Google.Apis.Auth; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.IdentityModel.Tokens; -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using System.Text; -using WebAPI.Models; - -namespace WebAPI.Controllers; - -[ApiController] -[Route("api/[controller]")] -// [Authorize] -public class AuthController : Controller -{ - private readonly AppDbContext _db; - private readonly IConfiguration _configuration; - public AuthController( - AppDbContext db, IConfiguration configuration) - { _db = db; _configuration = configuration; } - - [HttpPost] - [Route("apiToken")] - public async Task ApiToken([FromBody] string credential) - { - var settings = new GoogleJsonWebSignature.ValidationSettings - { - Audience = new List { _configuration.GetValue("GoogleClientId")! } - }; - var payload = await GoogleJsonWebSignature.ValidateAsync(credential, settings); - var user = _db.Users.AsNoTracking().FirstOrDefault(x => x.Email == payload.Email); - return user != null ? (IActionResult)Ok(JwtGenerator(user)) : Unauthorized(); - } - - private dynamic JwtGenerator(User user) - { - var key = Encoding.ASCII.GetBytes(_configuration.GetValue("Secret")!); - var expirationTime = DateTime.UtcNow.AddMinutes(5); - var tokenDescriptor = new SecurityTokenDescriptor - { - Subject = new ClaimsIdentity(new[] - { - new Claim("Id", Guid.NewGuid().ToString()), - new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString()), - new Claim(JwtRegisteredClaimNames.Jti, - Guid.NewGuid().ToString()) - }), - Expires = expirationTime, - SigningCredentials = new SigningCredentials - (new SymmetricSecurityKey(key), - SecurityAlgorithms.HmacSha512Signature) - }; - var tokenHandler = new JwtSecurityTokenHandler(); - var token = tokenHandler.CreateToken(tokenDescriptor); - var stringToken = tokenHandler.WriteToken(token); - return new { token = stringToken, id = user.Id, expirationTime }; - } -} \ No newline at end of file diff --git a/WebAPI/Controllers/DataInboxController.cs b/WebAPI/Controllers/DataInboxController.cs deleted file mode 100644 index f4c6ec9..0000000 --- a/WebAPI/Controllers/DataInboxController.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System.Data; -using System.Text; -using Google.Cloud.Firestore; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Data.SqlClient; -using Microsoft.EntityFrameworkCore; -using WebAPI.Models; - -namespace WebAPI.Controllers; - -[ApiController] -[Route("api/[controller]")] -public class DataInboxController : Controller -{ - private readonly AppDbContext _db; - private readonly IConfiguration _configuration; - private readonly LogsController _logsController; - - public DataInboxController( - AppDbContext db, - IConfiguration configuration, - FirestoreDb firestoreDb) - { - _db = db; - _configuration = configuration; - _logsController = new LogsController(firestoreDb); - } - - [HttpPut] - [Route("Add/{apiKey}")] - [AllowAnonymous] - public IActionResult Add(string apiKey, [FromBody] DataInbox dataInbox) - { - if (apiKey != _configuration["apiKey"]) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - wrong apiKey ({dataInbox.Source})", - Type = LogEntryType.Warning, - LogType = LogType.DataInbox, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - try - { - if ( - !Request.Headers.TryGetValue("Authorization", out var authHeader)) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - no authorization header ({dataInbox.Source})", - Type = LogEntryType.Warning, - LogType = LogType.DataInbox, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - var credentialsArr = authHeader.ToString().Split(" "); - if (credentialsArr.Length != 2) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - wrong auth header format ({dataInbox.Source})", - Type = LogEntryType.Warning, - LogType = LogType.DataInbox, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - var authValue = Encoding.UTF8.GetString(Convert.FromBase64String(credentialsArr[1])); - var username = authValue.Split(':')[0]; - var password = authValue.Split(':')[1]; - if (username != _configuration["morska-user"] || password != _configuration["morska-pass"]) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - bad credentials ({dataInbox.Source})", - Type = LogEntryType.Warning, - LogType = LogType.DataInbox, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - // check if datainbox.data is base64 encoded value - if (!string.IsNullOrEmpty(dataInbox.Data) && !IsBase64String(dataInbox.Data)) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Invalid data format - not base64 encoded ({dataInbox.Source})", - Type = LogEntryType.Warning, - LogType = LogType.DataInbox, - CreatedAt = DateTime.UtcNow - }); - return BadRequest("Invalid data format - not base64 encoded"); - } - - - dataInbox.Id = Guid.NewGuid(); - dataInbox.CreatedAt = DateTime.UtcNow; - _db.DataInbox.Add(dataInbox); - _db.SaveChanges(); - - _logsController.AddEntry(new LogEntry - { - Title = $"Insert success: {dataInbox.Source}, {dataInbox.Name}", - Type = LogEntryType.Info, - LogType = LogType.DataInbox, - CreatedAt = DateTime.UtcNow - }); - - if (dataInbox.Name == "morska.d3.importer") - { - // TODO: import dataInbox as Layer - } - - return Ok(); - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Insert error: {dataInbox.Source}, {dataInbox.Name}", - Type = LogEntryType.Error, - LogType = LogType.DataInbox, - Message = e.ToString(), - CreatedAt = DateTime.UtcNow - }); - return BadRequest(e.ToString()); - } - } - - [HttpGet] - public IActionResult GetAll() - { - return Ok(_db.DataInbox.AsNoTracking().ToList()); - } - - // helpers - private bool IsBase64String(string data) - { - if (string.IsNullOrEmpty(data)) - { - return false; - } - try - { - var base64Bytes = Convert.FromBase64String(data); - - var utf8String = Encoding.UTF8.GetString(base64Bytes); - - var reEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(utf8String)); - return data.TrimEnd('=') == reEncoded.TrimEnd('='); - } - catch (FormatException) - { - return false; - } - catch (DecoderFallbackException) - { - return false; - } - } -} \ No newline at end of file diff --git a/WebAPI/Controllers/LayersController.cs b/WebAPI/Controllers/LayersController.cs deleted file mode 100644 index e3e0677..0000000 --- a/WebAPI/Controllers/LayersController.cs +++ /dev/null @@ -1,853 +0,0 @@ -using System.Globalization; -using System.Text; -using DiunaBIWebAPI.dataImporters; -using Google.Apis.Sheets.v4; -using Google.Cloud.Firestore; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using WebAPI.dataProcessors; -using WebAPI.Exports; -using WebAPI.Models; - -namespace WebAPI.Controllers; - -[ApiController] -[Route("api/[controller]")] -public class LayersController : Controller -{ - private readonly AppDbContext _db; - private readonly SpreadsheetsResource.ValuesResource? _googleSheetValues; - private readonly GoogleDriveHelper _googleDriveHelper; - private readonly IConfiguration _configuration; - private readonly LogsController _logsController; - - public LayersController( - AppDbContext db, - GoogleSheetsHelper googleSheetsHelper, - GoogleDriveHelper googleDriveHelper, - IConfiguration configuration, - FirestoreDb firestoreDb - ) - { - _db = db; - if (googleSheetsHelper.Service is not null) - { - _googleSheetValues = googleSheetsHelper.Service.Spreadsheets.Values; - } - - _googleDriveHelper = googleDriveHelper; - _configuration = configuration; - _logsController = new LogsController(firestoreDb); - } - - [HttpGet] - public IActionResult GetAll(int start, int limit, string? name, LayerType? type) - { - try - { - var response = _db.Layers.Where(x => !x.IsDeleted); - if (name != null) - { - response = response.Where(x => x.Name != null && x.Name.Contains(name)); - } - - if (type != null) - { - response = response.Where(x => x.Type == type); - } - - return Ok(response - .OrderByDescending(x => x.Number) - .Skip(start).Take(limit).AsNoTracking().ToList()); - } - catch (Exception e) - { - return BadRequest(e.ToString()); - } - } - - [HttpGet] - [Route("{id:guid}")] - public IActionResult Get(Guid id) - { - try - { - return Ok(_db.Layers - .Include(x => x.CreatedBy) - .Include(x => x.ModifiedBy) - .Include(x => x.Records).AsNoTracking().First(x => x.Id == id && !x.IsDeleted)); - } - catch (Exception e) - { - return BadRequest(e.ToString()); - } - } - - [HttpGet] - [Route("getForPowerBI/{apiKey}/{number:int}")] - public IActionResult GetByNumber(string apiKey, int number) - { - if (apiKey != _configuration["apiKey"]) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - wrong apiKey ({number})", - Type = LogEntryType.Warning, - LogType = LogType.PowerBi, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - try - { - if ( - !Request.Headers.TryGetValue("Authorization", out var authHeader)) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - no authorization header ({number})", - Type = LogEntryType.Warning, - LogType = LogType.PowerBi, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - var credentialsArr = authHeader.ToString().Split(" "); - if (credentialsArr.Length != 2) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - wrong auth header format ({number})", - Type = LogEntryType.Warning, - LogType = LogType.PowerBi, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - var authValue = Encoding.UTF8.GetString(Convert.FromBase64String(credentialsArr[1])); - var username = authValue.Split(':')[0]; - var password = authValue.Split(':')[1]; - if (username != _configuration["powerBI-user"] || password != _configuration["powerBI-pass"]) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Unauthorized request - bad credentials ({number})", - Type = LogEntryType.Warning, - LogType = LogType.PowerBi, - CreatedAt = DateTime.UtcNow - }); - return Unauthorized(); - } - - _logsController.AddEntry(new LogEntry - { - Title = $"Sending data for layer {number}", - Type = LogEntryType.Info, - LogType = LogType.PowerBi, - CreatedAt = DateTime.UtcNow - }); - - return Ok(_db.Layers - .Include(x => x.CreatedBy) - .Include(x => x.Records).AsNoTracking().First(x => x.Number == number && !x.IsDeleted)); - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = e.ToString(), - Type = LogEntryType.Error, - LogType = LogType.PowerBi, - CreatedAt = DateTime.UtcNow - }); - return BadRequest(e.ToString()); - } - } - - [HttpGet] - [Route("getConfiguration/{apiKey}/{number:int}")] - public IActionResult GetConfigurationByNumber(string apiKey, int number) - { - if (apiKey != _configuration["apiKey"]) - { - return Unauthorized(); - } - - try - { - if ( - !Request.Headers.TryGetValue("Authorization", out var authHeader)) - { - return Unauthorized(); - } - - var credentialsArr = authHeader.ToString().Split(" "); - if (credentialsArr.Length != 2) - { - return Unauthorized(); - } - - var authValue = Encoding.UTF8.GetString(Convert.FromBase64String(credentialsArr[1])); - var username = authValue.Split(':')[0]; - var password = authValue.Split(':')[1]; - if (username != _configuration["morska-user"] || password != _configuration["morska-pass"]) - { - return Unauthorized(); - } - - var config = _db.Layers - .Include(x => x.Records) - .AsNoTracking() - .First(x => x.Number == number && !x.IsDeleted); - - if (config is null) - { - return BadRequest(); - } - - var type = config.Records?.Where(x => x.Code == "Type").FirstOrDefault(); - if (type is null || type.Desc1 != "ExternalConfiguration") { - return BadRequest(); - } - - return Ok(config); - } - catch - { - return BadRequest(); - } - } - - [HttpGet] - [Route("exportToGoogleSheet/{id:guid}")] - public IActionResult ExportToGoogleSheet(Guid id) - { - if (_googleSheetValues is null) - { - throw new Exception("Google Sheets API not initialized"); - } - - var layer = _db.Layers - .Include(x => x.Records!.OrderByDescending(y => y.Code)).AsNoTracking().First(x => x.Id == id && !x.IsDeleted); - - var export = new GoogleSheetExport(_googleDriveHelper, _googleSheetValues, _configuration); - export.Export(layer); - return Ok(true); - } - - [HttpGet] - [Route("AutoImportWithQueue/{apiKey}")] - [AllowAnonymous] - public IActionResult AutoImportWithQueue(string apiKey) - { - if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"]) - { - return Unauthorized(); - } - - var importWorkerLayers = _db.Layers - .Include(x => x.Records) - .Where(x => - x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ImportWorker") && - x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True") - ) - .OrderBy(x => x.CreatedAt) - .AsNoTracking() - .ToList(); - - if (importWorkerLayers.Count == 0) - { - _logsController.AddEntry(new LogEntry - { - Title = "No Layers to import.", - Type = LogEntryType.Info, - LogType = LogType.Queue, - CreatedAt = DateTime.UtcNow - }); - return Ok(); - } - - foreach (var importWorker in importWorkerLayers) - { - try - { - /* - await _queue.AddJob(new QueueJob - { - LayerId = importWorker.Id, - Type = JobType.ImportWorker, - }); - */ - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = $"Error while adding job into queue (import): {importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Error, - LogType = LogType.Queue, - Message = e.ToString(), - CreatedAt = DateTime.UtcNow - }); - } - } - return Ok(); - } - - [HttpGet] - [Route("ProcessQueue/{apiKey}")] - [AllowAnonymous] - public IActionResult ProcessQueue(string apiKey) - { - /* - var allJobs = await _queue.GetJobs(); - var importJobs = allJobs - .Where(x => x.Type == JobType.ImportWorker && x.Status == JobStatus.New); - - foreach (var job in importJobs) - { - job.Attempts = job.Attempts + 1; - //await _queue.UpdateJob(job); - } - */ - return Ok(); - } - - [HttpGet] - [Route("AutoImport/{apiKey}/{nameFilter}")] - [AllowAnonymous] - public IActionResult AutoImport(string apiKey, string nameFilter) - { - if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"]) - { - return Unauthorized(); - } - - if (_googleSheetValues is null) - { - throw new Exception("Google Sheets API not initialized"); - } - - var importWorkerLayers = _db.Layers - .Include(x => x.Records) - .Where(x => - x.Name != null && x.Name.Contains(nameFilter) && - x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ImportWorker") && - x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True") - ) - .OrderByDescending(x => x.CreatedAt) - .AsNoTracking() - .ToList(); - _logsController.AddEntry(new LogEntry - { - Title = $"Starting import: {nameFilter}, Admin layers count ({importWorkerLayers.Count})", - Type = LogEntryType.Info, - LogType = LogType.Import, - CreatedAt = DateTime.UtcNow - }); - try - { - if (importWorkerLayers.Count == 0) - { - _logsController.AddEntry(new LogEntry - { - Title = "No Layers to import.", - Type = LogEntryType.Info, - LogType = LogType.Import, - CreatedAt = DateTime.UtcNow - }); - return Ok(); - } - - foreach (var importWorker in importWorkerLayers) - { - try - { - var type = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportType")?.Desc1 ?? - "Standard"; - var source = importWorker.Records!.FirstOrDefault(x => x.Code == "Source")?.Desc1 ?? - "GoogleSheet"; - if (source == "DataInbox" && type == "Import-D3") { - var d3Importer = new MorskaD3Importer(_db, this); - d3Importer.Import(importWorker); - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Import, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - continue; - } - switch (type) - { - case "D1": - var d1Importer = new MorskaD1Importer(_db, _googleSheetValues, this); - d1Importer.Import(importWorker); - Thread.Sleep(5000); // be aware of GSheet API quota - - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Import, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - break; - case "FK2": - { - var fk2Importer = new MorskaFk2Importer(_db, _googleSheetValues, this); - fk2Importer.Import(importWorker); - Thread.Sleep(5000); // be aware of GSheet API quota - - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Import, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - break; - } - default: - { - var startDate = importWorker.Records!.FirstOrDefault(x => x.Code == "StartDate")?.Desc1; - if (startDate == null) - { - throw new Exception("StartDate record nod found"); - } - - var endDate = importWorker.Records!.First(x => x.Code == "EndDate").Desc1; - if (endDate == null) - { - throw new Exception("EndDate record nod found"); - } - - var startDateParsed = DateTime.ParseExact(startDate, "yyyy.MM.dd", null); - var endDateParsed = DateTime.ParseExact(endDate, "yyyy.MM.dd", null); - if (startDateParsed.Date <= DateTime.UtcNow.Date && - endDateParsed.Date >= DateTime.UtcNow.Date) - { - var importer = new MorskaImporter(_db, _googleSheetValues, this); - importer.Import(importWorker); - Thread.Sleep(5000); // be aware of GSheet API quota - - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Import, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - } - else if (IsImportedLayerUpToDate(importWorker) == false) - { - var importer = new MorskaImporter(_db, _googleSheetValues, this); - importer.Import(importWorker); - Thread.Sleep(5000); // be aware of GSheet API quota - - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Import, - Message = "Success (reimported)", - CreatedAt = DateTime.UtcNow - }); - } - else - { - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Import, - Message = "importLayer records are up to date. Not processed.", - CreatedAt = DateTime.UtcNow - }); - } - - break; - } - } - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = $"{importWorker.Name}, {importWorker.Id}", - Type = LogEntryType.Error, - LogType = LogType.Import, - Message = e.ToString(), - CreatedAt = DateTime.UtcNow - }); - } - } - - return Ok(); - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = "Process error", - Type = LogEntryType.Error, - LogType = LogType.Import, - Message = e.ToString(), - CreatedAt = DateTime.UtcNow - }); - return BadRequest(e.ToString()); - } - } - - [HttpGet] - [Route("AutoProcess/{apiKey}")] - [AllowAnonymous] - public IActionResult AutoProcess(string apiKey) - { - if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"]) - { - return Unauthorized(); - } - - if (_googleSheetValues is null) - { - throw new Exception("Google Sheets API not initialized"); - } - - string[] processTypes = - [ - "T3-SingleSource", - "T3-SourceYearSummary", - "T3-MultiSourceSummary", // AA - "T3-MultiSourceYearSummary", // AA/13 - "T4-SingleSource", - "T5-LastValues", - "T1-R1", - "T4-R2", - "T1-R3" - ]; - - foreach (var type in processTypes) - { - try - { - var processWorkerLayers = _db.Layers - .Include(x => x.Records) - .Where(x => - x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ProcessWorker") && - x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True") && - x.Records!.Any(y => y.Code == "ProcessType" && y.Desc1 == type) - ) - .OrderBy(x => x.CreatedAt) - .AsNoTracking() - .ToList(); - - foreach (var processWorker in processWorkerLayers) - { - try - { - ProcessLayer(processWorker); - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Error, - LogType = LogType.Process, - Message = e.ToString(), - CreatedAt = DateTime.UtcNow - }); - } - } - } - catch (Exception e) - { - _logsController.AddEntry(new LogEntry - { - Title = "Process error", - Type = LogEntryType.Error, - LogType = LogType.Process, - Message = e.ToString(), - CreatedAt = DateTime.UtcNow - }); - } - } - - return Ok(); - } - - private void ProcessLayer(Layer processWorker) - { - if (_googleSheetValues == null) - { - throw new Exception("Google Sheets API not initialized"); - } - - var year = processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1; - if (year == null) - { - throw new Exception("Year record nod found"); - } - - var processType = processWorker.Records?.SingleOrDefault(x => x.Code == "ProcessType")?.Desc1; - switch (processType) - { - case null: - throw new Exception("ProcessType record not found"); - case "T3-SourceYearSummary": - { - var processor = - new T3SourceYearSummaryProcessor(_db, this); - processor.Process(processWorker); - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - return; - } - case "T3-MultiSourceYearSummary": - { - var processor = - new T3MultiSourceYearSummaryProcessor(_db, this, _logsController); - processor.Process(processWorker); - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - return; - } - case "T3-MultiSourceCopySelectedCodesYearSummary": - { - var processor = - new T3MultiSourceCopySelectedCodesYearSummaryProcessor(_db, this); - processor.Process(processWorker); - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - return; - } - case "T1-R1": - { - var processor = new T1R1Processor(_db, _googleSheetValues, this, _logsController); - processor.Process(processWorker); - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - return; - } - case "T4-R2": - { - var processor = new T4R2Processor(_db, this, _logsController, _googleSheetValues); - processor.Process(processWorker); - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - return; - } - case "T1-R3": - { - var processor = new T1R3Processor(_db, this, _googleSheetValues); - processor.Process(processWorker); - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - return; - } - } - - var month = processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1; - if (month == null) - { - throw new Exception("Month record not found"); - } - - switch (processType!) - { - case "T3-SingleSource": - { - var t3SingleSource = new T3SingleSourceProcessor(_db, this); - t3SingleSource.Process(processWorker); - break; - } - case "T4-SingleSource": - { - var t4SingleSource = new T4SingleSourceProcessor(_db, this); - t4SingleSource.Process(processWorker); - break; - } - case "T5-LastValues": - { - var t5LastValues = new T5LastValuesProcessor(_db, this); - t5LastValues.Process(processWorker); - break; - } - case "T3-MultiSourceSummary": - { - var t3MultiSourceSummary = - new T3MultiSourceSummaryProcessor(_db, this, _logsController); - t3MultiSourceSummary.Process(processWorker); - break; - } - case "T3-MultiSourceCopySelectedCodes": - { - var t3MultiSourceCopySelectedCode = - new T3MultiSourceCopySelectedCodesProcessor(_db, this); - t3MultiSourceCopySelectedCode.Process(processWorker); - break; - } - } - - _logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Info, - LogType = LogType.Process, - Message = "Success", - CreatedAt = DateTime.UtcNow - }); - } - - internal void SaveRecords(Guid id, ICollection records, Guid currentUserId) - { - var toDelete = _db.Records.Where(x => x.LayerId == id).ToList(); - if (toDelete.Count > 0) - { - _db.Records.RemoveRange(toDelete); - } - - foreach (var record in records) - { - record.CreatedById = currentUserId; - record.CreatedAt = DateTime.UtcNow; - record.ModifiedById = currentUserId; - record.ModifiedAt = DateTime.UtcNow; - record.LayerId = id; - _db.Records.Add(record); - } - } - - private static void WriteToConsole(params string[] messages) - { - foreach (var message in messages) - { - Console.WriteLine($"DiunaLog: {message}"); - } - } - - private bool IsImportedLayerUpToDate(Layer importWorker) - { - if (_googleSheetValues is null) - { - throw new Exception("Google Sheets API not initialized"); - } - - var newestLayer = _db.Layers - .Include(x => x.Records) - .Where(x => x.ParentId == importWorker.Id) - .OrderByDescending(x => x.CreatedAt) - .AsNoTracking() - .FirstOrDefault(); - - if (newestLayer is null) - { - return true; // importWorker is not active yet, no check needed - } - - var sheetId = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetId")?.Desc1; - if (sheetId == null) - { - throw new Exception($"SheetId not found, {importWorker.Name}"); - } - - var sheetTabName = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetTabName")?.Desc1; - if (sheetTabName == null) - { - throw new Exception($"SheetTabName not found, {importWorker.Name}"); - } - - var dataRange = importWorker.Records!.FirstOrDefault(x => x.Code == "DataRange")?.Desc1; - if (dataRange == null) - { - throw new Exception($"DataRange not found, {importWorker.Name}"); - } - - var dataRangeResponse = _googleSheetValues.Get(sheetId, $"{sheetTabName}!{dataRange}").Execute(); - var data = dataRangeResponse.Values; - - var isUpToDate = true; - - for (var i = 0; i < data[1].Count; i++) - { - if (data[0][i].ToString() == "") continue; - var record = newestLayer.Records!.FirstOrDefault(x => x.Code == data[0][i].ToString()); - if (record == null) - { - WriteToConsole("Code not found in DiunaBI", data[0][i].ToString()!); - isUpToDate = false; - continue; - } - - if (!double.TryParse(data[1][i].ToString(), CultureInfo.GetCultureInfo("pl-PL"), - out var value) || - double.Abs((double)(record.Value1 - value)!) < 0.01) continue; - isUpToDate = false; - } - - foreach (var record in newestLayer.Records!) - { - if (data[0].Contains(record.Code)) - { - continue; - } - - WriteToConsole($"Code not found in GoogleSheet: {record.Code}"); - isUpToDate = false; - } - - return isUpToDate; - } -} \ No newline at end of file diff --git a/WebAPI/Controllers/LogsController.cs b/WebAPI/Controllers/LogsController.cs deleted file mode 100644 index 449d5e4..0000000 --- a/WebAPI/Controllers/LogsController.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Globalization; -using Google.Apis.Sheets.v4; -using Google.Apis.Sheets.v4.Data; -using Google.Cloud.Firestore; -using Microsoft.AspNetCore.Mvc; -using WebAPI.Models; - -namespace WebAPI.Controllers; - -public class LogsController : Controller -{ - - private readonly FirestoreDb _firestoreDb; - private readonly Guid _SessionId = Guid.NewGuid(); - public LogsController( - FirestoreDb firestoreDb - ) - { - _firestoreDb = firestoreDb; - } - - public void AddEntry(LogEntry entry) - { - entry.SessionId = _SessionId; - entry.Instance = LogInstance.Morska; - - if (entry.Type == LogEntryType.Info) { return ;} - - try { - var collection = _firestoreDb.Collection("ApiLogs"); - var document = collection.Document(); - document.SetAsync(new { - entry.Message, - entry.Title, - Type = Enum.GetName(typeof(LogEntryType), entry.Type), - LogType = Enum.GetName(typeof(LogType), entry.LogType), - Instance = Enum.GetName(typeof(LogInstance), entry.Instance), - entry.CreatedAt, - SessionId = entry.SessionId.ToString() - }).Wait(); - } catch (Exception e) { - Console.WriteLine(e.Message); - } - } -} \ No newline at end of file diff --git a/WebAPI/Controllers/PingController.cs b/WebAPI/Controllers/PingController.cs deleted file mode 100644 index d50f2c0..0000000 --- a/WebAPI/Controllers/PingController.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace WebAPI.Controllers; - -[ApiController] -[Route("api/[controller]")] -[Authorize] -public class PingController : Controller -{ - private readonly IConfiguration _configuration; - public PingController( - IConfiguration configuration) - { - _configuration = configuration; - } - - [HttpGet] - [Route("Ping")] - [AllowAnonymous] - public IActionResult Ping() - { - return Ok(_configuration["PONG"]); - } -} \ No newline at end of file diff --git a/WebAPI/DiunaBI-WebAPI.csproj b/WebAPI/DiunaBI-WebAPI.csproj deleted file mode 100644 index 8ab073d..0000000 --- a/WebAPI/DiunaBI-WebAPI.csproj +++ /dev/null @@ -1,46 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - PreserveNewest - true - PreserveNewest - - - - - - - - - - - - diff --git a/WebAPI/Exports/googleSheet.export.cs b/WebAPI/Exports/googleSheet.export.cs deleted file mode 100644 index 03f2cf0..0000000 --- a/WebAPI/Exports/googleSheet.export.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Globalization; -using Google.Apis.Sheets.v4; -using Google.Apis.Sheets.v4.Data; -using WebAPI.Models; - -namespace WebAPI.Exports; - -public class GoogleSheetExport -{ - private readonly GoogleDriveHelper _googleDriveHelper; - private readonly SpreadsheetsResource.ValuesResource _googleSheetValues; - private readonly IConfiguration _configuration; - public GoogleSheetExport( - GoogleDriveHelper googleDriveHelper, - SpreadsheetsResource.ValuesResource googleSheetValues, - IConfiguration configuration) - { - _googleDriveHelper = googleDriveHelper; - _googleSheetValues = googleSheetValues; - _configuration = configuration; - } - public void Export(Layer layer) - { - if (_googleDriveHelper.Service is null) - { - throw new Exception("Google Drive API not initialized"); - } - try - { - - var data = new List> { new List { layer.Name! } }; - - switch (layer.Type) - { - case LayerType.Import: - { - data.Add(new List { "Code", "Value1" }); - data.AddRange(layer.Records!.Select(record => new List { record.Code!, record.Value1! })); - break; - } - case LayerType.Administration: - { - data.Add(new List { "Code", "Desc1"}); - data.AddRange(layer.Records!.Select(record => new List { record.Code!, record.Desc1! })); - break; - } - case LayerType.Processed: - { - data.Add(new List { "Code", "Value1", "Value2", "Value3", "Value3", - "Value5", "Value6", "Value7", "Value8", "Value9", "Value10", - "Value11", "Value12", "Value13", "Value14", "Value15", "Value16", - "Value17", "Value18", "Value19", "Value20", "Value21", "Value22", - "Value23", "Value24", "Value25", "Value26", "Value27", "Value28", - "Value29", "Value30", "Value31", "Value32"}); - - data.AddRange(layer.Records!.Select(record => new List - { - record.Code!, - record.Value1!, - record.Value2!, - record.Value3!, - record.Value4!, - record.Value5!, - record.Value6!, - record.Value7!, - record.Value8!, - record.Value9!, - record.Value10!, - record.Value11!, - record.Value12!, - record.Value13!, - record.Value14!, - record.Value15!, - record.Value16!, - record.Value17!, - record.Value18!, - record.Value19!, - record.Value20!, - record.Value21!, - record.Value22!, - record.Value23!, - record.Value24!, - record.Value25!, - record.Value26!, - record.Value27!, - record.Value28!, - record.Value29!, - record.Value30!, - record.Value31!, - record.Value32! - })); - break; - } - default: - throw new Exception("Wrong LayerType"); - } - - var body = new Google.Apis.Drive.v3.Data.File - { - Name = $"{DateTime.Now.ToString(new CultureInfo("pl-PL"))}", - MimeType = "application/vnd.google-apps.spreadsheet", - Parents = new List { _configuration["exportDirectory"] } - }; - var request = _googleDriveHelper.Service.Files.Create(body); - var file = request.Execute(); - - var sheetId = file.Id; - var range = $"Sheet1!A1:AG${data.Count}"; - - var valueRange = new ValueRange { Values = data}; - - var updateRequest = _googleSheetValues.Update(valueRange, sheetId, range); - updateRequest.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.RAW; - updateRequest.Execute(); - - } catch (Exception e) - { - Console.WriteLine(e.ToString()); - } - } -} \ No newline at end of file diff --git a/WebAPI/GoogleDriveHelper.cs b/WebAPI/GoogleDriveHelper.cs deleted file mode 100644 index d588a85..0000000 --- a/WebAPI/GoogleDriveHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Google.Apis.Auth.OAuth2; -using Google.Apis.Drive.v3; -using Google.Apis.Services; - -namespace WebAPI; - -public class GoogleDriveHelper -{ - public DriveService? Service { get; private set; } - private const string ApplicationName = "Diuna"; - private static readonly string[] Scopes = [DriveService.Scope.Drive]; - public GoogleDriveHelper() - { - InitializeService(); - } - private void InitializeService() - { - var credential = GetCredentialsFromFile(); - Service = new DriveService(new BaseClientService.Initializer - { - HttpClientInitializer = credential, - ApplicationName = ApplicationName - }); - } - private static GoogleCredential GetCredentialsFromFile() - { - // ReSharper disable once RedundantAssignment - var fileName = "client_secrets.json"; -#if DEBUG - fileName = "client_secrets.Development.json"; -#endif - using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); - var credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes); - return credential; - } -} \ No newline at end of file diff --git a/WebAPI/GoogleSheetsHelper.cs b/WebAPI/GoogleSheetsHelper.cs deleted file mode 100644 index a7dbecd..0000000 --- a/WebAPI/GoogleSheetsHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Google.Apis.Auth.OAuth2; -using Google.Apis.Services; -using Google.Apis.Sheets.v4; - -namespace WebAPI; - -public class GoogleSheetsHelper -{ - public SheetsService? Service { get; private set; } - private const string ApplicationName = "Diuna"; - private static readonly string[] Scopes = [SheetsService.Scope.Spreadsheets]; - public GoogleSheetsHelper() - { - InitializeService(); - } - private void InitializeService() - { - var credential = GetCredentialsFromFile(); - Service = new SheetsService(new BaseClientService.Initializer - { - HttpClientInitializer = credential, - ApplicationName = ApplicationName - }); - } - private static GoogleCredential GetCredentialsFromFile() - { - var fileName = "client_secrets.json"; -#if DEBUG - fileName = "client_secrets.Development.json"; -#endif - using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); - var credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes); - return credential; - } -} \ No newline at end of file diff --git a/WebAPI/Migrations/20221205190148_Initial.Designer.cs b/WebAPI/Migrations/20221205190148_Initial.Designer.cs deleted file mode 100644 index 1afd7d1..0000000 --- a/WebAPI/Migrations/20221205190148_Initial.Designer.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20221205190148_Initial")] - partial class Initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20221205190148_Initial.cs b/WebAPI/Migrations/20221205190148_Initial.cs deleted file mode 100644 index d41f03a..0000000 --- a/WebAPI/Migrations/20221205190148_Initial.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: true), - UserName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Users"); - } - } -} diff --git a/WebAPI/Migrations/20221211210507_DataSetsAndDataRows.Designer.cs b/WebAPI/Migrations/20221211210507_DataSetsAndDataRows.Designer.cs deleted file mode 100644 index 1dc9778..0000000 --- a/WebAPI/Migrations/20221211210507_DataSetsAndDataRows.Designer.cs +++ /dev/null @@ -1,192 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20221211210507_DataSetsAndDataRows")] - partial class DataSetsAndDataRows - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("DataSetId") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("MPK") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("DataSetId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("DataRows"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.ToTable("DataSets"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.DataRow", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.DataSet", null) - .WithMany("DataRows") - .HasForeignKey("DataSetId"); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.Navigation("DataRows"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20221211210507_DataSetsAndDataRows.cs b/WebAPI/Migrations/20221211210507_DataSetsAndDataRows.cs deleted file mode 100644 index 8f00f30..0000000 --- a/WebAPI/Migrations/20221211210507_DataSetsAndDataRows.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class DataSetsAndDataRows : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "DataSets", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Number = table.Column(type: "nvarchar(max)", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false), - IsDeleted = table.Column(type: "bit", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - ModifiedById = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DataSets", x => x.Id); - table.ForeignKey( - name: "FK_DataSets_Users_CreatedById", - column: x => x.CreatedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_DataSets_Users_ModifiedById", - column: x => x.ModifiedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateTable( - name: "DataRows", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - MPK = table.Column(type: "nvarchar(max)", nullable: false), - Value = table.Column(type: "real", nullable: false), - Desc1 = table.Column(type: "nvarchar(max)", nullable: true), - Desc2 = table.Column(type: "nvarchar(max)", nullable: true), - Desc3 = table.Column(type: "nvarchar(max)", nullable: true), - Desc4 = table.Column(type: "nvarchar(max)", nullable: true), - Desc5 = table.Column(type: "nvarchar(max)", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false), - IsDeleted = table.Column(type: "bit", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - ModifiedById = table.Column(type: "uniqueidentifier", nullable: false), - DataSetId = table.Column(type: "uniqueidentifier", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DataRows", x => x.Id); - table.ForeignKey( - name: "FK_DataRows_DataSets_DataSetId", - column: x => x.DataSetId, - principalTable: "DataSets", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_DataRows_Users_CreatedById", - column: x => x.CreatedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_DataRows_Users_ModifiedById", - column: x => x.ModifiedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateIndex( - name: "IX_DataRows_CreatedById", - table: "DataRows", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_DataRows_DataSetId", - table: "DataRows", - column: "DataSetId"); - - migrationBuilder.CreateIndex( - name: "IX_DataRows_ModifiedById", - table: "DataRows", - column: "ModifiedById"); - - migrationBuilder.CreateIndex( - name: "IX_DataSets_CreatedById", - table: "DataSets", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_DataSets_ModifiedById", - table: "DataSets", - column: "ModifiedById"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "DataRows"); - - migrationBuilder.DropTable( - name: "DataSets"); - } - } -} diff --git a/WebAPI/Migrations/20221219163620_RenameFields.Designer.cs b/WebAPI/Migrations/20221219163620_RenameFields.Designer.cs deleted file mode 100644 index 2c9c541..0000000 --- a/WebAPI/Migrations/20221219163620_RenameFields.Designer.cs +++ /dev/null @@ -1,197 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20221219163620_RenameFields")] - partial class RenameFields - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("DataSetId") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("DataSetId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("DataRows"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .IsRequired() - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.ToTable("DataSets"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.DataRow", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.DataSet", null) - .WithMany("DataRows") - .HasForeignKey("DataSetId"); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.Navigation("DataRows"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20221219163620_RenameFields.cs b/WebAPI/Migrations/20221219163620_RenameFields.cs deleted file mode 100644 index 2237cad..0000000 --- a/WebAPI/Migrations/20221219163620_RenameFields.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class RenameFields : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "MPK", - table: "DataRows", - newName: "Code"); - - migrationBuilder.AlterColumn( - name: "Number", - table: "DataSets", - type: "int", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "DataSets", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "Source", - table: "DataSets", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Source", - table: "DataSets"); - - migrationBuilder.RenameColumn( - name: "Code", - table: "DataRows", - newName: "MPK"); - - migrationBuilder.AlterColumn( - name: "Number", - table: "DataSets", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "DataSets", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - } -} diff --git a/WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.Designer.cs b/WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.Designer.cs deleted file mode 100644 index 26c2285..0000000 --- a/WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.Designer.cs +++ /dev/null @@ -1,199 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20221221165749_DataSetIdOnDataRow")] - partial class DataSetIdOnDataRow - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("DataSetId") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("DataSetId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("DataRows"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .IsRequired() - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.ToTable("DataSets"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.DataRow", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.DataSet", null) - .WithMany("DataRows") - .HasForeignKey("DataSetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.DataSet", b => - { - b.Navigation("DataRows"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.cs b/WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.cs deleted file mode 100644 index 52e7042..0000000 --- a/WebAPI/Migrations/20221221165749_DataSetIdOnDataRow.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class DataSetIdOnDataRow : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_DataRows_DataSets_DataSetId", - table: "DataRows"); - - migrationBuilder.AlterColumn( - name: "DataSetId", - table: "DataRows", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_DataRows_DataSets_DataSetId", - table: "DataRows", - column: "DataSetId", - principalTable: "DataSets", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_DataRows_DataSets_DataSetId", - table: "DataRows"); - - migrationBuilder.AlterColumn( - name: "DataSetId", - table: "DataRows", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AddForeignKey( - name: "FK_DataRows_DataSets_DataSetId", - table: "DataRows", - column: "DataSetId", - principalTable: "DataSets", - principalColumn: "Id"); - } - } -} diff --git a/WebAPI/Migrations/20230106095427_RenameModels.Designer.cs b/WebAPI/Migrations/20230106095427_RenameModels.Designer.cs deleted file mode 100644 index 504b9a5..0000000 --- a/WebAPI/Migrations/20230106095427_RenameModels.Designer.cs +++ /dev/null @@ -1,199 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230106095427_RenameModels")] - partial class RenameModels - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .IsRequired() - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20230106095427_RenameModels.cs b/WebAPI/Migrations/20230106095427_RenameModels.cs deleted file mode 100644 index ce76c86..0000000 --- a/WebAPI/Migrations/20230106095427_RenameModels.cs +++ /dev/null @@ -1,227 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class RenameModels : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "DataRows"); - - migrationBuilder.DropTable( - name: "DataSets"); - - migrationBuilder.CreateTable( - name: "Layers", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Number = table.Column(type: "int", nullable: false), - Source = table.Column(type: "nvarchar(max)", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false), - IsDeleted = table.Column(type: "bit", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - ModifiedById = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Layers", x => x.Id); - table.ForeignKey( - name: "FK_Layers_Users_CreatedById", - column: x => x.CreatedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_Layers_Users_ModifiedById", - column: x => x.ModifiedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateTable( - name: "Records", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Code = table.Column(type: "nvarchar(max)", nullable: false), - Value = table.Column(type: "real", nullable: false), - Desc1 = table.Column(type: "nvarchar(max)", nullable: true), - Desc2 = table.Column(type: "nvarchar(max)", nullable: true), - Desc3 = table.Column(type: "nvarchar(max)", nullable: true), - Desc4 = table.Column(type: "nvarchar(max)", nullable: true), - Desc5 = table.Column(type: "nvarchar(max)", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false), - IsDeleted = table.Column(type: "bit", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - ModifiedById = table.Column(type: "uniqueidentifier", nullable: false), - LayerId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Records", x => x.Id); - table.ForeignKey( - name: "FK_Records_Layers_LayerId", - column: x => x.LayerId, - principalTable: "Layers", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_Records_Users_CreatedById", - column: x => x.CreatedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_Records_Users_ModifiedById", - column: x => x.ModifiedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateIndex( - name: "IX_Layers_CreatedById", - table: "Layers", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_Layers_ModifiedById", - table: "Layers", - column: "ModifiedById"); - - migrationBuilder.CreateIndex( - name: "IX_Records_CreatedById", - table: "Records", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_Records_LayerId", - table: "Records", - column: "LayerId"); - - migrationBuilder.CreateIndex( - name: "IX_Records_ModifiedById", - table: "Records", - column: "ModifiedById"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Records"); - - migrationBuilder.DropTable( - name: "Layers"); - - migrationBuilder.CreateTable( - name: "DataSets", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - ModifiedById = table.Column(type: "uniqueidentifier", nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false), - IsDeleted = table.Column(type: "bit", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - Number = table.Column(type: "int", nullable: false), - Source = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DataSets", x => x.Id); - table.ForeignKey( - name: "FK_DataSets_Users_CreatedById", - column: x => x.CreatedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_DataSets_Users_ModifiedById", - column: x => x.ModifiedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateTable( - name: "DataRows", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - ModifiedById = table.Column(type: "uniqueidentifier", nullable: false), - Code = table.Column(type: "nvarchar(max)", nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false), - DataSetId = table.Column(type: "uniqueidentifier", nullable: false), - Desc1 = table.Column(type: "nvarchar(max)", nullable: true), - Desc2 = table.Column(type: "nvarchar(max)", nullable: true), - Desc3 = table.Column(type: "nvarchar(max)", nullable: true), - Desc4 = table.Column(type: "nvarchar(max)", nullable: true), - Desc5 = table.Column(type: "nvarchar(max)", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false), - Value = table.Column(type: "real", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DataRows", x => x.Id); - table.ForeignKey( - name: "FK_DataRows_DataSets_DataSetId", - column: x => x.DataSetId, - principalTable: "DataSets", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_DataRows_Users_CreatedById", - column: x => x.CreatedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK_DataRows_Users_ModifiedById", - column: x => x.ModifiedById, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateIndex( - name: "IX_DataRows_CreatedById", - table: "DataRows", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_DataRows_DataSetId", - table: "DataRows", - column: "DataSetId"); - - migrationBuilder.CreateIndex( - name: "IX_DataRows_ModifiedById", - table: "DataRows", - column: "ModifiedById"); - - migrationBuilder.CreateIndex( - name: "IX_DataSets_CreatedById", - table: "DataSets", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_DataSets_ModifiedById", - table: "DataSets", - column: "ModifiedById"); - } - } -} diff --git a/WebAPI/Migrations/20230626171614_LayerType.Designer.cs b/WebAPI/Migrations/20230626171614_LayerType.Designer.cs deleted file mode 100644 index a323da0..0000000 --- a/WebAPI/Migrations/20230626171614_LayerType.Designer.cs +++ /dev/null @@ -1,201 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230626171614_LayerType")] - partial class LayerType - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20230626171614_LayerType.cs b/WebAPI/Migrations/20230626171614_LayerType.cs deleted file mode 100644 index fb0d12f..0000000 --- a/WebAPI/Migrations/20230626171614_LayerType.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class LayerType : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Type", - table: "Layers", - type: "int", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Type", - table: "Layers"); - } - } -} diff --git a/WebAPI/Migrations/20230821105757_Record.Values.Designer.cs b/WebAPI/Migrations/20230821105757_Record.Values.Designer.cs deleted file mode 100644 index 59e2b94..0000000 --- a/WebAPI/Migrations/20230821105757_Record.Values.Designer.cs +++ /dev/null @@ -1,291 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230821105757_Record.Values")] - partial class RecordValues - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("real"); - - b.Property("Value10") - .HasColumnType("real"); - - b.Property("Value11") - .HasColumnType("real"); - - b.Property("Value12") - .HasColumnType("real"); - - b.Property("Value13") - .HasColumnType("real"); - - b.Property("Value14") - .HasColumnType("real"); - - b.Property("Value15") - .HasColumnType("real"); - - b.Property("Value16") - .HasColumnType("real"); - - b.Property("Value17") - .HasColumnType("real"); - - b.Property("Value18") - .HasColumnType("real"); - - b.Property("Value19") - .HasColumnType("real"); - - b.Property("Value2") - .HasColumnType("real"); - - b.Property("Value20") - .HasColumnType("real"); - - b.Property("Value21") - .HasColumnType("real"); - - b.Property("Value22") - .HasColumnType("real"); - - b.Property("Value23") - .HasColumnType("real"); - - b.Property("Value24") - .HasColumnType("real"); - - b.Property("Value25") - .HasColumnType("real"); - - b.Property("Value26") - .HasColumnType("real"); - - b.Property("Value27") - .HasColumnType("real"); - - b.Property("Value28") - .HasColumnType("real"); - - b.Property("Value29") - .HasColumnType("real"); - - b.Property("Value3") - .HasColumnType("real"); - - b.Property("Value30") - .HasColumnType("real"); - - b.Property("Value31") - .HasColumnType("real"); - - b.Property("Value4") - .HasColumnType("real"); - - b.Property("Value5") - .HasColumnType("real"); - - b.Property("Value6") - .HasColumnType("real"); - - b.Property("Value7") - .HasColumnType("real"); - - b.Property("Value8") - .HasColumnType("real"); - - b.Property("Value9") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20230821105757_Record.Values.cs b/WebAPI/Migrations/20230821105757_Record.Values.cs deleted file mode 100644 index e204e57..0000000 --- a/WebAPI/Migrations/20230821105757_Record.Values.cs +++ /dev/null @@ -1,339 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class RecordValues : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Value", - table: "Records"); - - migrationBuilder.AddColumn( - name: "Value1", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value10", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value11", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value12", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value13", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value14", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value15", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value16", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value17", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value18", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value19", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value2", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value20", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value21", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value22", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value23", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value24", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value25", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value26", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value27", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value28", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value29", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value3", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value30", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value31", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value4", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value5", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value6", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value7", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value8", - table: "Records", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "Value9", - table: "Records", - type: "real", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Value1", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value10", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value11", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value12", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value13", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value14", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value15", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value16", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value17", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value18", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value19", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value2", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value20", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value21", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value22", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value23", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value24", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value25", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value26", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value27", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value28", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value29", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value3", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value30", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value31", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value4", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value5", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value6", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value7", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value8", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Value9", - table: "Records"); - - migrationBuilder.AddColumn( - name: "Value", - table: "Records", - type: "real", - nullable: false, - defaultValue: 0f); - } - } -} diff --git a/WebAPI/Migrations/20230917110252_Layer.parent.Designer.cs b/WebAPI/Migrations/20230917110252_Layer.parent.Designer.cs deleted file mode 100644 index 6f37a40..0000000 --- a/WebAPI/Migrations/20230917110252_Layer.parent.Designer.cs +++ /dev/null @@ -1,302 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230917110252_Layer.parent")] - partial class Layerparent - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("parentId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("parentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("real"); - - b.Property("Value10") - .HasColumnType("real"); - - b.Property("Value11") - .HasColumnType("real"); - - b.Property("Value12") - .HasColumnType("real"); - - b.Property("Value13") - .HasColumnType("real"); - - b.Property("Value14") - .HasColumnType("real"); - - b.Property("Value15") - .HasColumnType("real"); - - b.Property("Value16") - .HasColumnType("real"); - - b.Property("Value17") - .HasColumnType("real"); - - b.Property("Value18") - .HasColumnType("real"); - - b.Property("Value19") - .HasColumnType("real"); - - b.Property("Value2") - .HasColumnType("real"); - - b.Property("Value20") - .HasColumnType("real"); - - b.Property("Value21") - .HasColumnType("real"); - - b.Property("Value22") - .HasColumnType("real"); - - b.Property("Value23") - .HasColumnType("real"); - - b.Property("Value24") - .HasColumnType("real"); - - b.Property("Value25") - .HasColumnType("real"); - - b.Property("Value26") - .HasColumnType("real"); - - b.Property("Value27") - .HasColumnType("real"); - - b.Property("Value28") - .HasColumnType("real"); - - b.Property("Value29") - .HasColumnType("real"); - - b.Property("Value3") - .HasColumnType("real"); - - b.Property("Value30") - .HasColumnType("real"); - - b.Property("Value31") - .HasColumnType("real"); - - b.Property("Value4") - .HasColumnType("real"); - - b.Property("Value5") - .HasColumnType("real"); - - b.Property("Value6") - .HasColumnType("real"); - - b.Property("Value7") - .HasColumnType("real"); - - b.Property("Value8") - .HasColumnType("real"); - - b.Property("Value9") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "parent") - .WithMany() - .HasForeignKey("parentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("parent"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20230917110252_Layer.parent.cs b/WebAPI/Migrations/20230917110252_Layer.parent.cs deleted file mode 100644 index f3a9003..0000000 --- a/WebAPI/Migrations/20230917110252_Layer.parent.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class Layerparent : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "parentId", - table: "Layers", - type: "uniqueidentifier", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Layers_parentId", - table: "Layers", - column: "parentId"); - - migrationBuilder.AddForeignKey( - name: "FK_Layers_Layers_parentId", - table: "Layers", - column: "parentId", - principalTable: "Layers", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Layers_Layers_parentId", - table: "Layers"); - - migrationBuilder.DropIndex( - name: "IX_Layers_parentId", - table: "Layers"); - - migrationBuilder.DropColumn( - name: "parentId", - table: "Layers"); - } - } -} diff --git a/WebAPI/Migrations/20230918090621_ProcessSource.Designer.cs b/WebAPI/Migrations/20230918090621_ProcessSource.Designer.cs deleted file mode 100644 index 0d79921..0000000 --- a/WebAPI/Migrations/20230918090621_ProcessSource.Designer.cs +++ /dev/null @@ -1,330 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230918090621_ProcessSource")] - partial class ProcessSource - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("parentId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("parentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("real"); - - b.Property("Value10") - .HasColumnType("real"); - - b.Property("Value11") - .HasColumnType("real"); - - b.Property("Value12") - .HasColumnType("real"); - - b.Property("Value13") - .HasColumnType("real"); - - b.Property("Value14") - .HasColumnType("real"); - - b.Property("Value15") - .HasColumnType("real"); - - b.Property("Value16") - .HasColumnType("real"); - - b.Property("Value17") - .HasColumnType("real"); - - b.Property("Value18") - .HasColumnType("real"); - - b.Property("Value19") - .HasColumnType("real"); - - b.Property("Value2") - .HasColumnType("real"); - - b.Property("Value20") - .HasColumnType("real"); - - b.Property("Value21") - .HasColumnType("real"); - - b.Property("Value22") - .HasColumnType("real"); - - b.Property("Value23") - .HasColumnType("real"); - - b.Property("Value24") - .HasColumnType("real"); - - b.Property("Value25") - .HasColumnType("real"); - - b.Property("Value26") - .HasColumnType("real"); - - b.Property("Value27") - .HasColumnType("real"); - - b.Property("Value28") - .HasColumnType("real"); - - b.Property("Value29") - .HasColumnType("real"); - - b.Property("Value3") - .HasColumnType("real"); - - b.Property("Value30") - .HasColumnType("real"); - - b.Property("Value31") - .HasColumnType("real"); - - b.Property("Value4") - .HasColumnType("real"); - - b.Property("Value5") - .HasColumnType("real"); - - b.Property("Value6") - .HasColumnType("real"); - - b.Property("Value7") - .HasColumnType("real"); - - b.Property("Value8") - .HasColumnType("real"); - - b.Property("Value9") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "parent") - .WithMany() - .HasForeignKey("parentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany("Sources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - - b.Navigation("Sources"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20230918090621_ProcessSource.cs b/WebAPI/Migrations/20230918090621_ProcessSource.cs deleted file mode 100644 index 60cb778..0000000 --- a/WebAPI/Migrations/20230918090621_ProcessSource.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class ProcessSource : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ProcessSources", - columns: table => new - { - LayerId = table.Column(type: "uniqueidentifier", nullable: false), - SourceId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProcessSources", x => new { x.LayerId, x.SourceId }); - table.ForeignKey( - name: "FK_ProcessSources_Layers_SourceId", - column: x => x.SourceId, - principalTable: "Layers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ProcessSources_SourceId", - table: "ProcessSources", - column: "SourceId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ProcessSources"); - } - } -} diff --git a/WebAPI/Migrations/20230918093055_TypeO.Designer.cs b/WebAPI/Migrations/20230918093055_TypeO.Designer.cs deleted file mode 100644 index 38b0d51..0000000 --- a/WebAPI/Migrations/20230918093055_TypeO.Designer.cs +++ /dev/null @@ -1,330 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230918093055_TypeO")] - partial class TypeO - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("real"); - - b.Property("Value10") - .HasColumnType("real"); - - b.Property("Value11") - .HasColumnType("real"); - - b.Property("Value12") - .HasColumnType("real"); - - b.Property("Value13") - .HasColumnType("real"); - - b.Property("Value14") - .HasColumnType("real"); - - b.Property("Value15") - .HasColumnType("real"); - - b.Property("Value16") - .HasColumnType("real"); - - b.Property("Value17") - .HasColumnType("real"); - - b.Property("Value18") - .HasColumnType("real"); - - b.Property("Value19") - .HasColumnType("real"); - - b.Property("Value2") - .HasColumnType("real"); - - b.Property("Value20") - .HasColumnType("real"); - - b.Property("Value21") - .HasColumnType("real"); - - b.Property("Value22") - .HasColumnType("real"); - - b.Property("Value23") - .HasColumnType("real"); - - b.Property("Value24") - .HasColumnType("real"); - - b.Property("Value25") - .HasColumnType("real"); - - b.Property("Value26") - .HasColumnType("real"); - - b.Property("Value27") - .HasColumnType("real"); - - b.Property("Value28") - .HasColumnType("real"); - - b.Property("Value29") - .HasColumnType("real"); - - b.Property("Value3") - .HasColumnType("real"); - - b.Property("Value30") - .HasColumnType("real"); - - b.Property("Value31") - .HasColumnType("real"); - - b.Property("Value4") - .HasColumnType("real"); - - b.Property("Value5") - .HasColumnType("real"); - - b.Property("Value6") - .HasColumnType("real"); - - b.Property("Value7") - .HasColumnType("real"); - - b.Property("Value8") - .HasColumnType("real"); - - b.Property("Value9") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany("Sources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - - b.Navigation("Sources"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20230918093055_TypeO.cs b/WebAPI/Migrations/20230918093055_TypeO.cs deleted file mode 100644 index 50fdc6a..0000000 --- a/WebAPI/Migrations/20230918093055_TypeO.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class TypeO : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Layers_Layers_parentId", - table: "Layers"); - - migrationBuilder.RenameColumn( - name: "parentId", - table: "Layers", - newName: "ParentId"); - - migrationBuilder.RenameIndex( - name: "IX_Layers_parentId", - table: "Layers", - newName: "IX_Layers_ParentId"); - - migrationBuilder.AddForeignKey( - name: "FK_Layers_Layers_ParentId", - table: "Layers", - column: "ParentId", - principalTable: "Layers", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Layers_Layers_ParentId", - table: "Layers"); - - migrationBuilder.RenameColumn( - name: "ParentId", - table: "Layers", - newName: "parentId"); - - migrationBuilder.RenameIndex( - name: "IX_Layers_ParentId", - table: "Layers", - newName: "IX_Layers_parentId"); - - migrationBuilder.AddForeignKey( - name: "FK_Layers_Layers_parentId", - table: "Layers", - column: "parentId", - principalTable: "Layers", - principalColumn: "Id"); - } - } -} diff --git a/WebAPI/Migrations/20231030142419_Record.Value32.Designer.cs b/WebAPI/Migrations/20231030142419_Record.Value32.Designer.cs deleted file mode 100644 index 00300e1..0000000 --- a/WebAPI/Migrations/20231030142419_Record.Value32.Designer.cs +++ /dev/null @@ -1,333 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20231030142419_Record.Value32")] - partial class RecordValue32 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.12") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("real"); - - b.Property("Value10") - .HasColumnType("real"); - - b.Property("Value11") - .HasColumnType("real"); - - b.Property("Value12") - .HasColumnType("real"); - - b.Property("Value13") - .HasColumnType("real"); - - b.Property("Value14") - .HasColumnType("real"); - - b.Property("Value15") - .HasColumnType("real"); - - b.Property("Value16") - .HasColumnType("real"); - - b.Property("Value17") - .HasColumnType("real"); - - b.Property("Value18") - .HasColumnType("real"); - - b.Property("Value19") - .HasColumnType("real"); - - b.Property("Value2") - .HasColumnType("real"); - - b.Property("Value20") - .HasColumnType("real"); - - b.Property("Value21") - .HasColumnType("real"); - - b.Property("Value22") - .HasColumnType("real"); - - b.Property("Value23") - .HasColumnType("real"); - - b.Property("Value24") - .HasColumnType("real"); - - b.Property("Value25") - .HasColumnType("real"); - - b.Property("Value26") - .HasColumnType("real"); - - b.Property("Value27") - .HasColumnType("real"); - - b.Property("Value28") - .HasColumnType("real"); - - b.Property("Value29") - .HasColumnType("real"); - - b.Property("Value3") - .HasColumnType("real"); - - b.Property("Value30") - .HasColumnType("real"); - - b.Property("Value31") - .HasColumnType("real"); - - b.Property("Value32") - .HasColumnType("real"); - - b.Property("Value4") - .HasColumnType("real"); - - b.Property("Value5") - .HasColumnType("real"); - - b.Property("Value6") - .HasColumnType("real"); - - b.Property("Value7") - .HasColumnType("real"); - - b.Property("Value8") - .HasColumnType("real"); - - b.Property("Value9") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany("Sources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - - b.Navigation("Sources"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20231030142419_Record.Value32.cs b/WebAPI/Migrations/20231030142419_Record.Value32.cs deleted file mode 100644 index c174726..0000000 --- a/WebAPI/Migrations/20231030142419_Record.Value32.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class RecordValue32 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Value32", - table: "Records", - type: "real", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Value32", - table: "Records"); - } - } -} diff --git a/WebAPI/Migrations/20240309075645_Change record value type.Designer.cs b/WebAPI/Migrations/20240309075645_Change record value type.Designer.cs deleted file mode 100644 index bdd3d56..0000000 --- a/WebAPI/Migrations/20240309075645_Change record value type.Designer.cs +++ /dev/null @@ -1,333 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240309075645_Change record value type")] - partial class Changerecordvaluetype - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.13") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc2") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc3") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc4") - .HasColumnType("nvarchar(max)"); - - b.Property("Desc5") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany("Sources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - - b.Navigation("Sources"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20240309075645_Change record value type.cs b/WebAPI/Migrations/20240309075645_Change record value type.cs deleted file mode 100644 index 668feee..0000000 --- a/WebAPI/Migrations/20240309075645_Change record value type.cs +++ /dev/null @@ -1,594 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class Changerecordvaluetype : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Value9", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value8", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value7", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value6", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value5", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value4", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value32", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value31", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value30", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value3", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value29", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value28", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value27", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value26", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value25", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value24", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value23", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value22", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value21", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value20", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value2", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value19", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value18", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value17", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value16", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value15", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value14", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value13", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value12", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value11", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value10", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value1", - table: "Records", - type: "float", - nullable: true, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Value9", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value8", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value7", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value6", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value5", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value4", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value32", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value31", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value30", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value3", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value29", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value28", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value27", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value26", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value25", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value24", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value23", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value22", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value21", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value20", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value2", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value19", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value18", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value17", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value16", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value15", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value14", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value13", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value12", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value11", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value10", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Value1", - table: "Records", - type: "real", - nullable: true, - oldClrType: typeof(double), - oldType: "float", - oldNullable: true); - } - } -} diff --git a/WebAPI/Migrations/20240703171630_AfterCodeRefactor.Designer.cs b/WebAPI/Migrations/20240703171630_AfterCodeRefactor.Designer.cs deleted file mode 100644 index 0807004..0000000 --- a/WebAPI/Migrations/20240703171630_AfterCodeRefactor.Designer.cs +++ /dev/null @@ -1,319 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240703171630_AfterCodeRefactor")] - partial class AfterCodeRefactor - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20240703171630_AfterCodeRefactor.cs b/WebAPI/Migrations/20240703171630_AfterCodeRefactor.cs deleted file mode 100644 index a178ca4..0000000 --- a/WebAPI/Migrations/20240703171630_AfterCodeRefactor.cs +++ /dev/null @@ -1,135 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class AfterCodeRefactor : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Desc2", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Desc3", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Desc4", - table: "Records"); - - migrationBuilder.DropColumn( - name: "Desc5", - table: "Records"); - - migrationBuilder.AlterColumn( - name: "Email", - table: "Users", - type: "nvarchar(50)", - maxLength: 50, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Desc1", - table: "Records", - type: "nvarchar(1000)", - maxLength: 1000, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Code", - table: "Records", - type: "nvarchar(50)", - maxLength: 50, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Layers", - type: "nvarchar(50)", - maxLength: 50, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Email", - table: "Users", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(50)", - oldMaxLength: 50, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Desc1", - table: "Records", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(1000)", - oldMaxLength: 1000, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Code", - table: "Records", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(50)", - oldMaxLength: 50); - - migrationBuilder.AddColumn( - name: "Desc2", - table: "Records", - type: "nvarchar(max)", - nullable: true); - - migrationBuilder.AddColumn( - name: "Desc3", - table: "Records", - type: "nvarchar(max)", - nullable: true); - - migrationBuilder.AddColumn( - name: "Desc4", - table: "Records", - type: "nvarchar(max)", - nullable: true); - - migrationBuilder.AddColumn( - name: "Desc5", - table: "Records", - type: "nvarchar(max)", - nullable: true); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Layers", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(50)", - oldMaxLength: 50); - - } - } -} diff --git a/WebAPI/Migrations/20240703173337_DataInboxModel.Designer.cs b/WebAPI/Migrations/20240703173337_DataInboxModel.Designer.cs deleted file mode 100644 index 1876079..0000000 --- a/WebAPI/Migrations/20240703173337_DataInboxModel.Designer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240703173337_DataInboxModel")] - partial class DataInboxModel - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataInbox", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(2147483647) - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("DataInbox"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20240703173337_DataInboxModel.cs b/WebAPI/Migrations/20240703173337_DataInboxModel.cs deleted file mode 100644 index d5fc542..0000000 --- a/WebAPI/Migrations/20240703173337_DataInboxModel.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class DataInboxModel : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "DataInbox", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Source = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Data = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DataInbox", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "DataInbox"); - } - } -} diff --git a/WebAPI/Migrations/20240825144443_QueueJobs.Designer.cs b/WebAPI/Migrations/20240825144443_QueueJobs.Designer.cs deleted file mode 100644 index e1d0bd3..0000000 --- a/WebAPI/Migrations/20240825144443_QueueJobs.Designer.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240825144443_QueueJobs")] - partial class QueueJobs - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataInbox", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(2147483647) - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("DataInbox"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.QueueJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Attempts") - .HasColumnType("int"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("Message") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("QueueJobs"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20240825144443_QueueJobs.cs b/WebAPI/Migrations/20240825144443_QueueJobs.cs deleted file mode 100644 index 267a4e4..0000000 --- a/WebAPI/Migrations/20240825144443_QueueJobs.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class QueueJobs : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "QueueJobs", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - LayerId = table.Column(type: "uniqueidentifier", nullable: false), - Attempts = table.Column(type: "int", nullable: false), - Status = table.Column(type: "int", nullable: false), - Type = table.Column(type: "int", nullable: false), - Message = table.Column(type: "nvarchar(max)", nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false), - ModifiedAt = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_QueueJobs", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "QueueJobs"); - } - } -} diff --git a/WebAPI/Migrations/20250317114722_LongerDesc1.Designer.cs b/WebAPI/Migrations/20250317114722_LongerDesc1.Designer.cs deleted file mode 100644 index 8ae8c16..0000000 --- a/WebAPI/Migrations/20250317114722_LongerDesc1.Designer.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250317114722_LongerDesc1")] - partial class LongerDesc1 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataInbox", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(2147483647) - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("DataInbox"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.QueueJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Attempts") - .HasColumnType("int"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("Message") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("QueueJobs"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasMaxLength(10000) - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20250317114722_LongerDesc1.cs b/WebAPI/Migrations/20250317114722_LongerDesc1.cs deleted file mode 100644 index bc52964..0000000 --- a/WebAPI/Migrations/20250317114722_LongerDesc1.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class LongerDesc1 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Desc1", - table: "Records", - type: "nvarchar(max)", - maxLength: 10000, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(1000)", - oldMaxLength: 1000, - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Desc1", - table: "Records", - type: "nvarchar(1000)", - maxLength: 1000, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldMaxLength: 10000, - oldNullable: true); - } - } -} diff --git a/WebAPI/Migrations/20250529093632_LayersIsCancelled.Designer.cs b/WebAPI/Migrations/20250529093632_LayersIsCancelled.Designer.cs deleted file mode 100644 index 1958056..0000000 --- a/WebAPI/Migrations/20250529093632_LayersIsCancelled.Designer.cs +++ /dev/null @@ -1,384 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250529093632_LayersIsCancelled")] - partial class LayersIsCancelled - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataInbox", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(2147483647) - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("DataInbox"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsCancelled") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.QueueJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Attempts") - .HasColumnType("int"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("Message") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("QueueJobs"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasMaxLength(10000) - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Migrations/20250529093632_LayersIsCancelled.cs b/WebAPI/Migrations/20250529093632_LayersIsCancelled.cs deleted file mode 100644 index bd0ceaa..0000000 --- a/WebAPI/Migrations/20250529093632_LayersIsCancelled.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace WebAPI.Migrations -{ - /// - public partial class LayersIsCancelled : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IsCancelled", - table: "Layers", - type: "bit", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IsCancelled", - table: "Layers"); - } - } -} diff --git a/WebAPI/Migrations/AppDbContextModelSnapshot.cs b/WebAPI/Migrations/AppDbContextModelSnapshot.cs deleted file mode 100644 index f9691c9..0000000 --- a/WebAPI/Migrations/AppDbContextModelSnapshot.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using WebAPI; - -#nullable disable - -namespace WebAPI.Migrations -{ - [DbContext(typeof(AppDbContext))] - partial class AppDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("WebAPI.Models.DataInbox", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(2147483647) - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("DataInbox"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsCancelled") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Number") - .HasColumnType("int"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ModifiedById"); - - b.HasIndex("ParentId"); - - b.ToTable("Layers"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("SourceId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LayerId", "SourceId"); - - b.HasIndex("SourceId"); - - b.ToTable("ProcessSources"); - }); - - modelBuilder.Entity("WebAPI.Models.QueueJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Attempts") - .HasColumnType("int"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("Message") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("QueueJobs"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Desc1") - .HasMaxLength(10000) - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("LayerId") - .HasColumnType("uniqueidentifier"); - - b.Property("ModifiedAt") - .HasColumnType("datetime2"); - - b.Property("ModifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Value1") - .HasColumnType("float"); - - b.Property("Value10") - .HasColumnType("float"); - - b.Property("Value11") - .HasColumnType("float"); - - b.Property("Value12") - .HasColumnType("float"); - - b.Property("Value13") - .HasColumnType("float"); - - b.Property("Value14") - .HasColumnType("float"); - - b.Property("Value15") - .HasColumnType("float"); - - b.Property("Value16") - .HasColumnType("float"); - - b.Property("Value17") - .HasColumnType("float"); - - b.Property("Value18") - .HasColumnType("float"); - - b.Property("Value19") - .HasColumnType("float"); - - b.Property("Value2") - .HasColumnType("float"); - - b.Property("Value20") - .HasColumnType("float"); - - b.Property("Value21") - .HasColumnType("float"); - - b.Property("Value22") - .HasColumnType("float"); - - b.Property("Value23") - .HasColumnType("float"); - - b.Property("Value24") - .HasColumnType("float"); - - b.Property("Value25") - .HasColumnType("float"); - - b.Property("Value26") - .HasColumnType("float"); - - b.Property("Value27") - .HasColumnType("float"); - - b.Property("Value28") - .HasColumnType("float"); - - b.Property("Value29") - .HasColumnType("float"); - - b.Property("Value3") - .HasColumnType("float"); - - b.Property("Value30") - .HasColumnType("float"); - - b.Property("Value31") - .HasColumnType("float"); - - b.Property("Value32") - .HasColumnType("float"); - - b.Property("Value4") - .HasColumnType("float"); - - b.Property("Value5") - .HasColumnType("float"); - - b.Property("Value6") - .HasColumnType("float"); - - b.Property("Value7") - .HasColumnType("float"); - - b.Property("Value8") - .HasColumnType("float"); - - b.Property("Value9") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LayerId"); - - b.HasIndex("ModifiedById"); - - b.ToTable("Records"); - }); - - modelBuilder.Entity("WebAPI.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", "Parent") - .WithMany() - .HasForeignKey("ParentId"); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("WebAPI.Models.ProcessSource", b => - { - b.HasOne("WebAPI.Models.Layer", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("WebAPI.Models.Record", b => - { - b.HasOne("WebAPI.Models.User", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.Layer", null) - .WithMany("Records") - .HasForeignKey("LayerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("WebAPI.Models.User", "ModifiedBy") - .WithMany() - .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("ModifiedBy"); - }); - - modelBuilder.Entity("WebAPI.Models.Layer", b => - { - b.Navigation("Records"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/WebAPI/Models/DataInbox.cs b/WebAPI/Models/DataInbox.cs deleted file mode 100644 index bce62e0..0000000 --- a/WebAPI/Models/DataInbox.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace WebAPI.Models; - -public class DataInbox -{ - #region Properties - [Key] - public Guid Id { get; set; } - [StringLength(50)] - public required string Name { get; init; } - [StringLength(50)] - public required string Source { get; set; } - [StringLength(int.MaxValue)] - public required string Data { get; init; } - public DateTime CreatedAt { get; set; } - #endregion -} \ No newline at end of file diff --git a/WebAPI/Models/Layer.cs b/WebAPI/Models/Layer.cs deleted file mode 100644 index 0cfd9ba..0000000 --- a/WebAPI/Models/Layer.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace WebAPI.Models; - -public enum LayerType -{ - Import, - Processed, - Administration, - Dictionary, -} -public class Layer -{ - #region Properties - [Key] - public Guid Id { get; init; } - [Required] - public int Number { get; init; } - [Required] - [MaxLength(50)] - public string? Name { get; set; } - [Required] - public LayerType Type { get; init; } - [Required] - public DateTime CreatedAt { get; set; } - [Required] - public DateTime ModifiedAt { get; set; } - [Required] - public bool IsDeleted { get; init; } = false; - [Required] - public bool IsCancelled { get; init; } = false; - #endregion - #region Relations - public ICollection? Records { get; init; } - [Required] - public Guid CreatedById { get; set; } - public User? CreatedBy { get; init; } - [Required] - public Guid ModifiedById { get; set; } - public User? ModifiedBy { get; init; } - public Guid? ParentId { get; init; } - public Layer? Parent { get; init; } - #endregion -} \ No newline at end of file diff --git a/WebAPI/Models/LogEntry.cs b/WebAPI/Models/LogEntry.cs deleted file mode 100644 index 6d32e77..0000000 --- a/WebAPI/Models/LogEntry.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Google.Cloud.Firestore; - -namespace WebAPI.Models; - -public enum LogEntryType -{ - Info, - Warning, - Error -} -public enum LogType -{ - Import, - Backup, - Process, - PowerBi, - DataInbox, - Queue -} - -public enum LogInstance -{ - Morska -} -public class LogEntry -{ - public LogType LogType { get; init; } - public LogEntryType Type { get; init; } - public string? Message { get; init; } - public string? Title { get; init; } - public DateTime CreatedAt { get; init; } - public Guid SessionId { get; set; } - public LogInstance Instance { get; set; } -} \ No newline at end of file diff --git a/WebAPI/Models/ProcessSource.cs b/WebAPI/Models/ProcessSource.cs deleted file mode 100644 index bbea268..0000000 --- a/WebAPI/Models/ProcessSource.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace WebAPI.Models; - -public class ProcessSource -{ - #region Relations - [Required] - public Guid LayerId { get; init; } - [Required] - public Guid SourceId { get; init; } - public Layer? Source { get; init; } - #endregion -} \ No newline at end of file diff --git a/WebAPI/Models/QueueJob.cs b/WebAPI/Models/QueueJob.cs deleted file mode 100644 index c122827..0000000 --- a/WebAPI/Models/QueueJob.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Security.Cryptography.X509Certificates; - -namespace WebAPI.Models; - -public enum JobStatus -{ - New, - Failed, - Success -} - -public enum JobType -{ - ImportWorker, - ProcessWorker -} - -public class QueueJob -{ - [Key] public Guid Id { get; set; } - [Required] public Guid LayerId { get; set; } - [Required] public int Attempts { get; set; } - [Required] public JobStatus Status { get; set; } = JobStatus.New; - [Required] public JobType Type { get; set; } = JobType.ImportWorker; - public string Message { get; set; } = string.Empty; - [Required] public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - [Required] public DateTime ModifiedAt { get; set; } = DateTime.UtcNow; -} \ No newline at end of file diff --git a/WebAPI/Models/Record.cs b/WebAPI/Models/Record.cs deleted file mode 100644 index 1c5b8c3..0000000 --- a/WebAPI/Models/Record.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace WebAPI.Models; - -public class Record -{ - #region Properties - [Key] - public Guid Id { get; set; } - [Required] - [StringLength(50)] - public string? Code { get; init; } - public double? Value1 { get; set; } - public double? Value2 { get; set; } - public double? Value3 { get; set; } - public double? Value4 { get; set; } - public double? Value5 { get; set; } - public double? Value6 { get; set; } - public double? Value7 { get; set; } - public double? Value8 { get; set; } - public double? Value9 { get; set; } - public double? Value10 { get; set; } - public double? Value11 { get; set; } - public double? Value12 { get; set; } - public double? Value13 { get; set; } - public double? Value14 { get; set; } - public double? Value15 { get; set; } - public double? Value16 { get; set; } - public double? Value17 { get; set; } - public double? Value18 { get; set; } - public double? Value19 { get; set; } - public double? Value20 { get; set; } - public double? Value21 { get; set; } - public double? Value22 { get; set; } - public double? Value23 { get; set; } - public double? Value24 { get; set; } - public double? Value25 { get; set; } - public double? Value26 { get; set; } - public double? Value27 { get; set; } - public double? Value28 { get; set; } - public double? Value29 { get; set; } - public double? Value30 { get; set; } - public double? Value31 { get; set; } - public double? Value32 { get; set; } - //Description fields - [StringLength(10000)] - public string? Desc1 { get; init; } - public DateTime CreatedAt { get; set; } - public DateTime ModifiedAt { get; set; } - public bool IsDeleted { get; init; } - #endregion - #region Relations - [Required] - public Guid CreatedById { get; set; } - public User? CreatedBy { get; init; } - [Required] - public Guid ModifiedById { get; set; } - public User? ModifiedBy { get; init; } - public Guid LayerId { get; set; } - #endregion -} \ No newline at end of file diff --git a/WebAPI/Models/User.cs b/WebAPI/Models/User.cs deleted file mode 100644 index fc795d7..0000000 --- a/WebAPI/Models/User.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace WebAPI.Models; - -public class User -{ - #region Properties - [Key] - public Guid Id { get; init; } - [StringLength(50)] - public string? Email { get; init; } - [StringLength(50)] - public string? UserName { get; init; } - public DateTime CreatedAt { get; init; } - #endregion -} \ No newline at end of file diff --git a/WebAPI/Program.cs b/WebAPI/Program.cs deleted file mode 100644 index 8e81a49..0000000 --- a/WebAPI/Program.cs +++ /dev/null @@ -1,98 +0,0 @@ -using FirebaseAdmin; -using Google.Apis.Auth.OAuth2; -using Google.Cloud.Firestore; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.EntityFrameworkCore; -using Microsoft.IdentityModel.Tokens; -using System.IdentityModel.Tokens.Jwt; -using System.Text; -using WebAPI; - -var builder = WebApplication.CreateBuilder(args); - -var connectionString = builder.Configuration.GetConnectionString("SQLDatabase"); -builder.Services.AddDbContext(x => -{ - x.UseSqlServer(connectionString); - x.EnableSensitiveDataLogging(); -}); - -builder.Services.AddCors(options => -{ - options.AddPolicy("CORSPolicy", corsPolicyBuilder => - { - corsPolicyBuilder.WithOrigins("http://localhost:4200") - .AllowAnyMethod() - .AllowAnyHeader() - .AllowCredentials(); - - corsPolicyBuilder.WithOrigins("https://diuna.bim-it.pl") - .AllowAnyMethod() - .AllowAnyHeader() - .AllowCredentials(); - }); -}); - -builder.Services.AddControllers(); - - -builder.Services.AddAuthentication(options => -{ - options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; - options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; - options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; -}).AddJwtBearer(options => -{ - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = false, - ValidateAudience = false, - ValidateLifetime = true, - ValidateIssuerSigningKey = true, - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Secret"]!)) - }; - -}); -builder.Services.AddAuthentication(); - -builder.Services.AddSingleton(typeof(GoogleSheetsHelper)); -builder.Services.AddSingleton(typeof(GoogleDriveHelper)); - -var fileName = "diunabi-admin-firebase.json"; -#if DEBUG -fileName = "diunabi-admin-firebase-Development.json"; -#endif -var credentialPath = Path.Combine(Directory.GetCurrentDirectory(), fileName); -System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", credentialPath); -FirebaseAdmin.FirebaseApp.Create(new AppOptions() -{ - Credential = GoogleCredential.GetApplicationDefault() -}); -builder.Services.AddSingleton(FirestoreDb.Create("diunabi-admin")); - -var app = builder.Build(); - - -app.Use(async (context, next) => -{ - var token = context.Request.Headers.Authorization.ToString(); - if (token.Length > 0 - && !context.Request.Path.ToString().Contains("getForPowerBI") - && !context.Request.Path.ToString().Contains("getConfiguration") - && !context.Request.Path.ToString().Contains("DataInbox/Add")) - { - var handler = new JwtSecurityTokenHandler(); - var data = handler.ReadJwtToken(token.Split(' ')[1]); - context.Request.Headers.Append("UserId", new Microsoft.Extensions.Primitives.StringValues(data.Subject)); - } - await next(context); -}); - -app.UseCors("CORSPolicy"); - -app.UseAuthentication(); -app.UseAuthorization(); - -app.MapControllers(); - -app.Run(); diff --git a/WebAPI/Properties/launchSettings.json b/WebAPI/Properties/launchSettings.json deleted file mode 100644 index d0e2c3c..0000000 --- a/WebAPI/Properties/launchSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "WebAPI": { - "commandName": "Project", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true - } - } -} \ No newline at end of file diff --git a/WebAPI/appsettings.Development.json b/WebAPI/appsettings.Development.json deleted file mode 100644 index fd76445..0000000 --- a/WebAPI/appsettings.Development.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "PONG": "Development", - "app-version": "0.0-dev", - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "ConnectionStrings": { - "SQLDatabase": "Server=tcp:127.0.0.1,1433;Initial Catalog=diunabi-morska;Persist Security Info=False;User ID=SA;Password=v](8Lc|RfG;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;" - }, - "GoogleClientId": "107631825312-bkfe438ehr9k9ecb2h76g802tj6advma.apps.googleusercontent.com", - "Secret": "8393AF8EAEF8478CB738D44858690F9C7E2D19F65896DD9FBAA3EB2A6F493E80", - "apiKey": "10763478CB738D4ecb2h76g803478CB738D4e", - "powerBI-user": "powerbi", - "powerBI-pass": "0F9C7E2D19FSLOCgKexz2h76g802tj6a", - "morska-user": "morska", - "morska-pass": "0F9C7E8CB738gK2h76g803478CB", - "exportDirectory": "1eTyCUzYbzVQB8f8sbNmvnebFXyW2-axt", - "appLogsFile": "13PuDvS3_HAYoSLOCgKexzlzIDLUilkApUF8QiJMTae0", - "apiLocalUrl": "localhost:5400", - "Kestrel": { - "Endpoints": { - "Http": { - "Url": "http://localhost:5400" - } - } - } -} diff --git a/WebAPI/appsettings.json b/WebAPI/appsettings.json deleted file mode 100644 index 01e744b..0000000 --- a/WebAPI/appsettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "PONG": "#{PING}#", - "app-version": "#{buildId}#", - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "ConnectionStrings": { - "SQLDatabase": "#{db-connection-string}#" - }, - "GoogleClientId": "#{google-backend-login-client-id}#", - "Secret": "#{google-backend-login-secret}#", - "apiKey": "#{api-key}#", - "powerBI-user": "#{powerBI-user}#", - "powerBI-pass": "#{powerBI-pass}#", - "morska-user": "#{morska-user}#", - "morska-pass": "#{morska-pass}#", - "exportDirectory": "#{export-directory}#", - "appLogsFile": "#{app-logs-file}#", - "apiLocalUrl": "#{api-local-url}#", - "Kestrel": { - "Endpoints": { - "Http": { - "Url": "http://#{api-local-url}#" - } - } - } -} diff --git a/WebAPI/client_secrets.Development.json b/WebAPI/client_secrets.Development.json deleted file mode 100644 index 0b9dadb..0000000 --- a/WebAPI/client_secrets.Development.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "diuna-370117", - "private_key_id": "f48fd588724e6733b9639fe7d7933091b96be34f", - "private_key": "-----BEGIN PRIVATE KEY-----MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCenqveXpGKXA10psAQ4Wreeiom9GMbZywnqMAhxc0wobI7EfnbP4FPOjfS8oWFRRrVzRil78zeUGWXb1WMHYvUyU3IrGXp6kVxuxbjBvwooOB5cEgz928A3aUUZRXxwjPV3+KuuAeQydVwPMQo2a0AQ+YAOK2QMG+BGAPAzYB+/35Zf6JsDOIDgWMaJq3etKgIijk40Nmf+uaGRAQlEbMhnAaAYz2B6I7W3z0pFDq2btgYJII+DWRC2DjSrA4UUeuds8Kz5qwfafJ8ki9N1RdYdbB/q6T74xQ3G/aEOK+CYmkWQz2woY5y8b5RCbKoGGIXpu6FVuWTnVxYJpP5QvIFAgMBAAECggEAJC3Evb+MKqa8WvL9s9v2aDAtFR2AzWtG4vTWfd2D46e940NCXgOqFswMl4zBb5hHeqSBDrgXXk2wHk5CkObcUfhoSXEo/aV1mW821SluskWfbZNypIe3RddII9K6op3M/OdH6NoIv7mJeUQi6b5ce0cBWuOSkuS5ShSUJpG40T5RQfl0iMuEYDpU1tvKmwhFlPTUTUGH7RdeqGFYIfE3kzFQiiSrS8V5L1GJKWcxMLdTq4P9JzaSW7eAAYKJiFTMSQvqs7pssCIj1JNLzD9PTsQmid2V2mUJIg3joXMNGbxNqMcIqbEesidIsDOkQ06taUIYG39og6rc9bar6XWRgQKBgQDK/+a8jCmUByhedUT5ZnREtHm4HcVo1tfBcmmqSEV0VJPJd14+CYvaUzCCJ9+xiLo6yOWRUk2h1GANAp50AdiVAHNibfwtri7vKWNhpnd111N/ebh6GIksT0ZTvu7sq5qbYXU3q6l6YRCyXSdF1oRfQED8I8G1xZP5j6fspBgoKQKBgQDICIKo3gmUEeFSt+o+Lucd2BljaFq/hUMA6WFdKbRyyd2iKBmGR15VNihiuJWy5i2nmuFaXMkeHo/PUJeEYC+vkc7M7UCYtD9l2xwp78o3ss7vxdPvOKhrcvux/Wpk1nuAEpM459MC0bmtOGIKU+QmDbsBbMHZ6p0R8DvECJ9mfQKBgEj60PAOD9CY9ilnTYHAFKKyo2POyC7VtkFkqZo/W0DkOzFdybLR6cZ2y+SvAxunRRRnLykchq5cVJ+4xlB8bWm7/L9xPQ0LJvJyVblAiIgD/o/AqdKzSXV1lpn69Zh+ZRnhYqu9+jL1/HOzS7Au2+4GgpZjIHwB6R36SGup3slpAoGAZW2jSxsjQjh6x2XIWfWQbVqZLQXKFhjta7XrD8FI5XekcUfiAWuI0q5edghgp9D9T2JCaH5p4GLgyt9zpMTdCSpm8RRQT93905jxw/X51JpPQddO6psRE0K/i3YTD8SN5NgGXLF4FpLfkozncZMuOXl23HcYKHZFZMYql/FDWkUCgYAjGQKzYV7IXA7UDAY3ejawWMbsDttSPQ0E1ouuJWIX/eb4SXYr0u/gdLuX1uM7EsxqIGVFWfgtUGopoVGr604Sg+dfOPZgUzaGAlUE2iRMVp6YoRRbrvPsYJwDrV0Xwil1k6UEzn8bgXO/IQ4fgIWjkxS5sDkZ6LVSCfDn5tLThg==-----END PRIVATE KEY-----", - "client_email": "diuna-backend@diuna-370117.iam.gserviceaccount.com", - "client_id": "101546901561736131820", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/diuna-backend%40diuna-370117.iam.gserviceaccount.com" -} diff --git a/WebAPI/client_secrets.json b/WebAPI/client_secrets.json deleted file mode 100644 index f4f3207..0000000 --- a/WebAPI/client_secrets.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "#{google-backend-project-id}#", - "private_key_id": "#{google-backend-private-key-id}#", - "private_key": "#{google-backend-private-key}#", - "client_email": "#{google-backend-client-email}#", - "client_id": "#{google-backend-client-id}#", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "#{google-backend-client-cert-url}#" -} diff --git a/WebAPI/dataImporters/morska.d1.importer.cs b/WebAPI/dataImporters/morska.d1.importer.cs deleted file mode 100644 index 97c62f7..0000000 --- a/WebAPI/dataImporters/morska.d1.importer.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System.Globalization; -using Google.Apis.Sheets.v4; -using WebAPI; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace DiunaBIWebAPI.dataImporters; - -public class MorskaD1Importer( - AppDbContext db, - SpreadsheetsResource.ValuesResource googleSheetValues, - LayersController controller) -{ - public void Import(Layer importWorker) - { - var sheetId = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetId")?.Desc1; - if (sheetId == null) - { - throw new Exception($"SheetId not found, {importWorker.Name}"); - } - var sheetTabName = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetTabName")?.Desc1; - if (sheetTabName == null) - { - throw new Exception($"SheetTabName not found, {importWorker.Name}"); - } - var year = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportYear")?.Desc1; - if (year == null) - { - throw new Exception($"ImportYear not found, {importWorker.Name}"); - } - var month = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportMonth")?.Desc1; - if (month == null) - { - throw new Exception($"ImportMonth not found, {importWorker.Name}"); - } - var name = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportName")?.Desc1; - if (name == null) - { - throw new Exception($"ImportName not found, {importWorker.Name}"); - } - - var dataRange = importWorker.Records!.FirstOrDefault(x => x.Code == "DataRange")?.Desc1; - if (dataRange == null) - { - throw new Exception($"DataRange not found, {importWorker.Name}"); - } - - var layer = new Layer - { - Number = db.Layers.Count() + 1, - ParentId = importWorker.Id, - Type = LayerType.Import, - CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - layer.Name = $"L{layer.Number}-I-{name}-{year}/{month}-{DateTime.Now.ToString("yyyyMMddHHmm", CultureInfo.InvariantCulture)}"; - - var dataRangeResponse = googleSheetValues.Get(sheetId, $"{sheetTabName}!{dataRange}").Execute(); - var data = dataRangeResponse.Values; - var newRecords = (from t in data - where t.Count > 1 && (string)t[0] != string.Empty - select new Record - { - Id = Guid.NewGuid(), - Code = t[0].ToString(), - Value1 = IndexExists(t, 3) ? ParseValue(t[3]?.ToString()) : null, - Value2 = IndexExists(t, 4) ? ParseValue(t[4]?.ToString()) : null, - Value3 = IndexExists(t, 5) ? ParseValue(t[5]?.ToString()) : null, - Value4 = IndexExists(t, 6) ? ParseValue(t[6]?.ToString()) : null, - Value5 = IndexExists(t, 7) ? ParseValue(t[7]?.ToString()) : null, - Value6 = IndexExists(t, 8) ? ParseValue(t[8]?.ToString()) : null, - Value7 = IndexExists(t, 9) ? ParseValue(t[9]?.ToString()) : null, - Value8 = IndexExists(t, 10) ? ParseValue(t[10]?.ToString()) : null, - Value9 = IndexExists(t, 11) ? ParseValue(t[11]?.ToString()) : null, - Value10 = IndexExists(t, 12) ? ParseValue(t[12]?.ToString()) : null, - Value11 = IndexExists(t, 13) ? ParseValue(t[13]?.ToString()) : null, - Value12 = IndexExists(t, 14) ? ParseValue(t[14]?.ToString()) : null, - Value13 = IndexExists(t, 15) ? ParseValue(t[15]?.ToString()) : null, - Value14 = IndexExists(t, 16) ? ParseValue(t[16]?.ToString()) : null, - Value15 = IndexExists(t, 17) ? ParseValue(t[17]?.ToString()) : null, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }).ToList(); - db.Layers.Add(layer); - controller.SaveRecords(layer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } - - private double? ParseValue(string? value) - { - if (string.IsNullOrEmpty(value) || value == "#DIV/0!") return null; - value = new string(value.Where(c => char.IsDigit(c) || c == '.' || c == ',' || c == '-').ToArray()); - try - { - double.TryParse(value, CultureInfo.GetCultureInfo("pl-PL"), out var result); - return result; - } - catch (FormatException) - { - return null; - } - } - private bool IndexExists(IList array, int index) - { - return array != null && index >= 0 && index < array.Count; - } -} \ No newline at end of file diff --git a/WebAPI/dataImporters/morska.d3.importer.cs b/WebAPI/dataImporters/morska.d3.importer.cs deleted file mode 100644 index 17e367c..0000000 --- a/WebAPI/dataImporters/morska.d3.importer.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Globalization; -using System.Text; -using System.Text.Json; -using Google.Apis.Sheets.v4; -using WebAPI; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace DiunaBIWebAPI.dataImporters; - -public class MorskaD3Importer( - AppDbContext db, - LayersController controller) -{ - public void Import(Layer importWorker) - { - var year = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportYear")?.Desc1; - if (year == null) - { - throw new Exception($"ImportYear not found, {importWorker.Name}"); - } - var month = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportMonth")?.Desc1; - if (month == null) - { - throw new Exception($"ImportMonth not found, {importWorker.Name}"); - } - var name = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportName")?.Desc1; - if (name == null) - { - throw new Exception($"ImportName not found, {importWorker.Name}"); - } - var type = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportType")?.Desc1; - if (name == null) - { - throw new Exception($"ImportType not found, {importWorker.Name}"); - } - var dataInbox = db.DataInbox.OrderByDescending(x => x.CreatedAt).FirstOrDefault(x => x.Name == type); - if (dataInbox == null) - { - throw new Exception($"DataInbox not found, {type}"); - } - var data = Convert.FromBase64String(dataInbox.Data); - var tst = Encoding.UTF8.GetString(data); - var records = JsonSerializer.Deserialize>(Encoding.UTF8.GetString(data)); - if (records == null) - { - throw new Exception($"DataInbox.Data is empty, {dataInbox.Name}"); - } - records = records.Where(x => x.Code!.StartsWith($"{year}{month}")).ToList(); - if (records.Count == 0) - { - throw new Exception($"No records found for {year}{month}"); - } - records = records.Select(x => - { - x.Id = Guid.NewGuid(); - x.CreatedAt = DateTime.UtcNow; - x.ModifiedAt = DateTime.UtcNow; - return x; - }).ToList(); - var layer = new Layer - { - Number = db.Layers.Count() + 1, - ParentId = importWorker.Id, - Type = LayerType.Import, - CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - layer.Name = $"L{layer.Number}-I-{name}-{year}/{month}-{DateTime.Now.ToString("yyyyMMddHHmm", CultureInfo.InvariantCulture)}"; - - db.Layers.Add(layer); - controller.SaveRecords(layer.Id, records, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataImporters/morska.fk2.importer.cs b/WebAPI/dataImporters/morska.fk2.importer.cs deleted file mode 100644 index 8ea13f9..0000000 --- a/WebAPI/dataImporters/morska.fk2.importer.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System.Globalization; -using Google.Apis.Sheets.v4; -using WebAPI; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace DiunaBIWebAPI.dataImporters; - -public class MorskaFk2Importer( - AppDbContext db, - SpreadsheetsResource.ValuesResource googleSheetValues, - LayersController controller) -{ - public void Import(Layer importWorker) - { - var sheetId = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetId")?.Desc1; - if (sheetId == null) - { - throw new Exception($"SheetId not found, {importWorker.Name}"); - } - var sheetTabName = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetTabName")?.Desc1; - if (sheetTabName == null) - { - throw new Exception($"SheetTabName not found, {importWorker.Name}"); - } - var year = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportYear")?.Desc1; - if (year == null) - { - throw new Exception($"ImportYear not found, {importWorker.Name}"); - } - var month = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportMonth")?.Desc1; - if (month == null) - { - throw new Exception($"ImportMonth not found, {importWorker.Name}"); - } - var name = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportName")?.Desc1; - if (name == null) - { - throw new Exception($"ImportName not found, {importWorker.Name}"); - } - - var dataRange = importWorker.Records!.FirstOrDefault(x => x.Code == "DataRange")?.Desc1; - if (dataRange == null) - { - throw new Exception($"DataRange not found, {importWorker.Name}"); - } - - var layer = new Layer - { - Number = db.Layers.Count() + 1, - ParentId = importWorker.Id, - Type = LayerType.Import, - CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - layer.Name = $"L{layer.Number}-I-{name}-{year}/{month}-{DateTime.Now.ToString("yyyyMMddHHmm", CultureInfo.InvariantCulture)}"; - - var newRecords = new List(); - - var dataRangeResponse = googleSheetValues.Get(sheetId, $"{sheetTabName}!{dataRange}").Execute(); - var data = dataRangeResponse.Values; - for (var i = 0; i < data.Count; i++) - { - if (data[i].Count <= 9 || (string)data[i][3] == string.Empty) continue; - var dateArr = data[i][1].ToString()!.Split("."); - if (dateArr.Length != 3) - { - throw new Exception($"Invalid date in row {i}"); - } - - var number = data[i][2].ToString()!; - if (number.Length == 1) number = $"0{number}"; - var code = dateArr[2] + dateArr[1] + dateArr[0] + number; - if (!(data[i][9].ToString()?.Length > 0) || - !double.TryParse(data[i][9].ToString(), CultureInfo.GetCultureInfo("pl-PL"), out var value)) continue; - var record = new Record - { - Id = Guid.NewGuid(), - Code = code, - Desc1 = data[i][3].ToString(), - Value1 = value, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - newRecords.Add(record); - } - db.Layers.Add(layer); - controller.SaveRecords(layer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataImporters/morska.importer.cs b/WebAPI/dataImporters/morska.importer.cs deleted file mode 100644 index d358f7e..0000000 --- a/WebAPI/dataImporters/morska.importer.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Globalization; -using Google.Apis.Sheets.v4; -using WebAPI; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace DiunaBIWebAPI.dataImporters; - -public class MorskaImporter( - AppDbContext db, - SpreadsheetsResource.ValuesResource googleSheetValues, - LayersController controller) -{ - public void Import(Layer importWorker) - { - var sheetId = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetId")?.Desc1; - if (sheetId == null) - { - throw new Exception($"SheetId not found, {importWorker.Name}"); - } - var sheetTabName = importWorker.Records!.FirstOrDefault(x => x.Code == "SheetTabName")?.Desc1; - if (sheetTabName == null) - { - throw new Exception($"SheetTabName not found, {importWorker.Name}"); - } - var year = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportYear")?.Desc1; - if (year == null) - { - throw new Exception($"ImportYear not found, {importWorker.Name}"); - } - var month = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportMonth")?.Desc1; - if (month == null) - { - throw new Exception($"ImportMonth not found, {importWorker.Name}"); - } - var name = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportName")?.Desc1; - if (name == null) - { - throw new Exception($"ImportName not found, {importWorker.Name}"); - } - - var dataRange = importWorker.Records!.FirstOrDefault(x => x.Code == "DataRange")?.Desc1; - if (dataRange == null) - { - throw new Exception($"DataRange not found, {importWorker.Name}"); - } - - var layer = new Layer - { - Number = db.Layers.Count() + 1, - ParentId = importWorker.Id, - Type = LayerType.Import, - CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"), - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - layer.Name = $"L{layer.Number}-I-{name}-{year}/{month}-{DateTime.Now:yyyyMMddHHmm}"; - - var newRecords = new List(); - - var dataRangeResponse = googleSheetValues.Get(sheetId, $"{sheetTabName}!{dataRange}").Execute(); - var data = dataRangeResponse.Values; - for (var i = 0; i < data[1].Count; i++) - { - if (!(data[0][i].ToString()?.Length > 0) || - !double.TryParse(data[1][i].ToString(), CultureInfo.GetCultureInfo("pl-PL"), out var value)) continue; - var record = new Record - { - Id = Guid.NewGuid(), - Code = data[0][i].ToString(), - Value1 = value, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - newRecords.Add(record); - } - db.Layers.Add(layer); - controller.SaveRecords(layer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/ProcessHelper.cs b/WebAPI/dataProcessors/ProcessHelper.cs deleted file mode 100644 index f85a621..0000000 --- a/WebAPI/dataProcessors/ProcessHelper.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System.Text.RegularExpressions; -using WebAPI.Models; - -namespace DiunaBIWebAPI.dataProcessors; - -public static class ProcessHelper -{ - public static void SetValue(Record record, int number, double? value) - { - value = (double)Math.Round((decimal)(value ?? 0), 2); - switch (number) - { - case 1: - record.Value1 = value; - break; - case 2: - record.Value2 = value; - break; - case 3: - record.Value3 = value; - break; - case 4: - record.Value4 = value; - break; - case 5: - record.Value5 = value; - break; - case 6: - record.Value6 = value; - break; - case 7: - record.Value7 = value; - break; - case 8: - record.Value8 = value; - break; - case 9: - record.Value9 = value; - break; - case 10: - record.Value10 = value; - break; - case 11: - record.Value11 = value; - break; - case 12: - record.Value12 = value; - break; - case 13: - record.Value13 = value; - break; - case 14: - record.Value14 = value; - break; - case 15: - record.Value15 = value; - break; - case 16: - record.Value16 = value; - break; - case 17: - record.Value17 = value; - break; - case 18: - record.Value18 = value; - break; - case 19: - record.Value19 = value; - break; - case 20: - record.Value20 = value; - break; - case 21: - record.Value21 = value; - break; - case 22: - record.Value22 = value; - break; - case 23: - record.Value23 = value; - break; - case 24: - record.Value24 = value; - break; - case 25: - record.Value25 = value; - break; - case 26: - record.Value26 = value; - break; - case 27: - record.Value27 = value; - break; - case 28: - record.Value28 = value; - break; - case 29: - record.Value29 = value; - break; - case 30: - record.Value30 = value; - break; - case 31: - record.Value31 = value; - break; - case 32: - record.Value32 = value; - break; - } - } - public static double? GetValue(Record record, int number) - { - return number switch - { - 1 => record.Value1, - 2 => record.Value2, - 3 => record.Value3, - 4 => record.Value4, - 5 => record.Value5, - 6 => record.Value6, - 7 => record.Value7, - 8 => record.Value8, - 9 => record.Value9, - 10 => record.Value10, - 11 => record.Value11, - 12 => record.Value12, - 13 => record.Value13, - 14 => record.Value14, - 15 => record.Value15, - 16 => record.Value16, - 17 => record.Value17, - 18 => record.Value18, - 19 => record.Value19, - 20 => record.Value20, - 21 => record.Value21, - 22 => record.Value22, - 23 => record.Value23, - 24 => record.Value24, - 25 => record.Value25, - 26 => record.Value26, - 27 => record.Value27, - 28 => record.Value28, - 29 => record.Value29, - 30 => record.Value30, - 31 => record.Value31, - 32 => record.Value32, - _ => null - }; - } - public static List ParseCodes(string codes) - { - var codesList = new List(); - foreach (var code in codes.Split(';')) - { - var range = code.Split('-'); - switch (range.Length) - { - case 1: - codesList.Add(int.Parse(range[0])); - break; - case 2: - { - for (var i = int.Parse(range[0]); i <= int.Parse(range[1]); i++) - { - codesList.Add(i); - } - - break; - } - default: - throw new Exception($"Invalid code range: {code}"); - } - } - return codesList; - } - public static string? ExtractMonthFromLayerName(string layerName) - { - string pattern = @"L\d+-P-\d{4}/(\d{2})-"; - var match = Regex.Match(layerName, pattern); - if (match.Success && match.Groups.Count > 1) - { - return match.Groups[1].Value; - } - return null; - } - - public static string GetSheetName(int month, int year) - { - if (month < 1 || month > 12) - { - throw new ArgumentOutOfRangeException(nameof(month), "Month must be between 1 and 12."); - } - - var polishMonths = new[] - { - "Styczen", - "Luty", - "Marzec", - "Kwiecien", - "Maj", - "Czerwiec", - "Lipiec", - "Sierpien", - "Wrzesien", - "Pazdziernik", - "Listopad", - "Grudzien" - }; - var monthName = polishMonths[month - 1]; - return $"{monthName}_{year}"; - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t1.r1.processor.cs b/WebAPI/dataProcessors/t1.r1.processor.cs deleted file mode 100644 index f865f35..0000000 --- a/WebAPI/dataProcessors/t1.r1.processor.cs +++ /dev/null @@ -1,277 +0,0 @@ -using System.Globalization; -using DiunaBIWebAPI.dataProcessors; -using Google.Apis.Sheets.v4; -using Google.Apis.Sheets.v4.Data; -using Microsoft.EntityFrameworkCore; -using WebAPI.Calculator; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T1R1Processor( - AppDbContext db, - SpreadsheetsResource.ValuesResource googleSheetValues, - LayersController controller, - LogsController logsController) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList(); - if (sources!.Count == 0) - { - throw new Exception("Source record not found"); - } - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}-R1-T1"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var dynamicCodes = processWorker.Records?.Where(x => x.Code!.Contains("DynamicCode-")) - .OrderBy(x => int.Parse(x.Code!.Split('-')[1])) - .ToList(); - - var newRecords = new List(); - - for (var month = 1; month < 14; month++) - { - if (year > DateTime.UtcNow.Year || (( year == DateTime.UtcNow.Year && month > DateTime.UtcNow.Month && month != 13))) - { - continue; - } - - var records = new List(); - foreach (var source in sources) - { - var monthCopy = month; - var dataSource = db.Layers.Where(x => - x.Type == LayerType.Processed && - !x.IsDeleted && !x.IsCancelled && - x.Name != null && x.Name.Contains($"{year}/{monthCopy:D2}-{source.Desc1}-T3") - ).Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - - if (dataSource == null) - { - throw new Exception($"Source layer {year}/{monthCopy}-{source.Desc1}-T3 not found."); - } - - var codesRecord = processWorker.Records?.Where(x => x.Code == $"Codes-{source.Desc1}").FirstOrDefault(); - if (codesRecord != null) - { - var codes = ProcessHelper.ParseCodes(codesRecord.Desc1!); - records.AddRange(dataSource.Records!.Where(x => codes.Contains(int.Parse(x.Code!)))); - } - else - { - records.AddRange(dataSource.Records!); - } - } - - if (dynamicCodes != null) - { - foreach (var dynamicCode in dynamicCodes) - { - try - { - if (dynamicCode.Desc1 == null) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula in Record {dynamicCode.Id} is missing.", - CreatedAt = DateTime.UtcNow - }); - continue; - } - - var calc = new BaseCalc(dynamicCode.Desc1); - if (!calc.IsFormulaCorrect()) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula {calc.Expression} in Record {dynamicCode.Id} is not correct", - CreatedAt = DateTime.UtcNow - }); - continue; - } - - try - { - records.Add(calc.CalculateT1(records)); - } - catch (Exception e) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = - $"Formula {calc.Expression} in Record {dynamicCode.Id} error: {e.Message}", - CreatedAt = DateTime.UtcNow - }); - } - } - catch (Exception e) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Calculation error {dynamicCode.Id}: {e.Message} ", - CreatedAt = DateTime.UtcNow - }); - } - } - } - - newRecords.AddRange(records.Select(x => new Record - { - Id = Guid.NewGuid(), - Code = $"{x.Code}{month:D2}", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - Value1 = x.Value32 - } - )); - } - - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - - var sheetName = processWorker.Records?.SingleOrDefault(x => x.Code == "GoogleSheetName")?.Desc1; - if (sheetName == null) - { - throw new Exception("GoogleSheetName record not found"); - } - - UpdateReport(processedLayer.Id, sheetName); - } - - private void UpdateReport(Guid sourceId, string sheetName) - { - const string sheetId = "1pph-XowjlK5CIaCEV_A5buK4ceJ0Z0YoUlDI4VMkhhA"; - var request = googleSheetValues.Get(sheetId, $"{sheetName}!C4:DA4"); - var response = request.Execute(); - - var r1 = db.Layers - .Where(x => x.Id == sourceId) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - - var codesRow = response.Values[0]; - - var valueRange = new ValueRange - { - Values = new List>() - }; - - for (var i = 1; i <= 12; i++) - { - var values = new List(); - foreach (string code in codesRow) - { - var record = r1!.Records?.SingleOrDefault(x => x.Code == $"{code}{i:D2}"); - if (record != null) - { - values.Add(record.Value1!.Value); - } - else - { - values.Add("0"); - } - } - valueRange.Values.Add(values); - } - - // sum - var valuesSum = new List(); - var emptyRow = new List(); - foreach (string code in codesRow) - { - var record = r1!.Records?.SingleOrDefault(x => x.Code == $"{code}13"); - emptyRow.Add(""); - if (record != null) - { - valuesSum.Add(record.Value1!.Value); - } - else - { - valuesSum.Add("0"); - } - } - - valueRange.Values.Add(emptyRow); - valueRange.Values.Add(valuesSum); - - var update = googleSheetValues.Update(valueRange, sheetId, $"{sheetName}!C7:DA20"); - update.ValueInputOption = - SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - update.Execute(); - - // update time - var timeUtc = new List - { - r1!.ModifiedAt.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL")) - }; - var warsawTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); - var warsawTime = TimeZoneInfo.ConvertTimeFromUtc(r1.ModifiedAt.ToUniversalTime(), warsawTimeZone); - var timeWarsaw = new List - { - warsawTime.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL")) - }; - var valueRangeTime = new ValueRange - { - Values = new List> () - }; - valueRangeTime.Values.Add(timeUtc); - valueRangeTime.Values.Add(timeWarsaw); - - var updateTimeUtc = googleSheetValues.Update(valueRangeTime, sheetId, $"{sheetName}!G1:G2"); - updateTimeUtc.ValueInputOption = - SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateTimeUtc.Execute(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t1.r3.processor.cs b/WebAPI/dataProcessors/t1.r3.processor.cs deleted file mode 100644 index bc0941b..0000000 --- a/WebAPI/dataProcessors/t1.r3.processor.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System.Globalization; -using System.Text.RegularExpressions; -using DiunaBIWebAPI.dataProcessors; -using Google.Apis.Sheets.v4; -using Google.Apis.Sheets.v4.Data; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T1R3Processor( - AppDbContext db, - LayersController controller, - SpreadsheetsResource.ValuesResource googleSheetValues) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var source = processWorker.Records?.Where(x => x.Code == "Source").First().Desc1; - if (source == null) - { - throw new Exception("Source record not found"); - } - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}-R3-T1"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - - var newRecords = new List(); - - string pattern = @$"^L\d+-P-{year}/\d+-{source}-T5$"; - var dataSources = db.Layers - .Where(x => !x.IsDeleted && !x.IsCancelled) - .Include(layer => layer.Records!) - .AsNoTracking() - .AsEnumerable() - .Where(x => Regex.IsMatch(x.Name!, pattern)) - .ToList(); - - foreach (var dataSource in dataSources) - { - var month = ProcessHelper.ExtractMonthFromLayerName(dataSource.Name!); - if (month == null) - { - throw new Exception($"Month not found: {dataSource.Name}"); - } - - foreach (var record in dataSource.Records!) - { - if (record.Value1 == null) continue; - for (var i = 1; i < 33; i++) - { - if (ProcessHelper.GetValue(record, i) == null) continue; - - var newRecord = new Record - { - Id = Guid.NewGuid(), - Code = $"{record.Code}{month}{i:D2}", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - Value1 = i==1 ? record.Value1 : record.Value1 * ProcessHelper.GetValue(record, i) / 100, - Desc1 = record.Desc1 - }; - - newRecords.Add(newRecord); - } - } - } - - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - - UpdateReport(processedLayer.Id, year); - } - - private void UpdateReport(Guid sourceId, int year) - { - const string sheetId = "10Xo8BBF92nM7_JzzeOuWp49Gz8OsYuCxLDOeChqpW_8"; - - var r3 = db.Layers - .Where(x => x.Id == sourceId) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - - for (var i = 1; i <= 12; i++) - { - var sheetName = ProcessHelper.GetSheetName(i, year); - ValueRange? dataRangeResponse; - try - { - dataRangeResponse = googleSheetValues.Get(sheetId, $"{sheetName}!A7:A200").Execute(); - } - catch - { - continue; // Sheet not exist - } - - if (dataRangeResponse == null) continue; // Sheet not exist - var data = dataRangeResponse.Values; - - var updateValueRange = new ValueRange - { - Values = new List>() - }; - - foreach (var row in data) - { - if (row.Count == 0) continue; - var code = row[0].ToString(); - - var updateRow = new List(); - - for (var j = 1; j < 16; j++) - { - var codeRecord = r3!.Records!.FirstOrDefault(x => x.Code == $"{code}{i:D2}{j:D2}"); - if (codeRecord is { Value1: not null }) - { - updateRow.Add(codeRecord.Value1); - } - else - { - updateRow.Add(""); - } - } - - updateValueRange.Values.Add(updateRow); - } - - dataRangeResponse.Values = data; - var update = googleSheetValues.Update(updateValueRange, sheetId, $"{sheetName}!C7:Q200"); - update.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - update.Execute(); - - // update time - var timeUtc = new List - { - r3!.ModifiedAt.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL")) - }; - var warsawTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); - var warsawTime = TimeZoneInfo.ConvertTimeFromUtc(r3.ModifiedAt.ToUniversalTime(), warsawTimeZone); - var timeWarsaw = new List - { - warsawTime.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL")) - }; - var valueRangeTime = new ValueRange - { - Values = new List> () - }; - valueRangeTime.Values.Add(timeUtc); - valueRangeTime.Values.Add(timeWarsaw); - - var updateTimeUtc = googleSheetValues.Update(valueRangeTime, sheetId, $"{sheetName}!G1:G2"); - updateTimeUtc.ValueInputOption = - SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateTimeUtc.Execute(); - } - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodes.processor.cs b/WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodes.processor.cs deleted file mode 100644 index ed4b900..0000000 --- a/WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodes.processor.cs +++ /dev/null @@ -1,98 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T3MultiSourceCopySelectedCodesProcessor( - AppDbContext db, - LayersController controller) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!); - var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList(); - if (sources!.Count == 0) - { - throw new Exception("Source record not found"); - } - var codes = processWorker.Records?.SingleOrDefault(x => x.Code == "Codes")?.Desc1; - if (codes == null) - { - throw new Exception("Codes record not found"); - } - - var codesList = ProcessHelper.ParseCodes(codes); - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/{month:D2}-AB-T3"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var dataSources = sources.Select(source => db.Layers - .Where(x => x.Type == LayerType.Processed && !x.IsDeleted && !x.IsCancelled && x.Name != null && x.Name.Contains($"{year}/{month:D2}-{source.Desc1}-T3")) - .Include(x => x.Records).AsNoTracking() - .FirstOrDefault()) - .OfType() - .ToList(); - if (dataSources.Count == 0) - { - throw new Exception("DataSources are empty"); - } - - - var newRecords = dataSources - .SelectMany(x => x.Records!) - .Where(x => codesList.Contains(int.Parse(x.Code!))) - .Select(x => - { - var newRecord = new Record - { - Id = Guid.NewGuid(), - Code = x.Code, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - for (var i = 1; i < 33; i++) - { - ProcessHelper.SetValue(newRecord, i, ProcessHelper.GetValue(x, i)); - } - return newRecord; - }) - .ToList(); - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodesYearSummary.processor.cs b/WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodesYearSummary.processor.cs deleted file mode 100644 index 58e884e..0000000 --- a/WebAPI/dataProcessors/t3.MultiSourceCopySelectedCodesYearSummary.processor.cs +++ /dev/null @@ -1,101 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T3MultiSourceCopySelectedCodesYearSummaryProcessor( - AppDbContext db, - LayersController controller) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/13-AB-T3"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var newRecords = new List(); - - var dataSources = new List(); - - for (var i = 1; i < 13; i++) - { - var j = i; - var dataSource = db.Layers.Where(x => - x.Type == LayerType.Processed - && !x.IsDeleted && !x.IsCancelled - && x.Name != null && x.Name.Contains($"{year}/{j:D2}-AB-T3")) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - if (dataSource != null) - { - dataSources.Add(dataSource); - } - } - - if (dataSources.Count == 0) - { - throw new Exception("DataSources are empty"); - } - - var allRecords = dataSources.SelectMany(x => x.Records!).ToList(); - - foreach (var baseRecord in dataSources.Last().Records!) - { - var codeRecords = allRecords.Where(x => x.Code == baseRecord.Code).ToList(); - var processedRecord = new Record - { - Id = Guid.NewGuid(), - Code = baseRecord.Code, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - for (var i = 1; i < 33; i++) - { - ProcessHelper.SetValue(processedRecord, i, - codeRecords.Sum(x => ProcessHelper.GetValue(x, i))); - } - - newRecords.Add(processedRecord); - } - - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t3.MultiSourceSummary.processor.cs b/WebAPI/dataProcessors/t3.MultiSourceSummary.processor.cs deleted file mode 100644 index ff9f0f2..0000000 --- a/WebAPI/dataProcessors/t3.MultiSourceSummary.processor.cs +++ /dev/null @@ -1,167 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Calculator; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T3MultiSourceSummaryProcessor( - AppDbContext db, - LayersController controller, - LogsController logsController) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!); - var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList(); - if (sources!.Count == 0) - { - throw new Exception("Source record not found"); - } - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/{month:D2}-AA-T3"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var newRecords = new List(); - - var dataSources = sources.Select(source => db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && !x.IsCancelled && x.Name != null && x.Name.Contains($"{year}/{month:D2}-{source.Desc1}-T3")) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault()) - .OfType() - .ToList(); - - if (dataSources.Count == 0) - { - throw new Exception("DataSources are empty"); - } - - var allRecords = dataSources.SelectMany(x => x.Records!).ToList(); - var baseCodes = allRecords.Select(x => x.Code!.Remove(0, 1)).Distinct().ToList(); - - foreach (var baseCode in baseCodes) - { - - var codeRecords = allRecords.Where(x => - x.Code![1..] == baseCode) - .ToList(); - var processedRecord = new Record - { - Id = Guid.NewGuid(), - Code = $"9{baseCode}", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - for (var i = 1; i<33; i++) - { - ProcessHelper.SetValue(processedRecord, i, - codeRecords.Sum(x => ProcessHelper.GetValue(x, i))); - } - newRecords.Add(processedRecord); - } - - // Dynamic Codes - var dynamicCodes = processWorker.Records? - .Where(x => x.Code!.Contains("DynamicCode-")) - .OrderBy(x => int.Parse(x.Code!.Split('-')[1])).ToList(); - if (dynamicCodes != null && dynamicCodes.Count != 0) - { - foreach (var dynamicCode in dynamicCodes) - { - try - { - if (dynamicCode.Desc1 == null) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula in Record {dynamicCode.Id} is missing.", - CreatedAt = DateTime.UtcNow - }); - continue; - } - var calc = new BaseCalc(dynamicCode.Desc1); - if (!calc.IsFormulaCorrect()) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula {calc.Expression} in Record {dynamicCode.Id} is not correct", - CreatedAt = DateTime.UtcNow - }); - continue; - } - - try - { - newRecords.Add(calc.CalculateT3(newRecords)); - } - catch (Exception e) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula {calc.Expression} in Record {dynamicCode.Id} error: {e.Message}", - CreatedAt = DateTime.UtcNow - }); - } - } - catch (Exception e) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Calculation error {dynamicCode.Id}: {e.Message} ", - CreatedAt = DateTime.UtcNow - }); - } - } - } - - - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t3.MultiSourceYearSummary.processor.cs b/WebAPI/dataProcessors/t3.MultiSourceYearSummary.processor.cs deleted file mode 100644 index 45bba10..0000000 --- a/WebAPI/dataProcessors/t3.MultiSourceYearSummary.processor.cs +++ /dev/null @@ -1,187 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Calculator; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T3MultiSourceYearSummaryProcessor( - AppDbContext db, - LayersController controller, - LogsController logsController) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList(); - if (sources!.Count == 0) - { - throw new Exception("Source record not found"); - } - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/13-AA-T3"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var newRecords = new List(); - - var dataSources = sources.Select(source => db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && !x.IsCancelled && x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T3")) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault()) - .OfType() - .ToList(); - if (dataSources.Count == 0) - { - throw new Exception("DataSources are empty"); - } - - if (dataSources.Count == 0) - { - throw new Exception("DataSourcesValidation are empty"); - } - - var allRecords = dataSources - .SelectMany(x => x.Records!).ToList(); - var baseCodes = allRecords.Select(x => x.Code!.Remove(0, 1)).Distinct().ToList(); - - foreach (var baseCode in baseCodes) - { - - var codeRecords = allRecords.Where(x => - x.Code![1..] == baseCode) - .ToList(); - var codeRecordsValidation = allRecords.Where(x => - x.Code![1..] == baseCode) - .ToList(); - var processedRecord = new Record - { - Id = Guid.NewGuid(), - Code = $"9{baseCode}", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - var validationRecord = new Record(); - for (var i = 1; i < 33; i++) - { - ProcessHelper.SetValue(processedRecord, i, - codeRecords.Sum(x => ProcessHelper.GetValue(x, i))); - - ProcessHelper.SetValue(validationRecord, i, - codeRecordsValidation.Sum(x => ProcessHelper.GetValue(x, i))); - - if ( - double.Abs((double)(ProcessHelper.GetValue(processedRecord,i) - - ProcessHelper.GetValue(validationRecord, i))!) > 0.01) - { - throw new Exception($"ValidationError: Code {baseCode}, " + - $"Value{i} ({ProcessHelper.GetValue(processedRecord, i)} | " + - $"{ProcessHelper.GetValue(validationRecord, i)})"); - } - } - newRecords.Add(processedRecord); - } - - - - // Dynamic Codes - var dynamicCodes = processWorker.Records? - .Where(x => x.Code!.Contains("DynamicCode-")) - .OrderBy(x => int.Parse(x.Code!.Split('-')[1])).ToList(); - if (dynamicCodes != null && dynamicCodes.Count != 0) - { - foreach (var dynamicCode in dynamicCodes) - { - try - { - if (dynamicCode.Desc1 == null) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula in Record {dynamicCode.Id} is missing.", - CreatedAt = DateTime.UtcNow - }); - continue; - } - var calc = new BaseCalc(dynamicCode.Desc1); - if (!calc.IsFormulaCorrect()) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula {calc.Expression} in Record {dynamicCode.Id} is not correct", - CreatedAt = DateTime.UtcNow - }); - continue; - } - - try - { - newRecords.Add(calc.CalculateT3(newRecords)); - } - catch (Exception e) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Formula {calc.Expression} in Record {dynamicCode.Id} error: {e.Message}", - CreatedAt = DateTime.UtcNow - }); - } - } - catch (Exception e) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Calculation error {dynamicCode.Id}: {e.Message} ", - CreatedAt = DateTime.UtcNow - }); - } - } - } - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t3.SingleSource.processor.cs b/WebAPI/dataProcessors/t3.SingleSource.processor.cs deleted file mode 100644 index 63b1eb0..0000000 --- a/WebAPI/dataProcessors/t3.SingleSource.processor.cs +++ /dev/null @@ -1,141 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T3SingleSourceProcessor( - AppDbContext db, - LayersController controller) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!); - var sourceLayer = processWorker.Records?.SingleOrDefault(x => x.Code == "SourceLayer")?.Desc1; - if (sourceLayer == null) - { - throw new Exception("SourceLayer record not found"); - } - var sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == sourceLayer && !x.IsDeleted && !x.IsCancelled); - if (sourceImportWorker == null) - { - throw new Exception("SourceImportWorkerL layer not found"); - } - var source = processWorker.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1; - if (sourceLayer == null) - { - throw new Exception("Source record not found"); - } - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/{month:D2}-{source}-T3"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - - var newRecords = new List(); - - var dataSources = db.Layers - .Include(x => x.Records) - .Where(x => x.ParentId == sourceImportWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderBy(x => x.CreatedAt) - .AsNoTracking() - .ToList(); - if (dataSources.Count == 0) - { - throw new Exception($"DataSources are empty, {sourceImportWorker.Name}"); - } - - var allRecords = dataSources.SelectMany(x => x.Records!).ToList(); - - foreach (var baseRecord in dataSources.Last().Records!) - { - var codeRecords = allRecords.Where(x => x.Code == baseRecord.Code).ToList(); - - var processedRecord = new Record - { - Id = Guid.NewGuid(), - Code = baseRecord.Code, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - - var lastDayInMonth = DateTime.DaysInMonth(year, month); - //day 1 - var firstVal = codeRecords - .Where(x => x.CreatedAt.Date <= new DateTime(year, month, 1)).MaxBy(x => x.CreatedAt)?.Value1 ?? 0; - ProcessHelper.SetValue(processedRecord, 1, firstVal); - var previousValue = firstVal; - //days 2-29/30 - for (var i = 2; i < lastDayInMonth; i++) - { - var dayVal = codeRecords - .Where(x => x.CreatedAt.Day == i && x.CreatedAt.Month == month).MaxBy(x => x.CreatedAt)?.Value1; - if (dayVal == null) - { - ProcessHelper.SetValue(processedRecord, i, 0); - } - else - { - var processedVal = dayVal - previousValue; - ProcessHelper.SetValue(processedRecord, i, processedVal); - previousValue = (double)dayVal; - } - } - //last day - var lastVal = codeRecords - .Where(x => x.CreatedAt.Date >= new DateTime(year, month, lastDayInMonth)).MaxBy(x => x.CreatedAt)?.Value1; - - if (lastVal == null) - { - ProcessHelper.SetValue(processedRecord, lastDayInMonth, 0); - } - else - { - ProcessHelper.SetValue(processedRecord, lastDayInMonth, (double)lastVal - previousValue); - } - - // copy last value - var valueToCopy = codeRecords.MaxBy(x => x.CreatedAt)?.Value1; - ProcessHelper.SetValue(processedRecord, 32, valueToCopy); - - newRecords.Add(processedRecord); - } - - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } - -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t3.SourceYearSummary.processor.cs b/WebAPI/dataProcessors/t3.SourceYearSummary.processor.cs deleted file mode 100644 index 9953f30..0000000 --- a/WebAPI/dataProcessors/t3.SourceYearSummary.processor.cs +++ /dev/null @@ -1,101 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T3SourceYearSummaryProcessor( - AppDbContext db, - LayersController controller) -{ - public void Process(Layer processWorker) - { - var year = processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1; - var source = processWorker.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1; - if (source == null) - { - throw new Exception("Source record not found"); - } - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/13-{source}-T3"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var newRecords = new List(); - - var dataSources = new List(); - for (var i=1; i<13; i++) - { - var j = i; - var dataSource = db.Layers.Where(x => - x.Type == LayerType.Processed - && !x.IsDeleted && !x.IsCancelled - && x.Name!=null && x.Name.Contains($"{year}/{j:D2}-{source}-T3")) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - if (dataSource != null) - { - dataSources.Add(dataSource); - } - } - - if (dataSources.Count == 0) - { - throw new Exception("DataSources are empty"); - } - - var allRecords = dataSources.SelectMany(x => x.Records!).ToList(); - - foreach (var baseRecord in dataSources.Last().Records!) - { - var codeRecords = allRecords.Where(x => x.Code == baseRecord.Code).ToList(); - var processedRecord = new Record - { - Id = Guid.NewGuid(), - Code = baseRecord.Code, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - for (var i = 1; i < 33; i++) - { - ProcessHelper.SetValue(processedRecord, i, - codeRecords.Sum(x => ProcessHelper.GetValue(x, i))); - } - newRecords.Add(processedRecord); - } - - if (isNew) - { - db.Layers.Add(processedLayer); - } else - { - db.Layers.Update(processedLayer); - } - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t4.SingleSource.processor.cs b/WebAPI/dataProcessors/t4.SingleSource.processor.cs deleted file mode 100644 index 91fb4a8..0000000 --- a/WebAPI/dataProcessors/t4.SingleSource.processor.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T4SingleSourceProcessor( - AppDbContext db, - LayersController controller) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!); - var sourceLayer = processWorker.Records?.SingleOrDefault(x => x.Code == "SourceLayer")?.Desc1; - if (sourceLayer == null) - { - throw new Exception("SourceLayer record not found"); - } - var sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == sourceLayer && !x.IsDeleted && !x.IsCancelled); - if (sourceImportWorker == null) - { - throw new Exception("SourceImportWorkerL layer not found"); - } - var source= processWorker.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1; - if (sourceLayer == null) - { - throw new Exception("Source record not found"); - } - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id && - !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/{month:D2}-{source}-T4"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - - var dataSource = db.Layers - .Include(x => x.Records) - .Where(x => x.ParentId == sourceImportWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .AsNoTracking() - .FirstOrDefault(); - - if (dataSource == null) - { - throw new Exception($"DataSource not found, {sourceImportWorker.Name}"); - } - - var newRecords = dataSource.Records!.Select(record => new Record - { - Id = Guid.NewGuid(), - Code = record.Code, - Desc1 = record.Desc1, - Value1 = record.Value1, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }) - .ToList(); - - if (isNew) - { - db.Layers.Add(processedLayer); - } else - { - db.Layers.Update(processedLayer); - } - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } - -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t4.r2.processor.cs b/WebAPI/dataProcessors/t4.r2.processor.cs deleted file mode 100644 index 382cfee..0000000 --- a/WebAPI/dataProcessors/t4.r2.processor.cs +++ /dev/null @@ -1,358 +0,0 @@ -using System.Globalization; -using DiunaBIWebAPI.dataProcessors; -using Google.Apis.Sheets.v4; -using Google.Apis.Sheets.v4.Data; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - - -namespace WebAPI.dataProcessors; - -public class T4R2Processor( - AppDbContext db, - LayersController controller, - LogsController logsController, - SpreadsheetsResource.ValuesResource googleSheetValues) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList(); - if (sources!.Count == 0) - { - throw new Exception("Source record not found"); - } - - var layerName = processWorker.Records?.SingleOrDefault(x => x.Code == "LayerName")?.Desc1; - if (layerName == null) - { - throw new Exception("LayerName record not found"); - } - - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-{layerName}"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - - var newRecords = new List(); - - foreach (var source in sources) - { - var rawSourceCodes = processWorker.Records?.SingleOrDefault(x => x.Code == $"Codes-{source.Desc1}") - ?.Desc1; - var sourceCodes = new List(); - if (rawSourceCodes != null) - { - sourceCodes = ProcessHelper.ParseCodes(rawSourceCodes); - } - - List lastSourceCodes = []; - - for (var month = 1; month <= 12; month++) - { - if ((year == DateTime.UtcNow.Year && month <= DateTime.UtcNow.Month) || year < DateTime.UtcNow.Year) - { - var monthCopy = month; - var dataSource = db.Layers.Where(x => - x.Type == LayerType.Processed && - !x.IsDeleted && !x.IsCancelled && - x.Name != null && x.Name.Contains($"{year}/{monthCopy:D2}-{source.Desc1}-T") - ) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - if (dataSource != null) - { - lastSourceCodes = dataSource.Records!.Select(x => x.Code!).ToList(); - var news = dataSource.Records! - .Where(x => sourceCodes.Count <= 0 || sourceCodes.Contains(int.Parse(x.Code!))) - .Select(x => - { - var newRecord = new Record - { - Id = Guid.NewGuid(), - Code = $"{x.Code}{month:D2}", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - Value1 = source.Desc1 != "FK2" ? x.Value32 : x.Value1, - Desc1 = x.Desc1 - }; - return newRecord; - } - ).ToList(); - newRecords.AddRange(news); - } - else - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Data source {year}/{month:D2}-{source.Desc1}-T3 not found", - CreatedAt = DateTime.UtcNow - }); - } - } - else - { - //0 values for future months - if (source.Desc1 == "FK2" || lastSourceCodes.Count <= 0) continue; - var news = lastSourceCodes - .Where(x => sourceCodes.Contains(int.Parse(x))) - .Select(x => - { - var newRecord = new Record - { - Id = Guid.NewGuid(), - Code = $"{x}{month:D2}", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - Value1 = 0, - }; - return newRecord; - } - ).ToList(); - newRecords.AddRange(news); - } - } - - // year summary - var dataSourceSum = db.Layers.Where(x => - x.Type == LayerType.Processed && - !x.IsDeleted && !x.IsCancelled && - x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T") - ) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - if (dataSourceSum != null) - { - var news = dataSourceSum.Records! - .Where(x => sourceCodes.Count <= 0 || sourceCodes.Contains(int.Parse(x.Code!))) - .Select(x => - { - var newRecord = new Record - { - Id = Guid.NewGuid(), - Code = $"{x.Code}13", - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow, - Value1 = x.Value32 - }; - return newRecord; - } - ).ToList(); - newRecords.AddRange(news); - } - else - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker.Name}, {processWorker.Id}", - Type = LogEntryType.Warning, - LogType = LogType.Process, - Message = $"Data source {year}/13-{source.Desc1}-T3 not found", - CreatedAt = DateTime.UtcNow - }); - } - } - - if (isNew) - { - db.Layers.Add(processedLayer); - } - else - { - db.Layers.Update(processedLayer); - } - - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - - var reportSheetName = processWorker.Records?.SingleOrDefault(x => x.Code == "GoogleSheetName")?.Desc1; - if (reportSheetName == null) - { - throw new Exception("GoogleSheetName record not found"); - } - - var invoicesSheetName = processWorker.Records?.SingleOrDefault(x => x.Code == "GoogleSheetName-Invoices")?.Desc1; - if (invoicesSheetName == null) - { - throw new Exception("GoogleSheetName-Invoices record not found"); - } - UpdateReport(processedLayer.Id, reportSheetName, invoicesSheetName); - } - - private void UpdateReport(Guid sourceId, string reportSheetName, string invoicesSheetName) - { - const string sheetId = "1FsUmk_YRIeeGzFCX9tuUJCaLyRtjutX2ZGAEU1DMfJQ"; - var request = googleSheetValues.Get(sheetId, "C4:Z4"); - var response = request.Execute(); - - var r2 = db.Layers - .Where(x => x.Id == sourceId && !x.IsDeleted && !x.IsCancelled) - .Include(x => x.Records) - .AsNoTracking() - .FirstOrDefault(); - - const int startRow = 6; - - var codesRow = response.Values[0]; - for (var i = 1; i <= 12; i++) - { - var values = new List(); - var month = i < 10 ? $"0{i}" : i.ToString(); - var row = (startRow + i).ToString(); - foreach (string code in codesRow) - { - var record = r2!.Records?.SingleOrDefault(x => x.Code == $"{code}{month}"); - if (record != null) - { - values.Add(record.Value1!.Value); - } - else - { - values.Add("0"); - } - } - var valueRange = new ValueRange - { - Values = new List> { values } - }; - var update = googleSheetValues.Update(valueRange, sheetId, $"{reportSheetName}!C{row}:XZ{row}"); - update.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - update.Execute(); - } - - // sum - var valuesSum = new List(); - var emptyRow = new List(); - var rowEmpty = (startRow + 13).ToString(); - var rowSum = (startRow + 14).ToString(); - foreach (string code in codesRow) - { - var record = r2!.Records?.SingleOrDefault(x => x.Code == $"{code}13"); - emptyRow.Add(""); - if (record != null) - { - valuesSum.Add(record.Value1!.Value); - } - else - { - valuesSum.Add("0"); - } - } - // insert empty row before sum - var valueRangeEmpty = new ValueRange - { - Values = new List> { emptyRow } - }; - var updateEmpty = googleSheetValues.Update(valueRangeEmpty, sheetId, $"{reportSheetName}!C{rowEmpty}:XZ{rowEmpty}"); - updateEmpty.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateEmpty.Execute(); - - var valueRangeSum = new ValueRange - { - Values = new List> { valuesSum } - }; - var updateSum = googleSheetValues.Update(valueRangeSum, sheetId, $"{reportSheetName}!C{rowSum}:XZ{rowSum}"); - updateSum.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateSum.Execute(); - - // update time - var timeUtc = new List - { - r2!.ModifiedAt.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL")) - }; - var valueRangeUtcTime = new ValueRange - { - Values = new List> { timeUtc } - }; - var updateTimeUtc = googleSheetValues.Update(valueRangeUtcTime, sheetId, $"{reportSheetName}!G1"); - updateTimeUtc.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateTimeUtc.Execute(); - - var warsawTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); - var warsawTime = TimeZoneInfo.ConvertTimeFromUtc(r2.ModifiedAt.ToUniversalTime(), warsawTimeZone); - var timeWarsaw = new List - { - warsawTime.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL")) - }; - var valueRangeWarsawTime = new ValueRange - { - Values = new List> { timeWarsaw } - }; - var updateTimeWarsaw = googleSheetValues.Update(valueRangeWarsawTime, sheetId, $"{reportSheetName}!G2"); - updateTimeWarsaw.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateTimeWarsaw.Execute(); - - //invoices - - var invoices = r2.Records!.Where(x => x.Code!.Length == 12) - .OrderByDescending(x => x.Code); - - var invoicesValues = new List>(); - var cleanUpValues = new List>(); - foreach (var invoice in invoices) - { - var invoiceDate = - DateTime.ParseExact(invoice.Code!.Substring(0, 8), "yyyyMMdd", CultureInfo.InvariantCulture) - .ToString("dd.MM.yyyy", CultureInfo.GetCultureInfo("pl-PL")); - var invoiceRow = new List - { - invoiceDate, - "", - invoice.Desc1!, - invoice.Value1! - }; - invoicesValues.Add(invoiceRow); - - var cleanupRow = new List - { - "", "", "", "" - }; - cleanUpValues.Add(cleanupRow); - } - - - var cleanupValueRange = new ValueRange { Values = cleanUpValues }; - var cleanupInvoices = googleSheetValues.Update(cleanupValueRange, sheetId, $"{invoicesSheetName}!A6:E"); - cleanupInvoices.ValueInputOption = - SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - cleanupInvoices.Execute(); - - - var invoicesValueRange = new ValueRange { Values = invoicesValues }; - var updateInvoices = googleSheetValues.Update(invoicesValueRange, sheetId, $"{invoicesSheetName}!A6:E"); - updateInvoices.ValueInputOption = - SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED; - updateInvoices.Execute(); - - } -} \ No newline at end of file diff --git a/WebAPI/dataProcessors/t5.LastValues.processor.cs b/WebAPI/dataProcessors/t5.LastValues.processor.cs deleted file mode 100644 index db54119..0000000 --- a/WebAPI/dataProcessors/t5.LastValues.processor.cs +++ /dev/null @@ -1,95 +0,0 @@ -using DiunaBIWebAPI.dataProcessors; -using Microsoft.EntityFrameworkCore; -using WebAPI.Controllers; -using WebAPI.Models; - -namespace WebAPI.dataProcessors; - -public class T5LastValuesProcessor( - AppDbContext db, - LayersController controller) -{ - public void Process(Layer processWorker) - { - var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!); - var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!); - var sourceLayer = processWorker.Records?.SingleOrDefault(x => x.Code == "SourceLayer")?.Desc1; - if (sourceLayer == null) throw new Exception("SourceLayer record not found"); - var sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == sourceLayer && !x.IsDeleted && !x.IsCancelled); - if (sourceImportWorker == null) throw new Exception("SourceImportWorker layer not found"); - var source = processWorker.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1; - if (sourceLayer == null) throw new Exception("Source record not found"); - - var processedLayer = db.Layers - .Where(x => x.ParentId == processWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefault(); - - var isNew = false; - if (processedLayer == null) - { - isNew = true; - processedLayer = new Layer - { - Id = Guid.NewGuid(), - Type = LayerType.Processed, - ParentId = processWorker.Id, - Number = db.Layers.Count() + 1 - }; - processedLayer.Name = $"L{processedLayer.Number}-P-{year}/{month:D2}-{source}-T5"; - processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.CreatedAt = DateTime.UtcNow; - processedLayer.ModifiedAt = DateTime.UtcNow; - } - - processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"); - processedLayer.ModifiedAt = DateTime.UtcNow; - - var newRecords = new List(); - - var dataSources = db.Layers - .Include(x => x.Records) - .Where(x => x.ParentId == sourceImportWorker.Id - && !x.IsDeleted && !x.IsCancelled) - .OrderByDescending(x => x.CreatedAt) - .AsNoTracking() - .ToList(); - - if (dataSources.Count == 0) throw new Exception($"DataSource is empty, {sourceImportWorker.Name}"); - - var codes = dataSources.SelectMany(x => x.Records!).Select(x => x.Code).Distinct().ToList(); - - foreach (var code in codes) - { - var lastRecord = dataSources.SelectMany(x => x.Records!).Where(x => x.Code == code).OrderByDescending(x => x.CreatedAt).FirstOrDefault(); - if (lastRecord == null) continue; - - var processedRecord = new Record - { - Id = Guid.NewGuid(), - Code = code, - CreatedAt = DateTime.UtcNow, - ModifiedAt = DateTime.UtcNow - }; - - for (var i = 1; i < 33; i++) - { - if (ProcessHelper.GetValue(lastRecord, i) != null) - { - ProcessHelper.SetValue(processedRecord, i, ProcessHelper.GetValue(lastRecord, i)); - } - } - - newRecords.Add(processedRecord); - } - - if (isNew) - db.Layers.Add(processedLayer); - else - db.Layers.Update(processedLayer); - controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D")); - db.SaveChanges(); - } -} \ No newline at end of file diff --git a/WebAPI/diunabi-admin-firebase.json b/WebAPI/diunabi-admin-firebase.json deleted file mode 100644 index a27955f..0000000 --- a/WebAPI/diunabi-admin-firebase.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "type": "service_account", - "project_id": "#{firebase-project-id}#", - "private_key_id": "#{firebase-private-key-id}#", - "private_key": "#{firebase-private-key}#", - "client_email": "#{firebase-client-email}#", - "client_id": "#{firebase-client-id}#", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "#{firebase-client-cert-url}#", - "universe_domain": "googleapis.com" -} diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 24011af..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,81 +0,0 @@ -# ASP.NET -# Build and test ASP.NET projects. -# Add steps that publish symbols, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 - -trigger: -- deploy - -pool: - vmImage: 'ubuntu-latest' - -variables: - buildConfiguration: 'Release' - targetRuntime: 'linux-x64' - selfContained: false - dotNetFramework: 'net9.0' - dotNetVersion: '9.0.x' - buildId: $(Build.BuildNumber) - -steps: -# Start: Build WebAPI -- task: UseDotNet@2 - inputs: - version: $(dotNetVersion) -- script: dotnet build --configuration $(buildConfiguration) "WebAPI/DiunaBI-WebAPI.csproj" - displayName: 'Build .NET 8 Application' - -- task: DotNetCoreCLI@2 - displayName: 'dotnet publish $(buildConfiguration)' - inputs: - command: publish - publishWebProjects: True - arguments: '--configuration $(BuildConfiguration) --framework $(dotNetFramework) --runtime $(targetRuntime) --self-contained $(selfContained) --output $(Build.ArtifactStagingDirectory)' - workingDirectory: 'WebAPI' - zipAfterPublish: False -- task: DeleteFiles@1 - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/WebAPI' - Contents: | - appsettings.Development.json - client_secrets.Development.json -# End: Build WebAPI -# Start: Build Frontend -- task: NodeTool@0 - inputs: - versionSpec: '18.x' - displayName: 'Install Node.js' -- script: | - npm install -g @angular/cli - npm install -g yarn - yarn install - ng config --global cli.packageManager yarn - ng build --configuration production - workingDirectory: 'Frontend' - displayName: 'npm install and build' -- task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.Repository.LocalPath)/Frontend/dist/diunaBI/browser' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Frontend' -- task: replacetokens@5 - inputs: - rootDirectory: '$(Build.ArtifactStagingDirectory)/Frontend' - targetFiles: '**/*.js' - encoding: 'auto' - tokenPattern: 'default' - writeBOM: true - actionOnMissing: 'warn' - keepToken: true - actionOnNoFiles: 'warn' - enableTransforms: false - enableRecursion: false - useLegacyPattern: false - enableTelemetry: true -# End: Build Frontend -# Publish results -- task: PublishBuildArtifacts@1 - displayName: 'publish artifacts' - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - diff --git a/Deployment/dev.service b/deploy/dev.service similarity index 100% rename from Deployment/dev.service rename to deploy/dev.service diff --git a/Deployment/morska.service b/deploy/morska.service similarity index 100% rename from Deployment/morska.service rename to deploy/morska.service diff --git a/Deployment/staging.service b/deploy/staging.service similarity index 100% rename from Deployment/staging.service rename to deploy/staging.service diff --git a/Deployment/updateSWHash.sh b/deploy/updateSWHash.sh similarity index 100% rename from Deployment/updateSWHash.sh rename to deploy/updateSWHash.sh diff --git a/global.json b/global.json deleted file mode 100644 index a27a2b8..0000000 --- a/global.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sdk": { - "version": "9.0.0", - "rollForward": "latestMajor", - "allowPrerelease": false - } -} \ No newline at end of file diff --git a/Frontend/.editorconfig b/src/Frontend/.editorconfig similarity index 100% rename from Frontend/.editorconfig rename to src/Frontend/.editorconfig diff --git a/Frontend/.eslintrc.json b/src/Frontend/.eslintrc.json similarity index 100% rename from Frontend/.eslintrc.json rename to src/Frontend/.eslintrc.json diff --git a/Frontend/.gitignore b/src/Frontend/.gitignore similarity index 100% rename from Frontend/.gitignore rename to src/Frontend/.gitignore diff --git a/Frontend/README.md b/src/Frontend/README.md similarity index 100% rename from Frontend/README.md rename to src/Frontend/README.md diff --git a/Frontend/angular.json b/src/Frontend/angular.json similarity index 100% rename from Frontend/angular.json rename to src/Frontend/angular.json diff --git a/Frontend/karma.conf.js b/src/Frontend/karma.conf.js similarity index 100% rename from Frontend/karma.conf.js rename to src/Frontend/karma.conf.js diff --git a/Frontend/ngsw-config.json b/src/Frontend/ngsw-config.json similarity index 100% rename from Frontend/ngsw-config.json rename to src/Frontend/ngsw-config.json diff --git a/Frontend/package.json b/src/Frontend/package.json similarity index 100% rename from Frontend/package.json rename to src/Frontend/package.json diff --git a/Frontend/src/app/app.component.html b/src/Frontend/src/app/app.component.html similarity index 100% rename from Frontend/src/app/app.component.html rename to src/Frontend/src/app/app.component.html diff --git a/Frontend/src/app/app.component.scss b/src/Frontend/src/app/app.component.scss similarity index 100% rename from Frontend/src/app/app.component.scss rename to src/Frontend/src/app/app.component.scss diff --git a/Frontend/src/app/app.component.ts b/src/Frontend/src/app/app.component.ts similarity index 100% rename from Frontend/src/app/app.component.ts rename to src/Frontend/src/app/app.component.ts diff --git a/Frontend/src/app/app.routes.ts b/src/Frontend/src/app/app.routes.ts similarity index 100% rename from Frontend/src/app/app.routes.ts rename to src/Frontend/src/app/app.routes.ts diff --git a/Frontend/src/app/auth/auth.guard.ts b/src/Frontend/src/app/auth/auth.guard.ts similarity index 100% rename from Frontend/src/app/auth/auth.guard.ts rename to src/Frontend/src/app/auth/auth.guard.ts diff --git a/Frontend/src/app/auth/auth.service.ts b/src/Frontend/src/app/auth/auth.service.ts similarity index 100% rename from Frontend/src/app/auth/auth.service.ts rename to src/Frontend/src/app/auth/auth.service.ts diff --git a/Frontend/src/app/components/main-menu/main-menu.component.html b/src/Frontend/src/app/components/main-menu/main-menu.component.html similarity index 100% rename from Frontend/src/app/components/main-menu/main-menu.component.html rename to src/Frontend/src/app/components/main-menu/main-menu.component.html diff --git a/Frontend/src/app/components/main-menu/main-menu.component.scss b/src/Frontend/src/app/components/main-menu/main-menu.component.scss similarity index 100% rename from Frontend/src/app/components/main-menu/main-menu.component.scss rename to src/Frontend/src/app/components/main-menu/main-menu.component.scss diff --git a/Frontend/src/app/components/main-menu/main-menu.component.ts b/src/Frontend/src/app/components/main-menu/main-menu.component.ts similarity index 100% rename from Frontend/src/app/components/main-menu/main-menu.component.ts rename to src/Frontend/src/app/components/main-menu/main-menu.component.ts diff --git a/Frontend/src/app/components/notifications/notifications.component.html b/src/Frontend/src/app/components/notifications/notifications.component.html similarity index 100% rename from Frontend/src/app/components/notifications/notifications.component.html rename to src/Frontend/src/app/components/notifications/notifications.component.html diff --git a/Frontend/src/app/components/notifications/notifications.component.scss b/src/Frontend/src/app/components/notifications/notifications.component.scss similarity index 100% rename from Frontend/src/app/components/notifications/notifications.component.scss rename to src/Frontend/src/app/components/notifications/notifications.component.scss diff --git a/Frontend/src/app/components/notifications/notifications.component.spec.ts b/src/Frontend/src/app/components/notifications/notifications.component.spec.ts similarity index 100% rename from Frontend/src/app/components/notifications/notifications.component.spec.ts rename to src/Frontend/src/app/components/notifications/notifications.component.spec.ts diff --git a/Frontend/src/app/components/notifications/notifications.component.ts b/src/Frontend/src/app/components/notifications/notifications.component.ts similarity index 100% rename from Frontend/src/app/components/notifications/notifications.component.ts rename to src/Frontend/src/app/components/notifications/notifications.component.ts diff --git a/Frontend/src/app/directives/scroll-end.directive.ts b/src/Frontend/src/app/directives/scroll-end.directive.ts similarity index 100% rename from Frontend/src/app/directives/scroll-end.directive.ts rename to src/Frontend/src/app/directives/scroll-end.directive.ts diff --git a/Frontend/src/app/interceptors/auth.interceptor.ts b/src/Frontend/src/app/interceptors/auth.interceptor.ts similarity index 100% rename from Frontend/src/app/interceptors/auth.interceptor.ts rename to src/Frontend/src/app/interceptors/auth.interceptor.ts diff --git a/Frontend/src/app/interceptors/loader.interceptor.ts b/src/Frontend/src/app/interceptors/loader.interceptor.ts similarity index 100% rename from Frontend/src/app/interceptors/loader.interceptor.ts rename to src/Frontend/src/app/interceptors/loader.interceptor.ts diff --git a/Frontend/src/app/models/base.model.ts b/src/Frontend/src/app/models/base.model.ts similarity index 100% rename from Frontend/src/app/models/base.model.ts rename to src/Frontend/src/app/models/base.model.ts diff --git a/Frontend/src/app/models/deserializable.model.ts b/src/Frontend/src/app/models/deserializable.model.ts similarity index 100% rename from Frontend/src/app/models/deserializable.model.ts rename to src/Frontend/src/app/models/deserializable.model.ts diff --git a/Frontend/src/app/models/layer.model.ts b/src/Frontend/src/app/models/layer.model.ts similarity index 100% rename from Frontend/src/app/models/layer.model.ts rename to src/Frontend/src/app/models/layer.model.ts diff --git a/Frontend/src/app/models/record.model.ts b/src/Frontend/src/app/models/record.model.ts similarity index 100% rename from Frontend/src/app/models/record.model.ts rename to src/Frontend/src/app/models/record.model.ts diff --git a/Frontend/src/app/models/serializable.model.ts b/src/Frontend/src/app/models/serializable.model.ts similarity index 100% rename from Frontend/src/app/models/serializable.model.ts rename to src/Frontend/src/app/models/serializable.model.ts diff --git a/Frontend/src/app/models/user.model.ts b/src/Frontend/src/app/models/user.model.ts similarity index 100% rename from Frontend/src/app/models/user.model.ts rename to src/Frontend/src/app/models/user.model.ts diff --git a/Frontend/src/app/modules/dashboard/board/board.component.html b/src/Frontend/src/app/modules/dashboard/board/board.component.html similarity index 100% rename from Frontend/src/app/modules/dashboard/board/board.component.html rename to src/Frontend/src/app/modules/dashboard/board/board.component.html diff --git a/Frontend/src/app/modules/dashboard/board/board.component.scss b/src/Frontend/src/app/modules/dashboard/board/board.component.scss similarity index 100% rename from Frontend/src/app/modules/dashboard/board/board.component.scss rename to src/Frontend/src/app/modules/dashboard/board/board.component.scss diff --git a/Frontend/src/app/modules/dashboard/board/board.component.ts b/src/Frontend/src/app/modules/dashboard/board/board.component.ts similarity index 100% rename from Frontend/src/app/modules/dashboard/board/board.component.ts rename to src/Frontend/src/app/modules/dashboard/board/board.component.ts diff --git a/Frontend/src/app/modules/dashboard/dashboard.routes.ts b/src/Frontend/src/app/modules/dashboard/dashboard.routes.ts similarity index 100% rename from Frontend/src/app/modules/dashboard/dashboard.routes.ts rename to src/Frontend/src/app/modules/dashboard/dashboard.routes.ts diff --git a/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.html b/src/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.html similarity index 100% rename from Frontend/src/app/modules/layers/layer-detail/layer-detail.component.html rename to src/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.html diff --git a/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.scss b/src/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.scss similarity index 100% rename from Frontend/src/app/modules/layers/layer-detail/layer-detail.component.scss rename to src/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.scss diff --git a/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.ts b/src/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.ts similarity index 100% rename from Frontend/src/app/modules/layers/layer-detail/layer-detail.component.ts rename to src/Frontend/src/app/modules/layers/layer-detail/layer-detail.component.ts diff --git a/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.html b/src/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.html similarity index 100% rename from Frontend/src/app/modules/layers/layer-edit/layer-edit.component.html rename to src/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.html diff --git a/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.scss b/src/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.scss similarity index 100% rename from Frontend/src/app/modules/layers/layer-edit/layer-edit.component.scss rename to src/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.scss diff --git a/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.ts b/src/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.ts similarity index 100% rename from Frontend/src/app/modules/layers/layer-edit/layer-edit.component.ts rename to src/Frontend/src/app/modules/layers/layer-edit/layer-edit.component.ts diff --git a/Frontend/src/app/modules/layers/layers-list/layers-list.component.html b/src/Frontend/src/app/modules/layers/layers-list/layers-list.component.html similarity index 100% rename from Frontend/src/app/modules/layers/layers-list/layers-list.component.html rename to src/Frontend/src/app/modules/layers/layers-list/layers-list.component.html diff --git a/Frontend/src/app/modules/layers/layers-list/layers-list.component.scss b/src/Frontend/src/app/modules/layers/layers-list/layers-list.component.scss similarity index 100% rename from Frontend/src/app/modules/layers/layers-list/layers-list.component.scss rename to src/Frontend/src/app/modules/layers/layers-list/layers-list.component.scss diff --git a/Frontend/src/app/modules/layers/layers-list/layers-list.component.ts b/src/Frontend/src/app/modules/layers/layers-list/layers-list.component.ts similarity index 100% rename from Frontend/src/app/modules/layers/layers-list/layers-list.component.ts rename to src/Frontend/src/app/modules/layers/layers-list/layers-list.component.ts diff --git a/Frontend/src/app/modules/layers/layers.routes.ts b/src/Frontend/src/app/modules/layers/layers.routes.ts similarity index 100% rename from Frontend/src/app/modules/layers/layers.routes.ts rename to src/Frontend/src/app/modules/layers/layers.routes.ts diff --git a/Frontend/src/app/services/data.service.ts b/src/Frontend/src/app/services/data.service.ts similarity index 100% rename from Frontend/src/app/services/data.service.ts rename to src/Frontend/src/app/services/data.service.ts diff --git a/Frontend/src/app/services/device.service.ts b/src/Frontend/src/app/services/device.service.ts similarity index 100% rename from Frontend/src/app/services/device.service.ts rename to src/Frontend/src/app/services/device.service.ts diff --git a/Frontend/src/app/services/notifications.service.ts b/src/Frontend/src/app/services/notifications.service.ts similarity index 100% rename from Frontend/src/app/services/notifications.service.ts rename to src/Frontend/src/app/services/notifications.service.ts diff --git a/Frontend/src/app/views/login/login-view.component.html b/src/Frontend/src/app/views/login/login-view.component.html similarity index 100% rename from Frontend/src/app/views/login/login-view.component.html rename to src/Frontend/src/app/views/login/login-view.component.html diff --git a/Frontend/src/app/views/login/login-view.component.scss b/src/Frontend/src/app/views/login/login-view.component.scss similarity index 100% rename from Frontend/src/app/views/login/login-view.component.scss rename to src/Frontend/src/app/views/login/login-view.component.scss diff --git a/Frontend/src/app/views/login/login-view.component.ts b/src/Frontend/src/app/views/login/login-view.component.ts similarity index 100% rename from Frontend/src/app/views/login/login-view.component.ts rename to src/Frontend/src/app/views/login/login-view.component.ts diff --git a/Frontend/src/app/views/main/main-view.component.html b/src/Frontend/src/app/views/main/main-view.component.html similarity index 100% rename from Frontend/src/app/views/main/main-view.component.html rename to src/Frontend/src/app/views/main/main-view.component.html diff --git a/Frontend/src/app/views/main/main-view.component.scss b/src/Frontend/src/app/views/main/main-view.component.scss similarity index 100% rename from Frontend/src/app/views/main/main-view.component.scss rename to src/Frontend/src/app/views/main/main-view.component.scss diff --git a/Frontend/src/app/views/main/main-view.component.ts b/src/Frontend/src/app/views/main/main-view.component.ts similarity index 100% rename from Frontend/src/app/views/main/main-view.component.ts rename to src/Frontend/src/app/views/main/main-view.component.ts diff --git a/Frontend/src/assets/.gitkeep b/src/Frontend/src/assets/.gitkeep similarity index 100% rename from Frontend/src/assets/.gitkeep rename to src/Frontend/src/assets/.gitkeep diff --git a/Frontend/src/assets/bg.jpg b/src/Frontend/src/assets/bg.jpg similarity index 100% rename from Frontend/src/assets/bg.jpg rename to src/Frontend/src/assets/bg.jpg diff --git a/Frontend/src/assets/icons/icon-128x128.png b/src/Frontend/src/assets/icons/icon-128x128.png similarity index 100% rename from Frontend/src/assets/icons/icon-128x128.png rename to src/Frontend/src/assets/icons/icon-128x128.png diff --git a/Frontend/src/assets/icons/icon-144x144.png b/src/Frontend/src/assets/icons/icon-144x144.png similarity index 100% rename from Frontend/src/assets/icons/icon-144x144.png rename to src/Frontend/src/assets/icons/icon-144x144.png diff --git a/Frontend/src/assets/icons/icon-152x152.png b/src/Frontend/src/assets/icons/icon-152x152.png similarity index 100% rename from Frontend/src/assets/icons/icon-152x152.png rename to src/Frontend/src/assets/icons/icon-152x152.png diff --git a/Frontend/src/assets/icons/icon-192x192.png b/src/Frontend/src/assets/icons/icon-192x192.png similarity index 100% rename from Frontend/src/assets/icons/icon-192x192.png rename to src/Frontend/src/assets/icons/icon-192x192.png diff --git a/Frontend/src/assets/icons/icon-384x384.png b/src/Frontend/src/assets/icons/icon-384x384.png similarity index 100% rename from Frontend/src/assets/icons/icon-384x384.png rename to src/Frontend/src/assets/icons/icon-384x384.png diff --git a/Frontend/src/assets/icons/icon-48x48.png b/src/Frontend/src/assets/icons/icon-48x48.png similarity index 100% rename from Frontend/src/assets/icons/icon-48x48.png rename to src/Frontend/src/assets/icons/icon-48x48.png diff --git a/Frontend/src/assets/icons/icon-512x512.png b/src/Frontend/src/assets/icons/icon-512x512.png similarity index 100% rename from Frontend/src/assets/icons/icon-512x512.png rename to src/Frontend/src/assets/icons/icon-512x512.png diff --git a/Frontend/src/assets/icons/icon-72x72.png b/src/Frontend/src/assets/icons/icon-72x72.png similarity index 100% rename from Frontend/src/assets/icons/icon-72x72.png rename to src/Frontend/src/assets/icons/icon-72x72.png diff --git a/Frontend/src/assets/icons/icon-96x96.png b/src/Frontend/src/assets/icons/icon-96x96.png similarity index 100% rename from Frontend/src/assets/icons/icon-96x96.png rename to src/Frontend/src/assets/icons/icon-96x96.png diff --git a/Frontend/src/assets/loader.gif b/src/Frontend/src/assets/loader.gif similarity index 100% rename from Frontend/src/assets/loader.gif rename to src/Frontend/src/assets/loader.gif diff --git a/Frontend/src/assets/logo.png b/src/Frontend/src/assets/logo.png similarity index 100% rename from Frontend/src/assets/logo.png rename to src/Frontend/src/assets/logo.png diff --git a/Frontend/src/environments/environment.prod.ts b/src/Frontend/src/environments/environment.prod.ts similarity index 100% rename from Frontend/src/environments/environment.prod.ts rename to src/Frontend/src/environments/environment.prod.ts diff --git a/Frontend/src/environments/environment.ts b/src/Frontend/src/environments/environment.ts similarity index 100% rename from Frontend/src/environments/environment.ts rename to src/Frontend/src/environments/environment.ts diff --git a/Frontend/src/favicon.ico b/src/Frontend/src/favicon.ico similarity index 100% rename from Frontend/src/favicon.ico rename to src/Frontend/src/favicon.ico diff --git a/Frontend/src/index.html b/src/Frontend/src/index.html similarity index 100% rename from Frontend/src/index.html rename to src/Frontend/src/index.html diff --git a/Frontend/src/main.ts b/src/Frontend/src/main.ts similarity index 100% rename from Frontend/src/main.ts rename to src/Frontend/src/main.ts diff --git a/Frontend/src/manifest.webmanifest b/src/Frontend/src/manifest.webmanifest similarity index 100% rename from Frontend/src/manifest.webmanifest rename to src/Frontend/src/manifest.webmanifest diff --git a/Frontend/src/polyfills.ts b/src/Frontend/src/polyfills.ts similarity index 100% rename from Frontend/src/polyfills.ts rename to src/Frontend/src/polyfills.ts diff --git a/Frontend/src/styles.scss b/src/Frontend/src/styles.scss similarity index 100% rename from Frontend/src/styles.scss rename to src/Frontend/src/styles.scss diff --git a/Frontend/src/test.ts b/src/Frontend/src/test.ts similarity index 100% rename from Frontend/src/test.ts rename to src/Frontend/src/test.ts diff --git a/Frontend/tsconfig.app.json b/src/Frontend/tsconfig.app.json similarity index 100% rename from Frontend/tsconfig.app.json rename to src/Frontend/tsconfig.app.json diff --git a/Frontend/tsconfig.json b/src/Frontend/tsconfig.json similarity index 100% rename from Frontend/tsconfig.json rename to src/Frontend/tsconfig.json diff --git a/Frontend/tsconfig.spec.json b/src/Frontend/tsconfig.spec.json similarity index 100% rename from Frontend/tsconfig.spec.json rename to src/Frontend/tsconfig.spec.json diff --git a/Frontend/yarn.lock b/src/Frontend/yarn.lock similarity index 100% rename from Frontend/yarn.lock rename to src/Frontend/yarn.lock diff --git a/WebAPI/Helpers/HttpRequests/AddDataInbox.http b/tools/http-tests/AddDataInbox.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/AddDataInbox.http rename to tools/http-tests/AddDataInbox.http diff --git a/WebAPI/Helpers/HttpRequests/AddDataInboxProd.http b/tools/http-tests/AddDataInboxProd.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/AddDataInboxProd.http rename to tools/http-tests/AddDataInboxProd.http diff --git a/WebAPI/Helpers/HttpRequests/AddToQueue.http b/tools/http-tests/AddToQueue.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/AddToQueue.http rename to tools/http-tests/AddToQueue.http diff --git a/WebAPI/Helpers/HttpRequests/AutoImport.http b/tools/http-tests/AutoImport.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/AutoImport.http rename to tools/http-tests/AutoImport.http diff --git a/WebAPI/Helpers/HttpRequests/AutoProcess.http b/tools/http-tests/AutoProcess.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/AutoProcess.http rename to tools/http-tests/AutoProcess.http diff --git a/WebAPI/Helpers/HttpRequests/BackupDatabase.http b/tools/http-tests/BackupDatabase.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/BackupDatabase.http rename to tools/http-tests/BackupDatabase.http diff --git a/WebAPI/Helpers/HttpRequests/CMMorska-Pacjenci.http b/tools/http-tests/CMMorska-Pacjenci.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/CMMorska-Pacjenci.http rename to tools/http-tests/CMMorska-Pacjenci.http diff --git a/WebAPI/Helpers/HttpRequests/DiunaBI-endpoints_2.http b/tools/http-tests/DiunaBI-endpoints_2.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/DiunaBI-endpoints_2.http rename to tools/http-tests/DiunaBI-endpoints_2.http diff --git a/WebAPI/Helpers/HttpRequests/GetQueue.http b/tools/http-tests/GetQueue.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/GetQueue.http rename to tools/http-tests/GetQueue.http diff --git a/WebAPI/Helpers/HttpRequests/ProcessQueue.http b/tools/http-tests/ProcessQueue.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/ProcessQueue.http rename to tools/http-tests/ProcessQueue.http diff --git a/WebAPI/Helpers/HttpRequests/getForPowerBI.http b/tools/http-tests/getForPowerBI.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/getForPowerBI.http rename to tools/http-tests/getForPowerBI.http diff --git a/WebAPI/Helpers/HttpRequests/getMorskaClients.http b/tools/http-tests/getMorskaClients.http similarity index 100% rename from WebAPI/Helpers/HttpRequests/getMorskaClients.http rename to tools/http-tests/getMorskaClients.http diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/CreateDataInboxImportWorker .sql b/tools/sql-scripts/admin-monthly/CreateDataInboxImportWorker .sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/CreateDataInboxImportWorker .sql rename to tools/sql-scripts/admin-monthly/CreateDataInboxImportWorker .sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/CreateImportWorker.sql b/tools/sql-scripts/admin-monthly/CreateImportWorker.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/CreateImportWorker.sql rename to tools/sql-scripts/admin-monthly/CreateImportWorker.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T3MultiSourceSummary-AA.sql b/tools/sql-scripts/admin-monthly/CreateProcessWorker-T3MultiSourceSummary-AA.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T3MultiSourceSummary-AA.sql rename to tools/sql-scripts/admin-monthly/CreateProcessWorker-T3MultiSourceSummary-AA.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T3SingleSource.sql b/tools/sql-scripts/admin-monthly/CreateProcessWorker-T3SingleSource.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T3SingleSource.sql rename to tools/sql-scripts/admin-monthly/CreateProcessWorker-T3SingleSource.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T4SingleSource.sql b/tools/sql-scripts/admin-monthly/CreateProcessWorker-T4SingleSource.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T4SingleSource.sql rename to tools/sql-scripts/admin-monthly/CreateProcessWorker-T4SingleSource.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T5LastValue.sql b/tools/sql-scripts/admin-monthly/CreateProcessWorker-T5LastValue.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/CreateProcessWorker-T5LastValue.sql rename to tools/sql-scripts/admin-monthly/CreateProcessWorker-T5LastValue.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/Depracated-CreateImportWorkerD1.sql b/tools/sql-scripts/admin-monthly/Depracated-CreateImportWorkerD1.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/Depracated-CreateImportWorkerD1.sql rename to tools/sql-scripts/admin-monthly/Depracated-CreateImportWorkerD1.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Monthly/Deprecated-CreateImportWorkerFK2.sql b/tools/sql-scripts/admin-monthly/Deprecated-CreateImportWorkerFK2.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Monthly/Deprecated-CreateImportWorkerFK2.sql rename to tools/sql-scripts/admin-monthly/Deprecated-CreateImportWorkerFK2.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T1-R1.sql b/tools/sql-scripts/admin-yearly/CreateProcessWorker-T1-R1.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T1-R1.sql rename to tools/sql-scripts/admin-yearly/CreateProcessWorker-T1-R1.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T1-R3.sql b/tools/sql-scripts/admin-yearly/CreateProcessWorker-T1-R3.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T1-R3.sql rename to tools/sql-scripts/admin-yearly/CreateProcessWorker-T1-R3.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T3MultiSourceYearSummary-AA.sql b/tools/sql-scripts/admin-yearly/CreateProcessWorker-T3MultiSourceYearSummary-AA.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T3MultiSourceYearSummary-AA.sql rename to tools/sql-scripts/admin-yearly/CreateProcessWorker-T3MultiSourceYearSummary-AA.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T3SourceYearSummary.sql b/tools/sql-scripts/admin-yearly/CreateProcessWorker-T3SourceYearSummary.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T3SourceYearSummary.sql rename to tools/sql-scripts/admin-yearly/CreateProcessWorker-T3SourceYearSummary.sql diff --git a/WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T4-R2.sql b/tools/sql-scripts/admin-yearly/CreateProcessWorker-T4-R2.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Admin-Yearly/CreateProcessWorker-T4-R2.sql rename to tools/sql-scripts/admin-yearly/CreateProcessWorker-T4-R2.sql diff --git a/WebAPI/Helpers/DbSeed/Utlis/CreateConfig.sql b/tools/sql-scripts/utlis/CreateConfig.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Utlis/CreateConfig.sql rename to tools/sql-scripts/utlis/CreateConfig.sql diff --git a/WebAPI/Helpers/DbSeed/Utlis/CreateDictionary.sql b/tools/sql-scripts/utlis/CreateDictionary.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Utlis/CreateDictionary.sql rename to tools/sql-scripts/utlis/CreateDictionary.sql diff --git a/WebAPI/Helpers/DbSeed/Utlis/CreateRecord.sql b/tools/sql-scripts/utlis/CreateRecord.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Utlis/CreateRecord.sql rename to tools/sql-scripts/utlis/CreateRecord.sql diff --git a/WebAPI/Helpers/DbSeed/Utlis/RemoveLayer.sql b/tools/sql-scripts/utlis/RemoveLayer.sql similarity index 100% rename from WebAPI/Helpers/DbSeed/Utlis/RemoveLayer.sql rename to tools/sql-scripts/utlis/RemoveLayer.sql