-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean account accountgroup parent relation to bea ble to attach accou…
…nts in different classifications
- Loading branch information
Showing
12 changed files
with
67 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/Ubik.Accounting.Api/Data/Init/AccountsAccountGroupsData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using Ubik.Accounting.Api.Models; | ||
|
||
namespace Ubik.Accounting.Api.Data.Init | ||
{ | ||
internal class AccountsAccountGroupsData | ||
{ | ||
internal static void Load(AccountingContext context) | ||
{ | ||
if (!context.AccountsAccountGroups.Any()) | ||
{ | ||
var baseValuesGeneral = new BaseValuesGeneral(); | ||
var baseValuesForTenants = new BaseValuesForTenants(); | ||
var baseValuesForUsers = new BaseValuesForUsers(); | ||
var baseValuesForAccountGroups = new BaseValuesForAccountGroups(); | ||
var baseValuesForAccounts = new BaseValuesForAccounts(); | ||
|
||
var accountsAccountGroups = new AccountAccountGroup[] | ||
{ | ||
new AccountAccountGroup | ||
{ | ||
Id = Guid.NewGuid(), | ||
AccountGroupId = baseValuesForAccountGroups.AccountGroupId1, | ||
AccountId= baseValuesForAccounts.AccountId1, | ||
CreatedBy = baseValuesForUsers.UserId1, | ||
CreatedAt = baseValuesGeneral.GenerationTime, | ||
ModifiedBy = baseValuesForUsers.UserId1, | ||
ModifiedAt = baseValuesGeneral.GenerationTime, | ||
Version = Guid.NewGuid(), | ||
TenantId = baseValuesForTenants.TenantId | ||
}, | ||
new AccountAccountGroup | ||
{ | ||
Id = Guid.NewGuid(), | ||
AccountGroupId = baseValuesForAccountGroups.AccountGroupId1, | ||
AccountId= baseValuesForAccounts.AccountId2, | ||
CreatedBy = baseValuesForUsers.UserId1, | ||
CreatedAt = baseValuesGeneral.GenerationTime, | ||
ModifiedBy = baseValuesForUsers.UserId1, | ||
ModifiedAt = baseValuesGeneral.GenerationTime, | ||
Version = Guid.NewGuid(), | ||
TenantId = baseValuesForTenants.TenantId | ||
}, | ||
new AccountAccountGroup | ||
{ | ||
Id = Guid.NewGuid(), | ||
AccountGroupId = baseValuesForAccountGroups.AccountGroupId2, | ||
AccountId= baseValuesForAccounts.AccountId1, | ||
CreatedBy = baseValuesForUsers.UserId1, | ||
CreatedAt = baseValuesGeneral.GenerationTime, | ||
ModifiedBy = baseValuesForUsers.UserId1, | ||
ModifiedAt = baseValuesGeneral.GenerationTime, | ||
Version = Guid.NewGuid(), | ||
TenantId = baseValuesForTenants.TenantId | ||
} | ||
}; | ||
foreach (AccountAccountGroup aag in accountsAccountGroups) | ||
{ | ||
context.AccountsAccountGroups.Add(aag); | ||
} | ||
context.SaveChanges(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...ik.Accounting.Api/Features/Accounts/Exceptions/AccountGroupNotFoundExceptionForAccount.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters