From d5498775677030fc8b72cbd01d44fc3ca392047c Mon Sep 17 00:00:00 2001 From: Alexandr Sulimov Date: Thu, 22 Jun 2023 10:01:27 +0300 Subject: [PATCH] refactoring --- MyOffice.Data.Models/Accounts/Account.cs | 2 +- .../Accounts/{AccountMotion.cs => Motion.cs} | 12 +- MyOffice.Data.Models/Items/Item.cs | 17 + MyOffice.Data.Models/Items/ItemCategory.cs | 12 + MyOffice.Data.Models/Items/ItemGlobal.cs | 8 + MyOffice.Data.Models/Motions/MotionAccount.cs | 13 - .../Motions/MotionCategory.cs | 12 - MyOffice.Data.Models/Motions/MotionGlobal.cs | 8 - MyOffice.Data.Models/Users/User.cs | 6 +- .../Account/AccountMotionRepository.cs | 24 - .../Account/IAccountMotionRepository.cs | 9 - .../Account/IMotionRepository.cs | 9 + .../Account/MotionRepository.cs | 24 + .../Item/IItemCategoryRepository.cs | 12 + .../Item/IItemGlobalRepository.cs | 10 + .../Item/IItemRepository.cs | 13 + .../Item/ItemCategoryRepository.cs | 37 ++ .../Item/ItemGlobalRepository.cs | 21 + .../Item/ItemRepository.cs | 46 ++ .../Motion/IMotionCategoryRepository.cs | 12 - .../Motion/IMotionGlobalRepository.cs | 10 - .../Motion/IMotionsRepository.cs | 13 - .../Motion/MotionCategoryRepository.cs | 37 -- .../Motion/MotionGlobalRepository.cs | 21 - .../Motion/MotionRepository.cs | 46 -- MyOffice.DbContext/AppDbContext.cs | 50 +- MyOffice.DbContext/RepositoryInitializer.cs | 2 +- .../AppDbContextFactoryPostgres.cs | 6 +- .../20230408172132_init.Designer.cs | 119 ---- .../Migrations/20230408172132_init.cs | 75 --- .../20230408172213_phone.Designer.cs | 122 ---- .../Migrations/20230408172213_phone.cs | 28 - .../20230429063332_Host.Designer.cs | 386 ----------- .../Migrations/20230429063332_Host.cs | 217 ------- .../20230429090658_user_currency.Designer.cs | 407 ------------ .../20230429090658_user_currency.cs | 61 -- ...30429092104_currency_shortname.Designer.cs | 403 ------------ .../20230429092104_currency_shortname.cs | 29 - ...0429092950_gcurrency_shortname.Designer.cs | 403 ------------ .../20230429092950_gcurrency_shortname.cs | 40 -- ...0230430103617_account_category.Designer.cs | 467 -------------- .../20230430103617_account_category.cs | 74 --- ...0230601100601_CurrencyQuantity.Designer.cs | 473 -------------- .../20230601100601_CurrencyQuantity.cs | 40 -- ...230601100833_CurrencyQuantity2.Designer.cs | 473 -------------- .../20230601100833_CurrencyQuantity2.cs | 40 -- ...230601121013_AccountCategories.Designer.cs | 491 -------------- .../20230601121013_AccountCategories.cs | 171 ----- ...609062452_AccountCategoriesFix.Designer.cs | 491 -------------- .../20230609062452_AccountCategoriesFix.cs | 66 -- .../20230611145152_Motion.Designer.cs | 606 ----------------- .../Migrations/20230611145152_Motion.cs | 213 ------ ...230614175616_MotionCategoryFix.Designer.cs | 609 ------------------ .../20230614175616_MotionCategoryFix.cs | 38 -- ...30614181358_MotionCategoryFix2.Designer.cs | 606 ----------------- .../20230614181358_MotionCategoryFix2.cs | 60 -- ...30614183224_MotionCategoryFix3.Designer.cs | 608 ----------------- .../20230614183224_MotionCategoryFix3.cs | 60 -- ...0230617113630_MotionAccountFix.Designer.cs | 533 --------------- .../20230617113630_MotionAccountFix.cs | 75 --- ...230617114210_MotionAccountFix2.Designer.cs | 606 ----------------- .../20230617114210_MotionAccountFix2.cs | 73 --- .../20230621082718_MotionPrec.Designer.cs | 607 ----------------- .../Migrations/20230621082718_MotionPrec.cs | 36 -- .../20230621083359_MotionPrec2.Designer.cs | 607 ----------------- .../Migrations/20230621083359_MotionPrec2.cs | 40 -- .../Migrations/20230621083446_MotionPrec3.cs | 38 -- ...ner.cs => 20230621190024_Init.Designer.cs} | 66 +- .../Migrations/20230621190024_Init.cs | 445 +++++++++++++ .../Migrations/AppDbContextModelSnapshot.cs | 62 +- .../AppDbContextFactorySqlite.cs | 6 +- .../20230408180122_init.Designer.cs | 111 ---- .../Migrations/20230408180122_init.cs | 71 -- .../20230408180149_phone.Designer.cs | 114 ---- .../Migrations/20230408180149_phone.cs | 28 - .../Migrations/AppDbContextModelSnapshot.cs | 111 ---- .../MyOffice.Migrations.Sqlite.csproj | 4 + MyOffice.SPA/src/app/api-routes.ts | 8 +- .../src/app/layout/sidebar/sidebar-items.ts | 8 +- ...tegory.model.ts => item.category.model.ts} | 2 +- .../model/{motion.model.ts => item.model.ts} | 2 +- .../src/app/pages/pages-routing.module.ts | 16 +- MyOffice.SPA/src/app/pages/pages.module.ts | 16 +- .../edit.item.component.html} | 2 +- .../edit.item.component.scss} | 0 .../edit.item.component.ts} | 31 +- .../item.category.component.html} | 0 .../item.category.component.scss} | 0 .../item.category.component.ts} | 28 +- .../item.component.html} | 4 +- .../item.component.scss} | 0 .../item.component.ts} | 42 +- MyOffice.SPA/src/app/services/item.service.ts | 34 + .../src/app/services/motion.service.ts | 35 - MyOffice.Services/Account/AccountService.cs | 90 +-- .../{AccountMotionAdd.cs => MotionAdd.cs} | 2 +- ...tMotionAddResult.cs => MotionAddResult.cs} | 2 +- .../Item/Domain/ItemCategoryRemoveResult.cs | 10 + .../MotionService.cs => Item/ItemService.cs} | 54 +- .../Domain/MotionCategoryRemoveResult.cs | 10 - MyOffice.Web/Controllers/AccountController.cs | 12 +- MyOffice.Web/Controllers/MotionController.cs | 127 ---- .../Controllers/SettingsAccountController.cs | 4 +- .../Controllers/SettingsItemController.cs | 126 ++++ .../Account/AccountCategoryViewModel.cs | 6 +- .../AccountMotionsGetModel.cs | 2 +- .../Models/Account/AccountViewModel.cs | 3 +- .../AccountMotion/AccountMotionViewModel.cs | 43 -- .../Models/Item/ItemCategoryViewModel.cs | 31 + .../ItemEditModel.cs} | 4 +- MyOffice.Web/Models/Item/ItemViewModel.cs | 33 + .../Models/Motion/AccountMotionViewModel.cs | 33 - .../Models/Motion/MotionCategoryViewModel.cs | 33 - MyOffice.Web/Models/Motion/MotionRequest.cs | 27 + MyOffice.Web/Models/Motion/MotionViewModel.cs | 32 +- MyOffice.Web/Program.cs | 12 +- 116 files changed, 1216 insertions(+), 11709 deletions(-) rename MyOffice.Data.Models/Accounts/{AccountMotion.cs => Motion.cs} (59%) create mode 100644 MyOffice.Data.Models/Items/Item.cs create mode 100644 MyOffice.Data.Models/Items/ItemCategory.cs create mode 100644 MyOffice.Data.Models/Items/ItemGlobal.cs delete mode 100644 MyOffice.Data.Models/Motions/MotionAccount.cs delete mode 100644 MyOffice.Data.Models/Motions/MotionCategory.cs delete mode 100644 MyOffice.Data.Models/Motions/MotionGlobal.cs delete mode 100644 MyOffice.Data.Repositories/Account/AccountMotionRepository.cs delete mode 100644 MyOffice.Data.Repositories/Account/IAccountMotionRepository.cs create mode 100644 MyOffice.Data.Repositories/Account/IMotionRepository.cs create mode 100644 MyOffice.Data.Repositories/Account/MotionRepository.cs create mode 100644 MyOffice.Data.Repositories/Item/IItemCategoryRepository.cs create mode 100644 MyOffice.Data.Repositories/Item/IItemGlobalRepository.cs create mode 100644 MyOffice.Data.Repositories/Item/IItemRepository.cs create mode 100644 MyOffice.Data.Repositories/Item/ItemCategoryRepository.cs create mode 100644 MyOffice.Data.Repositories/Item/ItemGlobalRepository.cs create mode 100644 MyOffice.Data.Repositories/Item/ItemRepository.cs delete mode 100644 MyOffice.Data.Repositories/Motion/IMotionCategoryRepository.cs delete mode 100644 MyOffice.Data.Repositories/Motion/IMotionGlobalRepository.cs delete mode 100644 MyOffice.Data.Repositories/Motion/IMotionsRepository.cs delete mode 100644 MyOffice.Data.Repositories/Motion/MotionCategoryRepository.cs delete mode 100644 MyOffice.Data.Repositories/Motion/MotionGlobalRepository.cs delete mode 100644 MyOffice.Data.Repositories/Motion/MotionRepository.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230408172132_init.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230408172132_init.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230408172213_phone.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230408172213_phone.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429063332_Host.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429063332_Host.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.Designer.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.cs delete mode 100644 MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.cs rename MyOffice.Migration.Postgres/Migrations/{20230621083446_MotionPrec3.Designer.cs => 20230621190024_Init.Designer.cs} (90%) create mode 100644 MyOffice.Migration.Postgres/Migrations/20230621190024_Init.cs delete mode 100644 MyOffice.Migration.Sqlite/Migrations/20230408180122_init.Designer.cs delete mode 100644 MyOffice.Migration.Sqlite/Migrations/20230408180122_init.cs delete mode 100644 MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.Designer.cs delete mode 100644 MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.cs delete mode 100644 MyOffice.Migration.Sqlite/Migrations/AppDbContextModelSnapshot.cs rename MyOffice.SPA/src/app/model/{motion.category.model.ts => item.category.model.ts} (58%) rename MyOffice.SPA/src/app/model/{motion.model.ts => item.model.ts} (75%) rename MyOffice.SPA/src/app/pages/settings/{motion/edit.motion.component.html => item/edit.item.component.html} (94%) rename MyOffice.SPA/src/app/pages/settings/{motion/edit.motion.component.scss => item/edit.item.component.scss} (100%) rename MyOffice.SPA/src/app/pages/settings/{motion/edit.motion.component.ts => item/edit.item.component.ts} (61%) rename MyOffice.SPA/src/app/pages/settings/{motion/motion.category.component.html => item/item.category.component.html} (100%) rename MyOffice.SPA/src/app/pages/settings/{motion/motion.category.component.scss => item/item.category.component.scss} (100%) rename MyOffice.SPA/src/app/pages/settings/{motion/motion.category.component.ts => item/item.category.component.ts} (71%) rename MyOffice.SPA/src/app/pages/settings/{motion/motion.component.html => item/item.component.html} (95%) rename MyOffice.SPA/src/app/pages/settings/{motion/motion.component.scss => item/item.component.scss} (100%) rename MyOffice.SPA/src/app/pages/settings/{motion/motion.component.ts => item/item.component.ts} (59%) create mode 100644 MyOffice.SPA/src/app/services/item.service.ts delete mode 100644 MyOffice.SPA/src/app/services/motion.service.ts rename MyOffice.Services/Account/Domain/{AccountMotionAdd.cs => MotionAdd.cs} (89%) rename MyOffice.Services/Account/Domain/{AccountMotionAddResult.cs => MotionAddResult.cs} (72%) create mode 100644 MyOffice.Services/Item/Domain/ItemCategoryRemoveResult.cs rename MyOffice.Services/{Motion/MotionService.cs => Item/ItemService.cs} (52%) delete mode 100644 MyOffice.Services/Motion/Domain/MotionCategoryRemoveResult.cs delete mode 100644 MyOffice.Web/Controllers/MotionController.cs create mode 100644 MyOffice.Web/Controllers/SettingsItemController.cs rename MyOffice.Web/Models/{Motion => Account}/AccountMotionsGetModel.cs (82%) delete mode 100644 MyOffice.Web/Models/AccountMotion/AccountMotionViewModel.cs create mode 100644 MyOffice.Web/Models/Item/ItemCategoryViewModel.cs rename MyOffice.Web/Models/{Motion/MotionEditModel.cs => Item/ItemEditModel.cs} (58%) create mode 100644 MyOffice.Web/Models/Item/ItemViewModel.cs delete mode 100644 MyOffice.Web/Models/Motion/AccountMotionViewModel.cs delete mode 100644 MyOffice.Web/Models/Motion/MotionCategoryViewModel.cs create mode 100644 MyOffice.Web/Models/Motion/MotionRequest.cs diff --git a/MyOffice.Data.Models/Accounts/Account.cs b/MyOffice.Data.Models/Accounts/Account.cs index cb5d404..5cd13b2 100644 --- a/MyOffice.Data.Models/Accounts/Account.cs +++ b/MyOffice.Data.Models/Accounts/Account.cs @@ -9,7 +9,7 @@ public class Account public CurrencyGlobal? CurrencyGlobal { get; set; } public string Name { get; set; } = null!; public IEnumerable? AccessRights { get; set; } - public IEnumerable? Motions { get; set; } + public IEnumerable? Motions { get; set; } public IEnumerable? Categories { get; set; } } diff --git a/MyOffice.Data.Models/Accounts/AccountMotion.cs b/MyOffice.Data.Models/Accounts/Motion.cs similarity index 59% rename from MyOffice.Data.Models/Accounts/AccountMotion.cs rename to MyOffice.Data.Models/Accounts/Motion.cs index 7540d79..eb6c53f 100644 --- a/MyOffice.Data.Models/Accounts/AccountMotion.cs +++ b/MyOffice.Data.Models/Accounts/Motion.cs @@ -1,16 +1,20 @@ namespace MyOffice.Data.Models.Accounts; -using MyOffice.Data.Models.Motions; +using Items; -public class AccountMotion +/// +/// Account motion +/// DateTime: 2023-01-01, Account: 'Debit card', Item.ItemGlobal: 'Primary salary', AmountPlus: 5000 +/// +public class Motion { public Guid Id { get; set; } public DateTime CreatedOn { get; set; } public DateTime DateTime { get; set; } - public int MotionId { get; set; } - public MotionAccount Motion { get; set; } = null!; public Guid AccountId { get; set; } public Account Account { get; set; } = null!; + public int ItemId { get; set; } + public Item Item { get; set; } = null!; public string? Description { get; set; } public decimal AmountPlus { get; set; } public decimal AmountMinus { get; set; } diff --git a/MyOffice.Data.Models/Items/Item.cs b/MyOffice.Data.Models/Items/Item.cs new file mode 100644 index 0000000..d36014b --- /dev/null +++ b/MyOffice.Data.Models/Items/Item.cs @@ -0,0 +1,17 @@ +namespace MyOffice.Data.Models.Items; + +using MyOffice.Data.Models.Accounts; + +/// +/// User 'Item' linked to global item +/// ItemGlobal: 'Primary salary', ItemCategory: 'Incomes' +/// +public class Item +{ + public int Id { get; set; } + public Guid CategoryId { get; set; } + public ItemCategory Category { get; set; } = null!; + public Guid ItemGlobalId { get; set; } + public ItemGlobal ItemGlobal { get; set; } = null!; + public IEnumerable Motions { get; set; } = null!; +} \ No newline at end of file diff --git a/MyOffice.Data.Models/Items/ItemCategory.cs b/MyOffice.Data.Models/Items/ItemCategory.cs new file mode 100644 index 0000000..2d79167 --- /dev/null +++ b/MyOffice.Data.Models/Items/ItemCategory.cs @@ -0,0 +1,12 @@ +namespace MyOffice.Data.Models.Items; + +using MyOffice.Data.Models.Users; + +public class ItemCategory +{ + public Guid Id { get; set; } + public Guid UserId { get; set; } + public User User { get; set; } = null!; + public string Name { get; set; } = null!; + public IEnumerable Items { get; set; } = null!; +} \ No newline at end of file diff --git a/MyOffice.Data.Models/Items/ItemGlobal.cs b/MyOffice.Data.Models/Items/ItemGlobal.cs new file mode 100644 index 0000000..420d19b --- /dev/null +++ b/MyOffice.Data.Models/Items/ItemGlobal.cs @@ -0,0 +1,8 @@ +namespace MyOffice.Data.Models.Items; + +public class ItemGlobal +{ + public Guid Id { get; set; } + public string Name { get; set; } = null!; + public IEnumerable Items { get; set; } = null!; +} \ No newline at end of file diff --git a/MyOffice.Data.Models/Motions/MotionAccount.cs b/MyOffice.Data.Models/Motions/MotionAccount.cs deleted file mode 100644 index de1f480..0000000 --- a/MyOffice.Data.Models/Motions/MotionAccount.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace MyOffice.Data.Models.Motions; - -using Accounts; - -public class MotionAccount -{ - public int Id { get; set; } - public Guid CategoryId { get; set; } - public MotionCategory Category { get; set; } = null!; - public Guid MotionGlobalId { get; set; } - public MotionGlobal MotionGlobal { get; set; } = null!; - public IEnumerable Motions { get; set; } = null!; -} \ No newline at end of file diff --git a/MyOffice.Data.Models/Motions/MotionCategory.cs b/MyOffice.Data.Models/Motions/MotionCategory.cs deleted file mode 100644 index c5d9119..0000000 --- a/MyOffice.Data.Models/Motions/MotionCategory.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace MyOffice.Data.Models.Motions; - -using Users; - -public class MotionCategory -{ - public Guid Id { get; set; } - public Guid UserId { get; set; } - public User User { get; set; } = null!; - public string Name { get; set; } = null!; - public IEnumerable Motions { get; set; } = null!; -} \ No newline at end of file diff --git a/MyOffice.Data.Models/Motions/MotionGlobal.cs b/MyOffice.Data.Models/Motions/MotionGlobal.cs deleted file mode 100644 index 8d72678..0000000 --- a/MyOffice.Data.Models/Motions/MotionGlobal.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace MyOffice.Data.Models.Motions; - -public class MotionGlobal -{ - public Guid Id { get; set; } - public string Name { get; set; } = null!; - public IEnumerable Motions { get; set; } = null!; -} \ No newline at end of file diff --git a/MyOffice.Data.Models/Users/User.cs b/MyOffice.Data.Models/Users/User.cs index 330bf79..24c39a6 100644 --- a/MyOffice.Data.Models/Users/User.cs +++ b/MyOffice.Data.Models/Users/User.cs @@ -2,7 +2,7 @@ using Accounts; using Currencies; -using Motions; +using Items; public class User { @@ -26,7 +26,7 @@ public class User public CurrencyGlobal? Currency { get; set; } public IEnumerable? Currencies { get; set; } public IEnumerable? AccountAccess { get; set; } - public IEnumerable? AccountMotions { get; set; } + public IEnumerable? AccountMotions { get; set; } public IEnumerable? AccountCategories { get; set; } - public IEnumerable? MotionCategories { get; set; } + public IEnumerable? ItemCategories { get; set; } } \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Account/AccountMotionRepository.cs b/MyOffice.Data.Repositories/Account/AccountMotionRepository.cs deleted file mode 100644 index 041594a..0000000 --- a/MyOffice.Data.Repositories/Account/AccountMotionRepository.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace MyOffice.Data.Repositories.Account; - -using Microsoft.EntityFrameworkCore; -using Models.Accounts; - -public class AccountMotionRepository : AppRepository, IAccountMotionRepository -{ - public bool Add(AccountMotion accountMotion) - { - return AddBase(accountMotion) > 0; - } - - public List GetByAccount(Guid accountId, DateTime dateFrom, DateTime dateTo) - { - return _context - .AccountMotions - .Include(x => x.Motion) - .ThenInclude(x => x.MotionGlobal) - .Where(x => x.AccountId == accountId && x.DateTime >= dateFrom && x.DateTime <= dateTo) - .OrderByDescending(x => x.DateTime) - .ThenByDescending(x => x.CreatedOn) - .ToList(); - } -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Account/IAccountMotionRepository.cs b/MyOffice.Data.Repositories/Account/IAccountMotionRepository.cs deleted file mode 100644 index 8ca3325..0000000 --- a/MyOffice.Data.Repositories/Account/IAccountMotionRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace MyOffice.Data.Repositories.Account; - -using Models.Accounts; - -public interface IAccountMotionRepository -{ - bool Add(AccountMotion accountMotion); - List GetByAccount(Guid accountId, DateTime dateFrom, DateTime dateTo); -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Account/IMotionRepository.cs b/MyOffice.Data.Repositories/Account/IMotionRepository.cs new file mode 100644 index 0000000..ee84372 --- /dev/null +++ b/MyOffice.Data.Repositories/Account/IMotionRepository.cs @@ -0,0 +1,9 @@ +namespace MyOffice.Data.Repositories.Account; + +using Models.Accounts; + +public interface IMotionRepository +{ + bool Add(Motion motion); + List GetByAccount(Guid accountId, DateTime dateFrom, DateTime dateTo); +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Account/MotionRepository.cs b/MyOffice.Data.Repositories/Account/MotionRepository.cs new file mode 100644 index 0000000..bcdc1ce --- /dev/null +++ b/MyOffice.Data.Repositories/Account/MotionRepository.cs @@ -0,0 +1,24 @@ +namespace MyOffice.Data.Repositories.Account; + +using Microsoft.EntityFrameworkCore; +using Models.Accounts; + +public class MotionRepository : AppRepository, IMotionRepository +{ + public bool Add(Motion motion) + { + return AddBase(motion) > 0; + } + + public List GetByAccount(Guid accountId, DateTime dateFrom, DateTime dateTo) + { + return _context + .Motions + .Include(x => x.Item) + .ThenInclude(x => x.ItemGlobal) + .Where(x => x.AccountId == accountId && x.DateTime >= dateFrom && x.DateTime <= dateTo) + .OrderByDescending(x => x.DateTime) + .ThenByDescending(x => x.CreatedOn) + .ToList(); + } +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Item/IItemCategoryRepository.cs b/MyOffice.Data.Repositories/Item/IItemCategoryRepository.cs new file mode 100644 index 0000000..ae7da82 --- /dev/null +++ b/MyOffice.Data.Repositories/Item/IItemCategoryRepository.cs @@ -0,0 +1,12 @@ +namespace MyOffice.Data.Repositories.Item; + +using MyOffice.Data.Models.Items; + +public interface IItemCategoryRepository +{ + List GetAll(Guid userId); + bool Add(ItemCategory accountCategory); + ItemCategory? Get(Guid userId, Guid id); + bool Update(ItemCategory accountCategory); + bool Remove(ItemCategory accountCategory); +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Item/IItemGlobalRepository.cs b/MyOffice.Data.Repositories/Item/IItemGlobalRepository.cs new file mode 100644 index 0000000..857014b --- /dev/null +++ b/MyOffice.Data.Repositories/Item/IItemGlobalRepository.cs @@ -0,0 +1,10 @@ +namespace MyOffice.Data.Repositories.Item; + +using MyOffice.Data.Models.Items; + +public interface IItemGlobalRepository +{ + ItemGlobal? Get(Guid id); + ItemGlobal? GetByName(string name); + bool Add(ItemGlobal itemGlobal); +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Item/IItemRepository.cs b/MyOffice.Data.Repositories/Item/IItemRepository.cs new file mode 100644 index 0000000..48b519a --- /dev/null +++ b/MyOffice.Data.Repositories/Item/IItemRepository.cs @@ -0,0 +1,13 @@ +namespace MyOffice.Data.Repositories.Item; + +using MyOffice.Data.Models.Items; + +public interface IItemRepository +{ + List GetAll(Guid userId); + List GetByCategory(Guid userId, Guid categoryId); + + Item? GetByGlobal(Guid userId, Guid globalMotionId); + bool Add(Item item); + bool Update(Item item); +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Item/ItemCategoryRepository.cs b/MyOffice.Data.Repositories/Item/ItemCategoryRepository.cs new file mode 100644 index 0000000..b6d3c43 --- /dev/null +++ b/MyOffice.Data.Repositories/Item/ItemCategoryRepository.cs @@ -0,0 +1,37 @@ +namespace MyOffice.Data.Repositories.Item; + +using Microsoft.EntityFrameworkCore; +using MyOffice.Data.Models.Items; + +public class ItemCategoryRepository : AppRepository, IItemCategoryRepository +{ + public List GetAll(Guid userId) + { + return _context.ItemCategories + .Include(x => x.Items) + .Where(x => x.UserId == userId) + .ToList(); + } + + public bool Add(ItemCategory itemCategory) + { + return AddBase(itemCategory) > 0; + } + + public ItemCategory? Get(Guid userId, Guid id) + { + return _context.ItemCategories + .Include(x => x.Items) + .FirstOrDefault(x => x.Id == id && x.UserId == userId); + } + + public bool Update(ItemCategory itemCategory) + { + return UpdateBase(itemCategory) > 0; + } + + public bool Remove(ItemCategory itemCategory) + { + return RemoveBase(itemCategory) > 0; + } +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Item/ItemGlobalRepository.cs b/MyOffice.Data.Repositories/Item/ItemGlobalRepository.cs new file mode 100644 index 0000000..364b1d5 --- /dev/null +++ b/MyOffice.Data.Repositories/Item/ItemGlobalRepository.cs @@ -0,0 +1,21 @@ +namespace MyOffice.Data.Repositories.Item; + +using MyOffice.Data.Models.Items; + +public class ItemGlobalRepository : AppRepository, IItemGlobalRepository +{ + public ItemGlobal? Get(Guid id) + { + return _context.ItemGlobals.FirstOrDefault(x => x.Id == id); + } + + public ItemGlobal? GetByName(string name) + { + return _context.ItemGlobals.FirstOrDefault(x => x.Name == name); + } + + public bool Add(ItemGlobal itemGlobal) + { + return AddBase(itemGlobal) > 0; + } +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Item/ItemRepository.cs b/MyOffice.Data.Repositories/Item/ItemRepository.cs new file mode 100644 index 0000000..9ae6d2a --- /dev/null +++ b/MyOffice.Data.Repositories/Item/ItemRepository.cs @@ -0,0 +1,46 @@ +namespace MyOffice.Data.Repositories.Item; + +using Microsoft.EntityFrameworkCore; +using MyOffice.Data.Models.Items; + +public class ItemRepository : AppRepository, IItemRepository +{ + public List GetAll(Guid userId) + { + return _context.Items + .Include(x => x.Motions) + .Include(x => x.Category) + .Include(x => x.ItemGlobal) + .Where(x => x.Category.UserId == userId) + .ToList(); + } + + public List GetByCategory(Guid userId, Guid categoryId) + { + return _context.Items + .Include(x => x.Motions) + .Include(x => x.Category) + .Include(x => x.ItemGlobal) + .Where(x => x.Category.UserId == userId && x.CategoryId == categoryId) + .ToList(); + } + + public Item? GetByGlobal(Guid userId, Guid globalMotionId) + { + return _context.Items + .Include(x => x.Motions) + .Include(x => x.Category) + .Include(x => x.ItemGlobal) + .FirstOrDefault(x => x.Category.UserId == userId && x.ItemGlobalId == globalMotionId); + } + + public bool Update(Item item) + { + return base.UpdateBase(item) > 0; + } + + public bool Add(Item item) + { + return base.AddBase(item) > 0; + } +} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Motion/IMotionCategoryRepository.cs b/MyOffice.Data.Repositories/Motion/IMotionCategoryRepository.cs deleted file mode 100644 index 7638261..0000000 --- a/MyOffice.Data.Repositories/Motion/IMotionCategoryRepository.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace MyOffice.Data.Repositories.Motion; - -using Models.Motions; - -public interface IMotionCategoryRepository -{ - List GetAll(Guid userId); - bool Add(MotionCategory accountCategory); - MotionCategory? Get(Guid userId, Guid id); - bool Update(MotionCategory accountCategory); - bool Remove(MotionCategory accountCategory); -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Motion/IMotionGlobalRepository.cs b/MyOffice.Data.Repositories/Motion/IMotionGlobalRepository.cs deleted file mode 100644 index 2dc30c8..0000000 --- a/MyOffice.Data.Repositories/Motion/IMotionGlobalRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace MyOffice.Data.Repositories.Motion; - -using Models.Motions; - -public interface IMotionGlobalRepository -{ - MotionGlobal? Get(Guid id); - MotionGlobal? GetByName(string name); - bool Add(MotionGlobal motionGlobal); -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Motion/IMotionsRepository.cs b/MyOffice.Data.Repositories/Motion/IMotionsRepository.cs deleted file mode 100644 index 87357ca..0000000 --- a/MyOffice.Data.Repositories/Motion/IMotionsRepository.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace MyOffice.Data.Repositories.Motion; - -using Models.Motions; - -public interface IMotionRepository -{ - List GetAll(Guid userId); - List GetByCategory(Guid userId, Guid categoryId); - - MotionAccount? GetByGlobal(Guid userId, Guid globalMotionId); - bool Add(MotionAccount motionAccount); - bool Update(MotionAccount motionAccount); -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Motion/MotionCategoryRepository.cs b/MyOffice.Data.Repositories/Motion/MotionCategoryRepository.cs deleted file mode 100644 index e2977eb..0000000 --- a/MyOffice.Data.Repositories/Motion/MotionCategoryRepository.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace MyOffice.Data.Repositories.Motion; - -using Microsoft.EntityFrameworkCore; -using Models.Motions; - -public class MotionCategoryRepository : AppRepository, IMotionCategoryRepository -{ - public List GetAll(Guid userId) - { - return _context.MotionCategories - .Include(x => x.Motions) - .Where(x => x.UserId == userId) - .ToList(); - } - - public bool Add(MotionCategory motionCategory) - { - return AddBase(motionCategory) > 0; - } - - public MotionCategory? Get(Guid userId, Guid id) - { - return _context.MotionCategories - .Include(x => x.Motions) - .FirstOrDefault(x => x.Id == id && x.UserId == userId); - } - - public bool Update(MotionCategory motionCategory) - { - return UpdateBase(motionCategory) > 0; - } - - public bool Remove(MotionCategory motionCategory) - { - return RemoveBase(motionCategory) > 0; - } -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Motion/MotionGlobalRepository.cs b/MyOffice.Data.Repositories/Motion/MotionGlobalRepository.cs deleted file mode 100644 index 1fc149a..0000000 --- a/MyOffice.Data.Repositories/Motion/MotionGlobalRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace MyOffice.Data.Repositories.Motion; - -using Models.Motions; - -public class MotionGlobalRepository : AppRepository, IMotionGlobalRepository -{ - public MotionGlobal? Get(Guid id) - { - return _context.GlobalMotions.FirstOrDefault(x => x.Id == id); - } - - public MotionGlobal? GetByName(string name) - { - return _context.GlobalMotions.FirstOrDefault(x => x.Name == name); - } - - public bool Add(MotionGlobal motionGlobal) - { - return AddBase(motionGlobal) > 0; - } -} \ No newline at end of file diff --git a/MyOffice.Data.Repositories/Motion/MotionRepository.cs b/MyOffice.Data.Repositories/Motion/MotionRepository.cs deleted file mode 100644 index 132d352..0000000 --- a/MyOffice.Data.Repositories/Motion/MotionRepository.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace MyOffice.Data.Repositories.Motion; - -using Microsoft.EntityFrameworkCore; -using Models.Motions; - -public class MotionRepository : AppRepository, IMotionRepository -{ - public List GetAll(Guid userId) - { - return _context.Motions - .Include(x => x.Motions) - .Include(x => x.Category) - .Include(x => x.MotionGlobal) - .Where(x => x.Category.UserId == userId) - .ToList(); - } - - public List GetByCategory(Guid userId, Guid categoryId) - { - return _context.Motions - .Include(x => x.Motions) - .Include(x => x.Category) - .Include(x => x.MotionGlobal) - .Where(x => x.Category.UserId == userId && x.CategoryId == categoryId) - .ToList(); - } - - public MotionAccount? GetByGlobal(Guid userId, Guid globalMotionId) - { - return _context.Motions - .Include(x => x.Motions) - .Include(x => x.Category) - .Include(x => x.MotionGlobal) - .FirstOrDefault(x => x.Category.UserId == userId && x.MotionGlobalId == globalMotionId); - } - - public bool Update(MotionAccount motionAccount) - { - return base.UpdateBase(motionAccount) > 0; - } - - public bool Add(MotionAccount motionAccount) - { - return base.AddBase(motionAccount) > 0; - } -} \ No newline at end of file diff --git a/MyOffice.DbContext/AppDbContext.cs b/MyOffice.DbContext/AppDbContext.cs index 96b2ed5..2442b17 100644 --- a/MyOffice.DbContext/AppDbContext.cs +++ b/MyOffice.DbContext/AppDbContext.cs @@ -2,7 +2,7 @@ using Data.Models.Accounts; using Data.Models.Currencies; -using Data.Models.Motions; +using Data.Models.Items; using Microsoft.EntityFrameworkCore; using Data.Models.Users; @@ -39,10 +39,10 @@ public class AppDbContext : DbContext public DbSet AccountAccountCategories { get; set; } = null!; public DbSet AccountAccesses { get; set; } = null!; - public DbSet GlobalMotions { get; set; } = null!; - public DbSet MotionCategories { get; set; } = null!; - public DbSet Motions { get; set; } = null!; - public DbSet AccountMotions { get; set; } = null!; + public DbSet ItemCategories { get; set; } = null!; + public DbSet ItemGlobals { get; set; } = null!; + public DbSet Items { get; set; } = null!; + public DbSet Motions { get; set; } = null!; protected override void OnModelCreating(ModelBuilder modelBuilder) { @@ -125,7 +125,7 @@ public class AppDbContext : DbContext modelBuilder.Entity() .HasKey(x => x.Id); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => x.Id); modelBuilder.Entity() @@ -149,7 +149,7 @@ public class AppDbContext : DbContext .WithMany(x => x.AccountAccess) .HasForeignKey(x => x.UserId); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(x => x.Account) .WithMany(x => x.Motions) .HasForeignKey(x => x.AccountId); @@ -172,45 +172,45 @@ public class AppDbContext : DbContext private void MotionsCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => x.Id); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => x.Id); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => x.Id); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => x.Id); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(x => x.User) - .WithMany(x => x.MotionCategories) + .WithMany(x => x.ItemCategories) .HasForeignKey(x => x.UserId); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(x => x.Category) - .WithMany(x => x.Motions) + .WithMany(x => x.Items) .HasForeignKey(x => x.CategoryId); - modelBuilder.Entity() - .HasOne(x => x.MotionGlobal) - .WithMany(x => x.Motions) - .HasForeignKey(x => x.MotionGlobalId); + modelBuilder.Entity() + .HasOne(x => x.ItemGlobal) + .WithMany(x => x.Items) + .HasForeignKey(x => x.ItemGlobalId); - modelBuilder.Entity() - .HasOne(x => x.Motion) + modelBuilder.Entity() + .HasOne(x => x.Item) .WithMany(x => x.Motions) - .HasForeignKey(x => x.MotionId); + .HasForeignKey(x => x.ItemId); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(x => x.Account) .WithMany(x => x.Motions) .HasForeignKey(x => x.AccountId); - modelBuilder.Entity() + modelBuilder.Entity() .Property(x => x.AmountMinus) .HasPrecision(18, 6); - modelBuilder.Entity() + modelBuilder.Entity() .Property(x => x.AmountPlus) .HasPrecision(18, 6); } diff --git a/MyOffice.DbContext/RepositoryInitializer.cs b/MyOffice.DbContext/RepositoryInitializer.cs index 5adc450..526aafb 100644 --- a/MyOffice.DbContext/RepositoryInitializer.cs +++ b/MyOffice.DbContext/RepositoryInitializer.cs @@ -38,7 +38,7 @@ public class RepositoryInitializer new() { Id = "BTC", DefaultQuantity = 10, Symbol = "btc", Name = "Bitcoin" }, new() { Id = "ETH", DefaultQuantity = 10, Symbol = "eth", Name = "Ethereum" }, new() { Id = "TON", DefaultQuantity = 10, Symbol = "ton", Name = "TON" }, - new() { Id = "OTHER", DefaultQuantity = 1, Symbol = "₽", Name = "Other" }, + new() { Id = "OTHER", DefaultQuantity = 1, Symbol = "", Name = "Other" }, }; var currencyGlobals = dbContext.CurrencyGlobals.ToList(); diff --git a/MyOffice.Migration.Postgres/AppDbContextFactoryPostgres.cs b/MyOffice.Migration.Postgres/AppDbContextFactoryPostgres.cs index 31c175a..82db384 100644 --- a/MyOffice.Migration.Postgres/AppDbContextFactoryPostgres.cs +++ b/MyOffice.Migration.Postgres/AppDbContextFactoryPostgres.cs @@ -1,10 +1,10 @@ -namespace MyOffice.Migrations; +namespace MyOffice.Migrations.Postgres; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.Configuration; -using DbContext; -using Shared; +using MyOffice.DbContext; +using MyOffice.Shared; public class AppDbContextFactoryPostgres : IDesignTimeDbContextFactory { diff --git a/MyOffice.Migration.Postgres/Migrations/20230408172132_init.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230408172132_init.Designer.cs deleted file mode 100644 index ad20c54..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230408172132_init.Designer.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -using System; -using MyOffice.DbContext; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230408172132_init")] - partial class init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230408172132_init.cs b/MyOffice.Migration.Postgres/Migrations/20230408172132_init.cs deleted file mode 100644 index 9df66cc..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230408172132_init.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class init : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False"); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserName = table.Column(type: "text", nullable: false, collation: "my_ci_collation"), - Email = table.Column(type: "text", nullable: false, collation: "my_ci_collation"), - PasswordHash = table.Column(type: "text", nullable: false), - FirstName = table.Column(type: "text", nullable: true), - LastName = table.Column(type: "text", nullable: true), - FullName = table.Column(type: "text", nullable: true), - IsEmailConfirmed = table.Column(type: "boolean", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "UserClaims", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - ExternalId = table.Column(type: "text", nullable: false), - Email = table.Column(type: "text", nullable: false, collation: "my_ci_collation"), - Provider = table.Column(type: "text", nullable: false, collation: "my_ci_collation") - }, - constraints: table => - { - table.PrimaryKey("PK_UserClaims", x => x.Id); - table.ForeignKey( - name: "FK_UserClaims_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserClaims_UserId", - table: "UserClaims", - column: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserClaims"); - - migrationBuilder.DropTable( - name: "Users"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230408172213_phone.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230408172213_phone.Designer.cs deleted file mode 100644 index 5f6e6b1..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230408172213_phone.Designer.cs +++ /dev/null @@ -1,122 +0,0 @@ -// -using System; -using MyOffice.DbContext; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230408172213_phone")] - partial class phone - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230408172213_phone.cs b/MyOffice.Migration.Postgres/Migrations/20230408172213_phone.cs deleted file mode 100644 index 9a735e4..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230408172213_phone.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class phone : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Phone", - table: "Users", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Phone", - table: "Users"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429063332_Host.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230429063332_Host.Designer.cs deleted file mode 100644 index 71d01a3..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429063332_Host.Designer.cs +++ /dev/null @@ -1,386 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230429063332_Host")] - partial class Host - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Account.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429063332_Host.cs b/MyOffice.Migration.Postgres/Migrations/20230429063332_Host.cs deleted file mode 100644 index 137be0e..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429063332_Host.cs +++ /dev/null @@ -1,217 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class Host : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "CurrencyGlobals", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Name = table.Column(type: "text", nullable: false), - ShortName = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CurrencyGlobals", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Accounts", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CurrencyGlobalId = table.Column(type: "text", nullable: false), - Name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Accounts", x => x.Id); - table.ForeignKey( - name: "FK_Accounts_CurrencyGlobals_CurrencyGlobalId", - column: x => x.CurrencyGlobalId, - principalTable: "CurrencyGlobals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Currencies", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CurrencyGlobalId = table.Column(type: "text", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - ShortName = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Currencies", x => x.Id); - table.ForeignKey( - name: "FK_Currencies_CurrencyGlobals_CurrencyGlobalId", - column: x => x.CurrencyGlobalId, - principalTable: "CurrencyGlobals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Currencies_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AccountAccesses", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AccountId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - IsAllowRead = table.Column(type: "boolean", nullable: false), - IsAllowWrite = table.Column(type: "boolean", nullable: false), - IsAllowManage = table.Column(type: "boolean", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccountAccesses", x => x.Id); - table.ForeignKey( - name: "FK_AccountAccesses_Accounts_AccountId", - column: x => x.AccountId, - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountAccesses_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AccountMotions", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), - DateTime = table.Column(type: "timestamp with time zone", nullable: false), - AccountId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - AmountIn = table.Column(type: "numeric", nullable: false), - AmountOut = table.Column(type: "numeric", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccountMotions", x => x.Id); - table.ForeignKey( - name: "FK_AccountMotions_Accounts_AccountId", - column: x => x.AccountId, - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountMotions_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "CurrencyRates", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CurrencyId = table.Column(type: "uuid", nullable: false), - DateTime = table.Column(type: "timestamp with time zone", nullable: false), - Rate = table.Column(type: "numeric", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CurrencyRates", x => x.Id); - table.ForeignKey( - name: "FK_CurrencyRates_Currencies_CurrencyId", - column: x => x.CurrencyId, - principalTable: "Currencies", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccountAccesses_AccountId", - table: "AccountAccesses", - column: "AccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountAccesses_UserId", - table: "AccountAccesses", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_AccountId", - table: "AccountMotions", - column: "AccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_UserId", - table: "AccountMotions", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Accounts_CurrencyGlobalId", - table: "Accounts", - column: "CurrencyGlobalId"); - - migrationBuilder.CreateIndex( - name: "IX_Currencies_CurrencyGlobalId", - table: "Currencies", - column: "CurrencyGlobalId"); - - migrationBuilder.CreateIndex( - name: "IX_Currencies_UserId", - table: "Currencies", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_CurrencyRates_CurrencyId", - table: "CurrencyRates", - column: "CurrencyId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccountAccesses"); - - migrationBuilder.DropTable( - name: "AccountMotions"); - - migrationBuilder.DropTable( - name: "CurrencyRates"); - - migrationBuilder.DropTable( - name: "Accounts"); - - migrationBuilder.DropTable( - name: "Currencies"); - - migrationBuilder.DropTable( - name: "CurrencyGlobals"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.Designer.cs deleted file mode 100644 index f46e32d..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.Designer.cs +++ /dev/null @@ -1,407 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230429090658_user_currency")] - partial class usercurrency - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Account.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.cs b/MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.cs deleted file mode 100644 index f74dea3..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429090658_user_currency.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class usercurrency : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CurrencyId", - table: "Users", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Symbol", - table: "CurrencyGlobals", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.CreateIndex( - name: "IX_Users_CurrencyId", - table: "Users", - column: "CurrencyId"); - - migrationBuilder.AddForeignKey( - name: "FK_Users_CurrencyGlobals_CurrencyId", - table: "Users", - column: "CurrencyId", - principalTable: "CurrencyGlobals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Users_CurrencyGlobals_CurrencyId", - table: "Users"); - - migrationBuilder.DropIndex( - name: "IX_Users_CurrencyId", - table: "Users"); - - migrationBuilder.DropColumn( - name: "CurrencyId", - table: "Users"); - - migrationBuilder.DropColumn( - name: "Symbol", - table: "CurrencyGlobals"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.Designer.cs deleted file mode 100644 index 028f7f9..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.Designer.cs +++ /dev/null @@ -1,403 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230429092104_currency_shortname")] - partial class currencyshortname - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Account.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.cs b/MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.cs deleted file mode 100644 index 52fc1b2..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429092104_currency_shortname.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class currencyshortname : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ShortName", - table: "Currencies"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ShortName", - table: "Currencies", - type: "text", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.Designer.cs deleted file mode 100644 index 9846731..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.Designer.cs +++ /dev/null @@ -1,403 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230429092950_gcurrency_shortname")] - partial class gcurrencyshortname - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Account.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Account.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Account.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Account.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.cs b/MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.cs deleted file mode 100644 index 92705d6..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230429092950_gcurrency_shortname.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class gcurrencyshortname : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ShortName", - table: "CurrencyGlobals"); - - migrationBuilder.AddColumn( - name: "ShortName", - table: "Currencies", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ShortName", - table: "Currencies"); - - migrationBuilder.AddColumn( - name: "ShortName", - table: "CurrencyGlobals", - type: "text", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.Designer.cs deleted file mode 100644 index efee34b..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.Designer.cs +++ /dev/null @@ -1,467 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230430103617_account_category")] - partial class accountcategory - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategory"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("AccountCategory"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currency.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.cs b/MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.cs deleted file mode 100644 index a3cedb2..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230430103617_account_category.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class accountcategory : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AccountCategory", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccountCategory", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AccountAccountCategory", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AccountId = table.Column(type: "uuid", nullable: false), - CategoryId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccountAccountCategory", x => x.Id); - table.ForeignKey( - name: "FK_AccountAccountCategory_AccountCategory_AccountId", - column: x => x.AccountId, - principalTable: "AccountCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountAccountCategory_Accounts_CategoryId", - column: x => x.CategoryId, - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccountAccountCategory_AccountId", - table: "AccountAccountCategory", - column: "AccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountAccountCategory_CategoryId", - table: "AccountAccountCategory", - column: "CategoryId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccountAccountCategory"); - - migrationBuilder.DropTable( - name: "AccountCategory"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.Designer.cs deleted file mode 100644 index 40fd601..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.Designer.cs +++ /dev/null @@ -1,473 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230601100601_CurrencyQuantity")] - partial class CurrencyQuantity - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategory"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("AccountCategory"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currency.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.cs b/MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.cs deleted file mode 100644 index edfa9a7..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230601100601_CurrencyQuantity.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class CurrencyQuantity : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Quantity", - table: "CurrencyRates", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "DefaultQuantity", - table: "Currencies", - type: "integer", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Quantity", - table: "CurrencyRates"); - - migrationBuilder.DropColumn( - name: "DefaultQuantity", - table: "Currencies"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.Designer.cs deleted file mode 100644 index 7304ea3..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.Designer.cs +++ /dev/null @@ -1,473 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230601100833_CurrencyQuantity2")] - partial class CurrencyQuantity2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategory"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("AccountCategory"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currency.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.cs b/MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.cs deleted file mode 100644 index 636b207..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230601100833_CurrencyQuantity2.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class CurrencyQuantity2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DefaultQuantity", - table: "Currencies"); - - migrationBuilder.AddColumn( - name: "DefaultQuantity", - table: "CurrencyGlobals", - type: "integer", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DefaultQuantity", - table: "CurrencyGlobals"); - - migrationBuilder.AddColumn( - name: "DefaultQuantity", - table: "Currencies", - type: "integer", - nullable: false, - defaultValue: 0); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.Designer.cs deleted file mode 100644 index 87169e7..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.Designer.cs +++ /dev/null @@ -1,491 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230601121013_AccountCategories")] - partial class AccountCategories - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currency.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.cs b/MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.cs deleted file mode 100644 index 1b88fb7..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230601121013_AccountCategories.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class AccountCategories : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategory_AccountCategory_AccountId", - table: "AccountAccountCategory"); - - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategory_Accounts_CategoryId", - table: "AccountAccountCategory"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AccountCategory", - table: "AccountCategory"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AccountAccountCategory", - table: "AccountAccountCategory"); - - migrationBuilder.RenameTable( - name: "AccountCategory", - newName: "AccountCategories"); - - migrationBuilder.RenameTable( - name: "AccountAccountCategory", - newName: "AccountAccountCategories"); - - migrationBuilder.RenameIndex( - name: "IX_AccountAccountCategory_CategoryId", - table: "AccountAccountCategories", - newName: "IX_AccountAccountCategories_CategoryId"); - - migrationBuilder.RenameIndex( - name: "IX_AccountAccountCategory_AccountId", - table: "AccountAccountCategories", - newName: "IX_AccountAccountCategories_AccountId"); - - migrationBuilder.AddColumn( - name: "UserId", - table: "AccountCategories", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - migrationBuilder.AddPrimaryKey( - name: "PK_AccountCategories", - table: "AccountCategories", - column: "Id"); - - migrationBuilder.AddPrimaryKey( - name: "PK_AccountAccountCategories", - table: "AccountAccountCategories", - column: "Id"); - - migrationBuilder.CreateIndex( - name: "IX_AccountCategories_UserId", - table: "AccountCategories", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategories_AccountCategories_AccountId", - table: "AccountAccountCategories", - column: "AccountId", - principalTable: "AccountCategories", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategories_Accounts_CategoryId", - table: "AccountAccountCategories", - column: "CategoryId", - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AccountCategories_Users_UserId", - table: "AccountCategories", - column: "UserId", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategories_AccountCategories_AccountId", - table: "AccountAccountCategories"); - - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategories_Accounts_CategoryId", - table: "AccountAccountCategories"); - - migrationBuilder.DropForeignKey( - name: "FK_AccountCategories_Users_UserId", - table: "AccountCategories"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AccountCategories", - table: "AccountCategories"); - - migrationBuilder.DropIndex( - name: "IX_AccountCategories_UserId", - table: "AccountCategories"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AccountAccountCategories", - table: "AccountAccountCategories"); - - migrationBuilder.DropColumn( - name: "UserId", - table: "AccountCategories"); - - migrationBuilder.RenameTable( - name: "AccountCategories", - newName: "AccountCategory"); - - migrationBuilder.RenameTable( - name: "AccountAccountCategories", - newName: "AccountAccountCategory"); - - migrationBuilder.RenameIndex( - name: "IX_AccountAccountCategories_CategoryId", - table: "AccountAccountCategory", - newName: "IX_AccountAccountCategory_CategoryId"); - - migrationBuilder.RenameIndex( - name: "IX_AccountAccountCategories_AccountId", - table: "AccountAccountCategory", - newName: "IX_AccountAccountCategory_AccountId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_AccountCategory", - table: "AccountCategory", - column: "Id"); - - migrationBuilder.AddPrimaryKey( - name: "PK_AccountAccountCategory", - table: "AccountAccountCategory", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategory_AccountCategory_AccountId", - table: "AccountAccountCategory", - column: "AccountId", - principalTable: "AccountCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategory_Accounts_CategoryId", - table: "AccountAccountCategory", - column: "CategoryId", - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.Designer.cs deleted file mode 100644 index 4c5d711..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.Designer.cs +++ /dev/null @@ -1,491 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230609062452_AccountCategoriesFix")] - partial class AccountCategoriesFix - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountIn") - .HasColumnType("numeric"); - - b.Property("AmountOut") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountMotions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currency.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currency.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currency.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.cs b/MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.cs deleted file mode 100644 index cece476..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230609062452_AccountCategoriesFix.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class AccountCategoriesFix : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategories_AccountCategories_AccountId", - table: "AccountAccountCategories"); - - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategories_Accounts_CategoryId", - table: "AccountAccountCategories"); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategories_AccountCategories_CategoryId", - table: "AccountAccountCategories", - column: "CategoryId", - principalTable: "AccountCategories", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategories_Accounts_AccountId", - table: "AccountAccountCategories", - column: "AccountId", - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategories_AccountCategories_CategoryId", - table: "AccountAccountCategories"); - - migrationBuilder.DropForeignKey( - name: "FK_AccountAccountCategories_Accounts_AccountId", - table: "AccountAccountCategories"); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategories_AccountCategories_AccountId", - table: "AccountAccountCategories", - column: "AccountId", - principalTable: "AccountCategories", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AccountAccountCategories_Accounts_CategoryId", - table: "AccountAccountCategories", - column: "CategoryId", - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.Designer.cs deleted file mode 100644 index 51042cc..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.Designer.cs +++ /dev/null @@ -1,606 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230611145152_Motion")] - partial class Motion - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasColumnType("numeric"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.cs b/MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.cs deleted file mode 100644 index 889370f..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230611145152_Motion.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class Motion : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AccountMotions_Users_UserId", - table: "AccountMotions"); - - migrationBuilder.RenameColumn( - name: "AmountOut", - table: "AccountMotions", - newName: "AmountPlus"); - - migrationBuilder.RenameColumn( - name: "AmountIn", - table: "AccountMotions", - newName: "AmountMinus"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "AccountMotions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AddColumn( - name: "Description", - table: "AccountMotions", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "MotionId", - table: "AccountMotions", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateTable( - name: "GlobalMotions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_GlobalMotions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "MotionCategories", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_MotionCategories", x => x.Id); - table.ForeignKey( - name: "FK_MotionCategories_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Motions", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CategoryId = table.Column(type: "uuid", nullable: false), - MotionGlobalId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Motions", x => x.Id); - table.ForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - column: x => x.MotionGlobalId, - principalTable: "GlobalMotions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Motions_MotionCategories_CategoryId", - column: x => x.CategoryId, - principalTable: "MotionCategories", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_MotionId", - table: "AccountMotions", - column: "MotionId"); - - migrationBuilder.CreateIndex( - name: "IX_MotionCategories_UserId", - table: "MotionCategories", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Motions_CategoryId", - table: "Motions", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Motions_MotionGlobalId", - table: "Motions", - column: "MotionGlobalId"); - - migrationBuilder.AddForeignKey( - name: "FK_AccountMotions_Motions_MotionId", - table: "AccountMotions", - column: "MotionId", - principalTable: "Motions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AccountMotions_Users_UserId", - table: "AccountMotions", - column: "UserId", - principalTable: "Users", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AccountMotions_Motions_MotionId", - table: "AccountMotions"); - - migrationBuilder.DropForeignKey( - name: "FK_AccountMotions_Users_UserId", - table: "AccountMotions"); - - migrationBuilder.DropTable( - name: "Motions"); - - migrationBuilder.DropTable( - name: "GlobalMotions"); - - migrationBuilder.DropTable( - name: "MotionCategories"); - - migrationBuilder.DropIndex( - name: "IX_AccountMotions_MotionId", - table: "AccountMotions"); - - migrationBuilder.DropColumn( - name: "Description", - table: "AccountMotions"); - - migrationBuilder.DropColumn( - name: "MotionId", - table: "AccountMotions"); - - migrationBuilder.RenameColumn( - name: "AmountPlus", - table: "AccountMotions", - newName: "AmountOut"); - - migrationBuilder.RenameColumn( - name: "AmountMinus", - table: "AccountMotions", - newName: "AmountIn"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "AccountMotions", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Id", - table: "AccountMotions", - type: "bigint", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid") - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - migrationBuilder.AddForeignKey( - name: "FK_AccountMotions_Users_UserId", - table: "AccountMotions", - column: "UserId", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.Designer.cs deleted file mode 100644 index 603f9c7..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.Designer.cs +++ /dev/null @@ -1,609 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230614175616_MotionCategoryFix")] - partial class MotionCategoryFix - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasColumnType("numeric"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .IsRequired() - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.cs b/MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.cs deleted file mode 100644 index cbedbe1..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230614175616_MotionCategoryFix.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionCategoryFix : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - /*migrationBuilder.AlterColumn( - name: "Id", - table: "AccountMotions", - type: "bigint", - nullable: false, - oldClrType: typeof(Guid), - oldType: "uuid") - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);*/ - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - /*migrationBuilder.AlterColumn( - name: "Id", - table: "AccountMotions", - type: "uuid", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint") - .OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);*/ - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.Designer.cs deleted file mode 100644 index 0b80ae7..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.Designer.cs +++ /dev/null @@ -1,606 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230614181358_MotionCategoryFix2")] - partial class MotionCategoryFix2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasColumnType("numeric"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId"); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.cs b/MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.cs deleted file mode 100644 index 615579e..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230614181358_MotionCategoryFix2.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionCategoryFix2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions"); - - migrationBuilder.AlterColumn( - name: "MotionGlobalId", - table: "Motions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AddForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions", - column: "MotionGlobalId", - principalTable: "GlobalMotions", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions"); - - migrationBuilder.AlterColumn( - name: "MotionGlobalId", - table: "Motions", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions", - column: "MotionGlobalId", - principalTable: "GlobalMotions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.Designer.cs deleted file mode 100644 index dde6dec..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.Designer.cs +++ /dev/null @@ -1,608 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230614183224_MotionCategoryFix3")] - partial class MotionCategoryFix3 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasColumnType("numeric"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.cs b/MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.cs deleted file mode 100644 index ce4ef32..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230614183224_MotionCategoryFix3.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionCategoryFix3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions"); - - migrationBuilder.AlterColumn( - name: "MotionGlobalId", - table: "Motions", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions", - column: "MotionGlobalId", - principalTable: "GlobalMotions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions"); - - migrationBuilder.AlterColumn( - name: "MotionGlobalId", - table: "Motions", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AddForeignKey( - name: "FK_Motions_GlobalMotions_MotionGlobalId", - table: "Motions", - column: "MotionGlobalId", - principalTable: "GlobalMotions", - principalColumn: "Id"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.Designer.cs deleted file mode 100644 index 87466e7..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.Designer.cs +++ /dev/null @@ -1,533 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230617113630_MotionAccountFix")] - partial class MotionAccountFix - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.cs b/MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.cs deleted file mode 100644 index 6e1daf6..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230617113630_MotionAccountFix.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionAccountFix : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccountMotions"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AccountMotions", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AccountId = table.Column(type: "uuid", nullable: false), - MotionId = table.Column(type: "integer", nullable: false), - AmountMinus = table.Column(type: "numeric", nullable: false), - AmountPlus = table.Column(type: "numeric", nullable: false), - CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), - DateTime = table.Column(type: "timestamp with time zone", nullable: false), - Description = table.Column(type: "text", nullable: true), - UserId = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AccountMotions", x => x.Id); - table.ForeignKey( - name: "FK_AccountMotions_Accounts_AccountId", - column: x => x.AccountId, - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountMotions_Motions_MotionId", - column: x => x.MotionId, - principalTable: "Motions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountMotions_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_AccountId", - table: "AccountMotions", - column: "AccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_MotionId", - table: "AccountMotions", - column: "MotionId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_UserId", - table: "AccountMotions", - column: "UserId"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.Designer.cs deleted file mode 100644 index a3877a3..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.Designer.cs +++ /dev/null @@ -1,606 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230617114210_MotionAccountFix2")] - partial class MotionAccountFix2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasColumnType("numeric"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.cs b/MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.cs deleted file mode 100644 index c574131..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230617114210_MotionAccountFix2.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionAccountFix2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AccountMotions", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), - DateTime = table.Column(type: "timestamp with time zone", nullable: false), - MotionId = table.Column(type: "integer", nullable: false), - AccountId = table.Column(type: "uuid", nullable: false), - Description = table.Column(type: "text", nullable: true), - AmountPlus = table.Column(type: "numeric", nullable: false), - AmountMinus = table.Column(type: "numeric", nullable: false), - UserId = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AccountMotions", x => x.Id); - table.ForeignKey( - name: "FK_AccountMotions_Accounts_AccountId", - column: x => x.AccountId, - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountMotions_Motions_MotionId", - column: x => x.MotionId, - principalTable: "Motions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AccountMotions_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_AccountId", - table: "AccountMotions", - column: "AccountId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_MotionId", - table: "AccountMotions", - column: "MotionId"); - - migrationBuilder.CreateIndex( - name: "IX_AccountMotions_UserId", - table: "AccountMotions", - column: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccountMotions"); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.Designer.cs deleted file mode 100644 index d35741b..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.Designer.cs +++ /dev/null @@ -1,607 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230621082718_MotionPrec")] - partial class MotionPrec - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasPrecision(6) - .HasColumnType("numeric(6)"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.cs b/MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.cs deleted file mode 100644 index ca11cd1..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230621082718_MotionPrec.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionPrec : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "AmountMinus", - table: "AccountMotions", - type: "numeric(6)", - precision: 6, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "AmountMinus", - table: "AccountMotions", - type: "numeric", - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(6)", - oldPrecision: 6); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.Designer.cs deleted file mode 100644 index b9ac160..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.Designer.cs +++ /dev/null @@ -1,607 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyOffice.DbContext; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230621083359_MotionPrec2")] - partial class MotionPrec2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False") - .HasAnnotation("ProductVersion", "7.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.ToTable("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("IsAllowManage") - .HasColumnType("boolean"); - - b.Property("IsAllowRead") - .HasColumnType("boolean"); - - b.Property("IsAllowWrite") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountAccesses"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("CategoryId"); - - b.ToTable("AccountAccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccountCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccountId") - .HasColumnType("uuid"); - - b.Property("AmountMinus") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("AmountPlus") - .HasColumnType("numeric"); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("MotionId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("MotionId"); - - b.HasIndex("UserId"); - - b.ToTable("AccountMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyGlobalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyGlobalId"); - - b.HasIndex("UserId"); - - b.ToTable("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("DefaultQuantity") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Symbol") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("CurrencyGlobals"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CurrencyId") - .HasColumnType("uuid"); - - b.Property("DateTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("Rate") - .HasColumnType("numeric"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("CurrencyRates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("MotionGlobalId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("MotionGlobalId"); - - b.ToTable("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("MotionCategories"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("GlobalMotions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CurrencyId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("FirstName") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsEmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.HasKey("Id"); - - b.HasIndex("CurrencyId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedOn") - .HasColumnType("timestamp with time zone"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("text") - .UseCollation("my_ci_collation"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Accounts") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccess", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("AccessRights") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountAccess") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountAccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Categories") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Accounts.AccountCategory", "Category") - .WithMany("Accounts") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("AccountCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => - { - b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") - .WithMany("Motions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") - .WithMany("Motions") - .HasForeignKey("MotionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", null) - .WithMany("AccountMotions") - .HasForeignKey("UserId"); - - b.Navigation("Account"); - - b.Navigation("Motion"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "CurrencyGlobal") - .WithMany("Currencies") - .HasForeignKey("CurrencyGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("Currencies") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CurrencyGlobal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyRate", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.Currency", "Currency") - .WithMany("Rates") - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("MotionGlobal"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.HasOne("MyOffice.Data.Models.Currencies.CurrencyGlobal", "Currency") - .WithMany() - .HasForeignKey("CurrencyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Currency"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.Account", b => - { - b.Navigation("AccessRights"); - - b.Navigation("Categories"); - - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountCategory", b => - { - b.Navigation("Accounts"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => - { - b.Navigation("Rates"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Currencies.CurrencyGlobal", b => - { - b.Navigation("Accounts"); - - b.Navigation("Currencies"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => - { - b.Navigation("Motions"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("AccountAccess"); - - b.Navigation("AccountCategories"); - - b.Navigation("AccountMotions"); - - b.Navigation("Currencies"); - - b.Navigation("MotionCategories"); - - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.cs b/MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.cs deleted file mode 100644 index a9b9541..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230621083359_MotionPrec2.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionPrec2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "AmountMinus", - table: "AccountMotions", - type: "numeric(18,6)", - precision: 18, - scale: 6, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(6,0)", - oldPrecision: 6); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "AmountMinus", - table: "AccountMotions", - type: "numeric(6,0)", - precision: 6, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,6)", - oldPrecision: 18, - oldScale: 6); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.cs b/MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.cs deleted file mode 100644 index 46a88f2..0000000 --- a/MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Postgres.Migrations -{ - /// - public partial class MotionPrec3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "AmountPlus", - table: "AccountMotions", - type: "numeric(18,6)", - precision: 18, - scale: 6, - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "AmountPlus", - table: "AccountMotions", - type: "numeric", - nullable: false, - oldClrType: typeof(decimal), - oldType: "numeric(18,6)", - oldPrecision: 18, - oldScale: 6); - } - } -} diff --git a/MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.Designer.cs b/MyOffice.Migration.Postgres/Migrations/20230621190024_Init.Designer.cs similarity index 90% rename from MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.Designer.cs rename to MyOffice.Migration.Postgres/Migrations/20230621190024_Init.Designer.cs index 80b20ac..2c41f26 100644 --- a/MyOffice.Migration.Postgres/Migrations/20230621083446_MotionPrec3.Designer.cs +++ b/MyOffice.Migration.Postgres/Migrations/20230621190024_Init.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace MyOffice.Migrations.Postgres.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20230621083446_MotionPrec3")] - partial class MotionPrec3 + [Migration("20230621190024_Init")] + partial class Init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -122,7 +122,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.ToTable("AccountCategories"); }); - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => + modelBuilder.Entity("MyOffice.Data.Models.Accounts.Motion", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -148,7 +148,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Property("Description") .HasColumnType("text"); - b.Property("MotionId") + b.Property("ItemId") .HasColumnType("integer"); b.Property("UserId") @@ -158,11 +158,11 @@ namespace MyOffice.Migrations.Postgres.Migrations b.HasIndex("AccountId"); - b.HasIndex("MotionId"); + b.HasIndex("ItemId"); b.HasIndex("UserId"); - b.ToTable("AccountMotions"); + b.ToTable("Motions"); }); modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => @@ -243,7 +243,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.ToTable("CurrencyRates"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.Item", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -254,19 +254,19 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Property("CategoryId") .HasColumnType("uuid"); - b.Property("MotionGlobalId") + b.Property("ItemGlobalId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("CategoryId"); - b.HasIndex("MotionGlobalId"); + b.HasIndex("ItemGlobalId"); - b.ToTable("Motions"); + b.ToTable("Items"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemCategory", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -283,10 +283,10 @@ namespace MyOffice.Migrations.Postgres.Migrations b.HasIndex("UserId"); - b.ToTable("MotionCategories"); + b.ToTable("ItemCategories"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemGlobal", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -298,7 +298,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.HasKey("Id"); - b.ToTable("GlobalMotions"); + b.ToTable("ItemGlobals"); }); modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => @@ -442,7 +442,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("User"); }); - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => + modelBuilder.Entity("MyOffice.Data.Models.Accounts.Motion", b => { b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") .WithMany("Motions") @@ -450,9 +450,9 @@ namespace MyOffice.Migrations.Postgres.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") + b.HasOne("MyOffice.Data.Models.Motions.Item", "Item") .WithMany("Motions") - .HasForeignKey("MotionId") + .HasForeignKey("ItemId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -462,7 +462,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Account"); - b.Navigation("Motion"); + b.Navigation("Item"); }); modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => @@ -495,29 +495,29 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Currency"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.Item", b => { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") + b.HasOne("MyOffice.Data.Models.Motions.ItemCategory", "Category") + .WithMany("Items") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") + b.HasOne("MyOffice.Data.Models.Motions.ItemGlobal", "ItemGlobal") + .WithMany("Items") + .HasForeignKey("ItemGlobalId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Category"); - b.Navigation("MotionGlobal"); + b.Navigation("ItemGlobal"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemCategory", b => { b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") + .WithMany("ItemCategories") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -573,19 +573,19 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Currencies"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.Item", b => { b.Navigation("Motions"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemCategory", b => { - b.Navigation("Motions"); + b.Navigation("Items"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemGlobal", b => { - b.Navigation("Motions"); + b.Navigation("Items"); }); modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => @@ -598,7 +598,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Currencies"); - b.Navigation("MotionCategories"); + b.Navigation("ItemCategories"); b.Navigation("UserClaims"); }); diff --git a/MyOffice.Migration.Postgres/Migrations/20230621190024_Init.cs b/MyOffice.Migration.Postgres/Migrations/20230621190024_Init.cs new file mode 100644 index 0000000..47a3398 --- /dev/null +++ b/MyOffice.Migration.Postgres/Migrations/20230621190024_Init.cs @@ -0,0 +1,445 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace MyOffice.Migrations.Postgres.Migrations +{ + /// + public partial class Init : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("Npgsql:CollationDefinition:my_ci_collation", "en-u-ks-primary,en-u-ks-primary,icu,False"); + + migrationBuilder.CreateTable( + name: "CurrencyGlobals", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Symbol = table.Column(type: "text", nullable: false), + DefaultQuantity = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CurrencyGlobals", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ItemGlobals", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ItemGlobals", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Accounts", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CurrencyGlobalId = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Accounts", x => x.Id); + table.ForeignKey( + name: "FK_Accounts_CurrencyGlobals_CurrencyGlobalId", + column: x => x.CurrencyGlobalId, + principalTable: "CurrencyGlobals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + UserName = table.Column(type: "text", nullable: false, collation: "my_ci_collation"), + Email = table.Column(type: "text", nullable: false, collation: "my_ci_collation"), + PasswordHash = table.Column(type: "text", nullable: false), + FirstName = table.Column(type: "text", nullable: true), + LastName = table.Column(type: "text", nullable: true), + FullName = table.Column(type: "text", nullable: true), + Phone = table.Column(type: "text", nullable: true), + IsEmailConfirmed = table.Column(type: "boolean", nullable: false), + CurrencyId = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + table.ForeignKey( + name: "FK_Users_CurrencyGlobals_CurrencyId", + column: x => x.CurrencyId, + principalTable: "CurrencyGlobals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AccountAccesses", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AccountId = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), + IsAllowRead = table.Column(type: "boolean", nullable: false), + IsAllowWrite = table.Column(type: "boolean", nullable: false), + IsAllowManage = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccountAccesses", x => x.Id); + table.ForeignKey( + name: "FK_AccountAccesses_Accounts_AccountId", + column: x => x.AccountId, + principalTable: "Accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AccountAccesses_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AccountCategories", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccountCategories", x => x.Id); + table.ForeignKey( + name: "FK_AccountCategories_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Currencies", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CurrencyGlobalId = table.Column(type: "text", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + ShortName = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Currencies", x => x.Id); + table.ForeignKey( + name: "FK_Currencies_CurrencyGlobals_CurrencyGlobalId", + column: x => x.CurrencyGlobalId, + principalTable: "CurrencyGlobals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Currencies_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ItemCategories", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ItemCategories", x => x.Id); + table.ForeignKey( + name: "FK_ItemCategories_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UserClaims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), + ExternalId = table.Column(type: "text", nullable: false), + Email = table.Column(type: "text", nullable: false, collation: "my_ci_collation"), + Provider = table.Column(type: "text", nullable: false, collation: "my_ci_collation") + }, + constraints: table => + { + table.PrimaryKey("PK_UserClaims", x => x.Id); + table.ForeignKey( + name: "FK_UserClaims_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AccountAccountCategories", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AccountId = table.Column(type: "uuid", nullable: false), + CategoryId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccountAccountCategories", x => x.Id); + table.ForeignKey( + name: "FK_AccountAccountCategories_AccountCategories_CategoryId", + column: x => x.CategoryId, + principalTable: "AccountCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AccountAccountCategories_Accounts_AccountId", + column: x => x.AccountId, + principalTable: "Accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CurrencyRates", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CurrencyId = table.Column(type: "uuid", nullable: false), + DateTime = table.Column(type: "timestamp with time zone", nullable: false), + Quantity = table.Column(type: "integer", nullable: false), + Rate = table.Column(type: "numeric", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CurrencyRates", x => x.Id); + table.ForeignKey( + name: "FK_CurrencyRates_Currencies_CurrencyId", + column: x => x.CurrencyId, + principalTable: "Currencies", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Items", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CategoryId = table.Column(type: "uuid", nullable: false), + ItemGlobalId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Items", x => x.Id); + table.ForeignKey( + name: "FK_Items_ItemCategories_CategoryId", + column: x => x.CategoryId, + principalTable: "ItemCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Items_ItemGlobals_ItemGlobalId", + column: x => x.ItemGlobalId, + principalTable: "ItemGlobals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Motions", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), + DateTime = table.Column(type: "timestamp with time zone", nullable: false), + AccountId = table.Column(type: "uuid", nullable: false), + ItemId = table.Column(type: "integer", nullable: false), + Description = table.Column(type: "text", nullable: true), + AmountPlus = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), + AmountMinus = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), + UserId = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Motions", x => x.Id); + table.ForeignKey( + name: "FK_Motions_Accounts_AccountId", + column: x => x.AccountId, + principalTable: "Accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Motions_Items_ItemId", + column: x => x.ItemId, + principalTable: "Items", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Motions_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_AccountAccesses_AccountId", + table: "AccountAccesses", + column: "AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_AccountAccesses_UserId", + table: "AccountAccesses", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AccountAccountCategories_AccountId", + table: "AccountAccountCategories", + column: "AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_AccountAccountCategories_CategoryId", + table: "AccountAccountCategories", + column: "CategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_AccountCategories_UserId", + table: "AccountCategories", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Accounts_CurrencyGlobalId", + table: "Accounts", + column: "CurrencyGlobalId"); + + migrationBuilder.CreateIndex( + name: "IX_Currencies_CurrencyGlobalId", + table: "Currencies", + column: "CurrencyGlobalId"); + + migrationBuilder.CreateIndex( + name: "IX_Currencies_UserId", + table: "Currencies", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_CurrencyRates_CurrencyId", + table: "CurrencyRates", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_ItemCategories_UserId", + table: "ItemCategories", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Items_CategoryId", + table: "Items", + column: "CategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_Items_ItemGlobalId", + table: "Items", + column: "ItemGlobalId"); + + migrationBuilder.CreateIndex( + name: "IX_Motions_AccountId", + table: "Motions", + column: "AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_Motions_ItemId", + table: "Motions", + column: "ItemId"); + + migrationBuilder.CreateIndex( + name: "IX_Motions_UserId", + table: "Motions", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_UserClaims_UserId", + table: "UserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_CurrencyId", + table: "Users", + column: "CurrencyId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AccountAccesses"); + + migrationBuilder.DropTable( + name: "AccountAccountCategories"); + + migrationBuilder.DropTable( + name: "CurrencyRates"); + + migrationBuilder.DropTable( + name: "Motions"); + + migrationBuilder.DropTable( + name: "UserClaims"); + + migrationBuilder.DropTable( + name: "AccountCategories"); + + migrationBuilder.DropTable( + name: "Currencies"); + + migrationBuilder.DropTable( + name: "Accounts"); + + migrationBuilder.DropTable( + name: "Items"); + + migrationBuilder.DropTable( + name: "ItemCategories"); + + migrationBuilder.DropTable( + name: "ItemGlobals"); + + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DropTable( + name: "CurrencyGlobals"); + } + } +} diff --git a/MyOffice.Migration.Postgres/Migrations/AppDbContextModelSnapshot.cs b/MyOffice.Migration.Postgres/Migrations/AppDbContextModelSnapshot.cs index eb3a564..9f26b03 100644 --- a/MyOffice.Migration.Postgres/Migrations/AppDbContextModelSnapshot.cs +++ b/MyOffice.Migration.Postgres/Migrations/AppDbContextModelSnapshot.cs @@ -119,7 +119,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.ToTable("AccountCategories"); }); - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => + modelBuilder.Entity("MyOffice.Data.Models.Accounts.Motion", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -145,7 +145,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Property("Description") .HasColumnType("text"); - b.Property("MotionId") + b.Property("ItemId") .HasColumnType("integer"); b.Property("UserId") @@ -155,11 +155,11 @@ namespace MyOffice.Migrations.Postgres.Migrations b.HasIndex("AccountId"); - b.HasIndex("MotionId"); + b.HasIndex("ItemId"); b.HasIndex("UserId"); - b.ToTable("AccountMotions"); + b.ToTable("Motions"); }); modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => @@ -240,7 +240,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.ToTable("CurrencyRates"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.Item", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -251,19 +251,19 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Property("CategoryId") .HasColumnType("uuid"); - b.Property("MotionGlobalId") + b.Property("ItemGlobalId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("CategoryId"); - b.HasIndex("MotionGlobalId"); + b.HasIndex("ItemGlobalId"); - b.ToTable("Motions"); + b.ToTable("Items"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemCategory", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -280,10 +280,10 @@ namespace MyOffice.Migrations.Postgres.Migrations b.HasIndex("UserId"); - b.ToTable("MotionCategories"); + b.ToTable("ItemCategories"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemGlobal", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -295,7 +295,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.HasKey("Id"); - b.ToTable("GlobalMotions"); + b.ToTable("ItemGlobals"); }); modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => @@ -439,7 +439,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("User"); }); - modelBuilder.Entity("MyOffice.Data.Models.Accounts.AccountMotion", b => + modelBuilder.Entity("MyOffice.Data.Models.Accounts.Motion", b => { b.HasOne("MyOffice.Data.Models.Accounts.Account", "Account") .WithMany("Motions") @@ -447,9 +447,9 @@ namespace MyOffice.Migrations.Postgres.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("MyOffice.Data.Models.Motions.MotionAccount", "Motion") + b.HasOne("MyOffice.Data.Models.Motions.Item", "Item") .WithMany("Motions") - .HasForeignKey("MotionId") + .HasForeignKey("ItemId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -459,7 +459,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Account"); - b.Navigation("Motion"); + b.Navigation("Item"); }); modelBuilder.Entity("MyOffice.Data.Models.Currencies.Currency", b => @@ -492,29 +492,29 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Currency"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.Item", b => { - b.HasOne("MyOffice.Data.Models.Motions.MotionCategory", "Category") - .WithMany("Motions") + b.HasOne("MyOffice.Data.Models.Motions.ItemCategory", "Category") + .WithMany("Items") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("MyOffice.Data.Models.Motions.MotionGlobal", "MotionGlobal") - .WithMany("Motions") - .HasForeignKey("MotionGlobalId") + b.HasOne("MyOffice.Data.Models.Motions.ItemGlobal", "ItemGlobal") + .WithMany("Items") + .HasForeignKey("ItemGlobalId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Category"); - b.Navigation("MotionGlobal"); + b.Navigation("ItemGlobal"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemCategory", b => { b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("MotionCategories") + .WithMany("ItemCategories") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -570,19 +570,19 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Currencies"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionAccount", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.Item", b => { b.Navigation("Motions"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionCategory", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemCategory", b => { - b.Navigation("Motions"); + b.Navigation("Items"); }); - modelBuilder.Entity("MyOffice.Data.Models.Motions.MotionGlobal", b => + modelBuilder.Entity("MyOffice.Data.Models.Motions.ItemGlobal", b => { - b.Navigation("Motions"); + b.Navigation("Items"); }); modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => @@ -595,7 +595,7 @@ namespace MyOffice.Migrations.Postgres.Migrations b.Navigation("Currencies"); - b.Navigation("MotionCategories"); + b.Navigation("ItemCategories"); b.Navigation("UserClaims"); }); diff --git a/MyOffice.Migration.Sqlite/AppDbContextFactorySqlite.cs b/MyOffice.Migration.Sqlite/AppDbContextFactorySqlite.cs index 7cce6e4..2c11bdf 100644 --- a/MyOffice.Migration.Sqlite/AppDbContextFactorySqlite.cs +++ b/MyOffice.Migration.Sqlite/AppDbContextFactorySqlite.cs @@ -1,10 +1,10 @@ -namespace MyOffice.Migrations; +namespace MyOffice.Migrations.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.Configuration; -using DbContext; -using Shared; +using MyOffice.DbContext; +using MyOffice.Shared; public class AppDbContextFactorySqlite : IDesignTimeDbContextFactory { diff --git a/MyOffice.Migration.Sqlite/Migrations/20230408180122_init.Designer.cs b/MyOffice.Migration.Sqlite/Migrations/20230408180122_init.Designer.cs deleted file mode 100644 index 0c7acc6..0000000 --- a/MyOffice.Migration.Sqlite/Migrations/20230408180122_init.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -using System; -using MyOffice.DbContext; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MyOffice.Migrations.Sqlite.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230408180122_init")] - partial class init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.0"); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Email") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("FirstName") - .HasColumnType("TEXT"); - - b.Property("FullName") - .HasColumnType("TEXT"); - - b.Property("IsEmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedOn") - .HasColumnType("TEXT"); - - b.Property("Email") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Sqlite/Migrations/20230408180122_init.cs b/MyOffice.Migration.Sqlite/Migrations/20230408180122_init.cs deleted file mode 100644 index f199468..0000000 --- a/MyOffice.Migration.Sqlite/Migrations/20230408180122_init.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Sqlite.Migrations -{ - /// - public partial class init : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserName = table.Column(type: "TEXT", nullable: false, collation: "NOCASE"), - Email = table.Column(type: "TEXT", nullable: false, collation: "NOCASE"), - PasswordHash = table.Column(type: "TEXT", nullable: false), - FirstName = table.Column(type: "TEXT", nullable: true), - LastName = table.Column(type: "TEXT", nullable: true), - FullName = table.Column(type: "TEXT", nullable: true), - IsEmailConfirmed = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "UserClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CreatedOn = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", nullable: false), - ExternalId = table.Column(type: "TEXT", nullable: false), - Email = table.Column(type: "TEXT", nullable: false, collation: "NOCASE"), - Provider = table.Column(type: "TEXT", nullable: false, collation: "NOCASE") - }, - constraints: table => - { - table.PrimaryKey("PK_UserClaims", x => x.Id); - table.ForeignKey( - name: "FK_UserClaims_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserClaims_UserId", - table: "UserClaims", - column: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserClaims"); - - migrationBuilder.DropTable( - name: "Users"); - } - } -} diff --git a/MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.Designer.cs b/MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.Designer.cs deleted file mode 100644 index 9e9b303..0000000 --- a/MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.Designer.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -using System; -using MyOffice.DbContext; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MyOffice.Migrations.Sqlite.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20230408180149_phone")] - partial class phone - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.0"); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Email") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("FirstName") - .HasColumnType("TEXT"); - - b.Property("FullName") - .HasColumnType("TEXT"); - - b.Property("IsEmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Phone") - .HasColumnType("TEXT"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedOn") - .HasColumnType("TEXT"); - - b.Property("Email") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.cs b/MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.cs deleted file mode 100644 index 470ea12..0000000 --- a/MyOffice.Migration.Sqlite/Migrations/20230408180149_phone.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MyOffice.Migrations.Sqlite.Migrations -{ - /// - public partial class phone : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Phone", - table: "Users", - type: "TEXT", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Phone", - table: "Users"); - } - } -} diff --git a/MyOffice.Migration.Sqlite/Migrations/AppDbContextModelSnapshot.cs b/MyOffice.Migration.Sqlite/Migrations/AppDbContextModelSnapshot.cs deleted file mode 100644 index b788eb0..0000000 --- a/MyOffice.Migration.Sqlite/Migrations/AppDbContextModelSnapshot.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -using System; -using MyOffice.DbContext; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MyOffice.Migrations.Sqlite.Migrations -{ - [DbContext(typeof(AppDbContext))] - partial class AppDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.0"); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Email") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("FirstName") - .HasColumnType("TEXT"); - - b.Property("FullName") - .HasColumnType("TEXT"); - - b.Property("IsEmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Phone") - .HasColumnType("TEXT"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedOn") - .HasColumnType("TEXT"); - - b.Property("Email") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("ExternalId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Provider") - .IsRequired() - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.UserExternal", b => - { - b.HasOne("MyOffice.Data.Models.Users.User", "User") - .WithMany("UserClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("MyOffice.Data.Models.Users.User", b => - { - b.Navigation("UserClaims"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MyOffice.Migration.Sqlite/MyOffice.Migrations.Sqlite.csproj b/MyOffice.Migration.Sqlite/MyOffice.Migrations.Sqlite.csproj index d409654..3da44b2 100644 --- a/MyOffice.Migration.Sqlite/MyOffice.Migrations.Sqlite.csproj +++ b/MyOffice.Migration.Sqlite/MyOffice.Migrations.Sqlite.csproj @@ -19,4 +19,8 @@ + + + + diff --git a/MyOffice.SPA/src/app/api-routes.ts b/MyOffice.SPA/src/app/api-routes.ts index 52774b7..733acc1 100644 --- a/MyOffice.SPA/src/app/api-routes.ts +++ b/MyOffice.SPA/src/app/api-routes.ts @@ -17,11 +17,11 @@ export class ApiRoutes { static SettingsAccount = '/api/settings/accounts/:id'; static SettingsAccountAccountCategory = '/api/settings/accounts/:id/category/:categoryId'; - static SettingsMotionCategories = '/api/settings/motion-categories'; - static SettingsMotionCategory = '/api/settings/motion-categories/:id'; + static SettingsItemCategories = '/api/settings/item-categories'; + static SettingsItemCategory = '/api/settings/item-categories/:id'; - static SettingsMotions = '/api/settings/motions'; - static SettingsMotion = '/api/settings/motions/:id'; + static SettingsItems = '/api/settings/items'; + static SettingsItem = '/api/settings/items/:id'; static Accounts = '/api/accounts'; static Account = '/api/accounts/:id'; diff --git a/MyOffice.SPA/src/app/layout/sidebar/sidebar-items.ts b/MyOffice.SPA/src/app/layout/sidebar/sidebar-items.ts index 5b704c2..72ff57e 100644 --- a/MyOffice.SPA/src/app/layout/sidebar/sidebar-items.ts +++ b/MyOffice.SPA/src/app/layout/sidebar/sidebar-items.ts @@ -229,8 +229,8 @@ export const ROUTES: RouteInfo[] = [ submenu: [], }, { - path: '/settings/motion-categories', - title: 'Motion categories', + path: '/settings/item-categories', + title: 'Item categories', iconType: '', icon: '', class: 'ml-menu', @@ -240,8 +240,8 @@ export const ROUTES: RouteInfo[] = [ submenu: [], }, { - path: '/settings/motions', - title: 'Motions', + path: '/settings/items', + title: 'Items', iconType: '', icon: '', class: 'ml-menu', diff --git a/MyOffice.SPA/src/app/model/motion.category.model.ts b/MyOffice.SPA/src/app/model/item.category.model.ts similarity index 58% rename from MyOffice.SPA/src/app/model/motion.category.model.ts rename to MyOffice.SPA/src/app/model/item.category.model.ts index 3417aa4..ad475e0 100644 --- a/MyOffice.SPA/src/app/model/motion.category.model.ts +++ b/MyOffice.SPA/src/app/model/item.category.model.ts @@ -1,4 +1,4 @@ -export interface MotionCategoryModel { +export interface ItemCategoryModel { id?: string, name?: string, allowDelete: boolean, diff --git a/MyOffice.SPA/src/app/model/motion.model.ts b/MyOffice.SPA/src/app/model/item.model.ts similarity index 75% rename from MyOffice.SPA/src/app/model/motion.model.ts rename to MyOffice.SPA/src/app/model/item.model.ts index 0db69c6..661682d 100644 --- a/MyOffice.SPA/src/app/model/motion.model.ts +++ b/MyOffice.SPA/src/app/model/item.model.ts @@ -1,4 +1,4 @@ -export interface MotionModel { +export interface ItemModel { id?: string, name?: string, categoryId?: string, diff --git a/MyOffice.SPA/src/app/pages/pages-routing.module.ts b/MyOffice.SPA/src/app/pages/pages-routing.module.ts index 857134a..8e4d427 100644 --- a/MyOffice.SPA/src/app/pages/pages-routing.module.ts +++ b/MyOffice.SPA/src/app/pages/pages-routing.module.ts @@ -4,9 +4,9 @@ import { UserProfileComponent } from './user-profile/user-profile.component'; import { SettingsCurrencyComponent } from './settings/currency/currency.component'; import { SettingsAccountCategoryComponent } from './settings/account/account.category.component'; import { SettingsAccountComponent } from './settings/account/account.component'; -import { SettingsMotionCategoryComponent } from './settings/motion/motion.category.component'; -import { SettingsMotionComponent } from './settings/motion/motion.component'; -import { AccountListComponent as AccountComponent } from './accounts/account.list.component'; +import { SettingsItemCategoryComponent } from './settings/item/item.category.component'; +import { SettingsItemComponent } from './settings/item/item.component'; +import { AccountListComponent } from './accounts/account.list.component'; const routes: Routes = [ { @@ -31,16 +31,16 @@ const routes: Routes = [ component: SettingsAccountComponent, }, { - path: 'settings/motion-categories', - component: SettingsMotionCategoryComponent, + path: 'settings/item-categories', + component: SettingsItemCategoryComponent, }, { - path: 'settings/motions', - component: SettingsMotionComponent, + path: 'settings/items', + component: SettingsItemComponent, }, { path: 'account-category/:id', - component: AccountComponent, + component: AccountListComponent, }, ]; diff --git a/MyOffice.SPA/src/app/pages/pages.module.ts b/MyOffice.SPA/src/app/pages/pages.module.ts index 8e644f5..69632c7 100644 --- a/MyOffice.SPA/src/app/pages/pages.module.ts +++ b/MyOffice.SPA/src/app/pages/pages.module.ts @@ -32,10 +32,10 @@ import { SettingsAccountComponent } from './settings/account/account.component'; import { SettingsAccountAddComponent } from './settings/account/add.account.component'; import { SettingsAccountEditComponent } from './settings/account/edit.account.component'; import { CurrencyService } from '../services/currency.service'; -import { MotionService } from '../services/motion.service'; -import { SettingsMotionCategoryComponent } from './settings/motion/motion.category.component'; -import { SettingsMotionComponent } from './settings/motion/motion.component'; -import { SettingsMotionEditComponent } from './settings/motion/edit.motion.component'; +import { ItemService } from '../services/item.service'; +import { SettingsItemCategoryComponent } from './settings/item/item.category.component'; +import { SettingsItemComponent } from './settings/item/item.component'; +import { SettingsItemEditComponent } from './settings/item/edit.item.component'; import { AccountListComponent } from './accounts/account.list.component'; import { AccountComponent } from './accounts/account.component'; import { MotionComponent } from './accounts/motion.component'; @@ -53,9 +53,9 @@ import { MotionComponent } from './accounts/motion.component'; SettingsAccountAddComponent, SettingsAccountEditComponent, - SettingsMotionCategoryComponent, - SettingsMotionComponent, - SettingsMotionEditComponent, + SettingsItemCategoryComponent, + SettingsItemComponent, + SettingsItemEditComponent, AccountListComponent, AccountComponent, @@ -84,7 +84,7 @@ import { MotionComponent } from './accounts/motion.component'; providers: [ { provide: MAT_DATE_LOCALE, useValue: 'en-GB' }, CurrencyService, - MotionService, + ItemService, ], }) export class PagesModule { diff --git a/MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.html b/MyOffice.SPA/src/app/pages/settings/item/edit.item.component.html similarity index 94% rename from MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.html rename to MyOffice.SPA/src/app/pages/settings/item/edit.item.component.html index 3a8d9b8..ab8197c 100644 --- a/MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.html +++ b/MyOffice.SPA/src/app/pages/settings/item/edit.item.component.html @@ -9,7 +9,7 @@
Name - +
diff --git a/MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.scss b/MyOffice.SPA/src/app/pages/settings/item/edit.item.component.scss similarity index 100% rename from MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.scss rename to MyOffice.SPA/src/app/pages/settings/item/edit.item.component.scss diff --git a/MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.ts b/MyOffice.SPA/src/app/pages/settings/item/edit.item.component.ts similarity index 61% rename from MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.ts rename to MyOffice.SPA/src/app/pages/settings/item/edit.item.component.ts index 5d903c4..2542942 100644 --- a/MyOffice.SPA/src/app/pages/settings/motion/edit.motion.component.ts +++ b/MyOffice.SPA/src/app/pages/settings/item/edit.item.component.ts @@ -7,50 +7,49 @@ import { UntypedFormGroup } from '@angular/forms'; import { Validators } from '@angular/forms'; // libs -import Swal from 'sweetalert2'; import { MAT_DIALOG_DATA } from '@angular/material/dialog'; // app import { ApiRoutes } from '../../../api-routes'; import { MatDialogRef } from '@angular/material/dialog'; -import { AccountCategoryModel } from '../../../model/account.category.model'; -import { MotionModel } from '../../../model/motion.model'; -import { MotionService } from '../../../services/motion.service'; +import { ItemCategoryModel } from '../../../model/item.category.model'; +import { ItemModel } from '../../../model/item.model'; +import { ItemService } from '../../../services/item.service'; @Component({ - templateUrl: './edit.motion.component.html', - styleUrls: ['./edit.motion.component.scss'], + templateUrl: './edit.item.component.html', + styleUrls: ['./edit.item.component.scss'], }) -export class SettingsMotionEditComponent { +export class SettingsItemEditComponent { public editForm!: UntypedFormGroup; public errorMessage?: string; - public categories?: AccountCategoryModel[]; + public categories?: ItemCategoryModel[]; constructor( private fb: UntypedFormBuilder, private httpClient: HttpClient, - private dialogRef: MatDialogRef, - private motionService: MotionService, - @Inject(MAT_DIALOG_DATA) public motion: MotionModel + private dialogRef: MatDialogRef, + private itemService: ItemService, + @Inject(MAT_DIALOG_DATA) public item: ItemModel ) { } ngOnInit(): void { this.editForm = this.fb.group({ id: [ - this.motion.id, + this.item.id, ], name: [ - this.motion.name, + this.item.name, [Validators.required], ], category: [ - this.motion.categoryId, + this.item.categoryId, [Validators.required], ], }); - this.motionService + this.itemService .getCategories() .subscribe(x => this.categories = x); } @@ -63,7 +62,7 @@ export class SettingsMotionEditComponent { if (this.editForm.valid) { this.errorMessage = undefined; this.httpClient - .put(ApiRoutes.SettingsMotion.replace(':id', this.motion.id!), this.editForm.value) + .put(ApiRoutes.SettingsItem.replace(':id', this.item.id!), this.editForm.value) .subscribe(response => { this.dialogRef.close({ motion: response, refresh: true }); }, error => { diff --git a/MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.html b/MyOffice.SPA/src/app/pages/settings/item/item.category.component.html similarity index 100% rename from MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.html rename to MyOffice.SPA/src/app/pages/settings/item/item.category.component.html diff --git a/MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.scss b/MyOffice.SPA/src/app/pages/settings/item/item.category.component.scss similarity index 100% rename from MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.scss rename to MyOffice.SPA/src/app/pages/settings/item/item.category.component.scss diff --git a/MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.ts b/MyOffice.SPA/src/app/pages/settings/item/item.category.component.ts similarity index 71% rename from MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.ts rename to MyOffice.SPA/src/app/pages/settings/item/item.category.component.ts index 3e560e9..73b5a40 100644 --- a/MyOffice.SPA/src/app/pages/settings/motion/motion.category.component.ts +++ b/MyOffice.SPA/src/app/pages/settings/item/item.category.component.ts @@ -7,14 +7,14 @@ import Swal from 'sweetalert2'; // app import { ApiRoutes } from '../../../api-routes'; -import { MotionCategoryModel } from '../../../model/motion.category.model'; +import { ItemCategoryModel } from '../../../model/item.category.model'; @Component({ - templateUrl: './motion.category.component.html', - styleUrls: ['./motion.category.component.scss'], + templateUrl: './item.category.component.html', + styleUrls: ['./item.category.component.scss'], }) -export class SettingsMotionCategoryComponent { - public categories?: MotionCategoryModel[]; +export class SettingsItemCategoryComponent { + public categories?: ItemCategoryModel[]; constructor( private httpClient: HttpClient, @@ -27,7 +27,7 @@ export class SettingsMotionCategoryComponent { private load() { this.httpClient - .get(ApiRoutes.SettingsMotionCategories) + .get(ApiRoutes.SettingsItemCategories) .subscribe(data => { this.categories = data; }); @@ -35,7 +35,7 @@ export class SettingsMotionCategoryComponent { public add() { Swal.fire({ - title: 'Motion category name', + title: 'Item category name', input: 'text', inputAttributes: { autocapitalize: 'off', @@ -45,7 +45,7 @@ export class SettingsMotionCategoryComponent { showLoaderOnConfirm: true, preConfirm: (name) => { return new Promise((resolve, reject) => { - this.httpClient.post(ApiRoutes.SettingsMotionCategories, { name: name }) + this.httpClient.post(ApiRoutes.SettingsItemCategories, { name: name }) .subscribe(data => { resolve(data); }, error => { @@ -63,9 +63,9 @@ export class SettingsMotionCategoryComponent { }); } - public edit(category: MotionCategoryModel) { + public edit(category: ItemCategoryModel) { Swal.fire({ - title: 'Motion category name', + title: 'Item category name', input: 'text', inputValue: category.name, inputAttributes: { @@ -76,7 +76,7 @@ export class SettingsMotionCategoryComponent { showLoaderOnConfirm: true, preConfirm: (name) => { return new Promise((resolve, reject) => { - this.httpClient.put(ApiRoutes.SettingsMotionCategory.replace(':id', category.id!), { name: name }) + this.httpClient.put(ApiRoutes.SettingsItemCategory.replace(':id', category.id!), { name: name }) .subscribe(data => { resolve(data); }, error => { @@ -94,15 +94,15 @@ export class SettingsMotionCategoryComponent { }); } - public remove(category: MotionCategoryModel) { + public remove(category: ItemCategoryModel) { Swal.fire({ - title: 'Remove motion category ' + category.name, + title: 'Remove item category ' + category.name, showCancelButton: true, confirmButtonText: 'Delete', showLoaderOnConfirm: true, preConfirm: (name) => { return new Promise((resolve, reject) => { - this.httpClient.delete(ApiRoutes.SettingsMotionCategory.replace(':id', category.id!)) + this.httpClient.delete(ApiRoutes.SettingsItemCategory.replace(':id', category.id!)) .subscribe(data => { resolve(data); }, error => { diff --git a/MyOffice.SPA/src/app/pages/settings/motion/motion.component.html b/MyOffice.SPA/src/app/pages/settings/item/item.component.html similarity index 95% rename from MyOffice.SPA/src/app/pages/settings/motion/motion.component.html rename to MyOffice.SPA/src/app/pages/settings/item/item.component.html index ab71e3b..3de48a8 100644 --- a/MyOffice.SPA/src/app/pages/settings/motion/motion.component.html +++ b/MyOffice.SPA/src/app/pages/settings/item/item.component.html @@ -2,7 +2,7 @@
- +
@@ -35,7 +35,7 @@
- +
{{item.name}}