Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin UI: tier quota definition is not deleted from the database after removing it from a tier #519

Merged
merged 45 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c2f7f8c
dependency: add EntityFrameworkCore.Triggered
NikolaVetnic Feb 8, 2024
9fcdc96
fix: set AfterSave trigger that deletes orphaned tier quota definitions
NikolaVetnic Feb 8, 2024
faf3fa6
feat: add RemoveTierQuotaDefinitionIfOrphaned
NikolaVetnic Feb 8, 2024
cb83f26
chore: fix failing pipeline tests
NikolaVetnic Feb 8, 2024
89f4c4f
chore: fix formatting
NikolaVetnic Feb 8, 2024
7750272
chore: fix failing ci/cd tests
NikolaVetnic Feb 8, 2024
46ddb07
Merge main into tierquotadefinition-deletion-bug
github-actions[bot] Feb 9, 2024
787cf58
Merge main into tierquotadefinition-deletion-bug
github-actions[bot] Feb 9, 2024
03a8ab5
Merge main into tierquotadefinition-deletion-bug
github-actions[bot] Feb 9, 2024
fca546d
Merge main into tierquotadefinition-deletion-bug
github-actions[bot] Feb 9, 2024
1a41e14
Merge main into tierquotadefinition-deletion-bug
github-actions[bot] Feb 9, 2024
27fe9f7
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 9, 2024
3f2b47a
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 12, 2024
e34e473
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 12, 2024
b69f9e8
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 12, 2024
e04af01
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 12, 2024
75905ae
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 13, 2024
448b226
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 13, 2024
738c375
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 14, 2024
faaaed8
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 14, 2024
843f2de
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 14, 2024
6ed5e60
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 16, 2024
d6899f9
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 19, 2024
68738cd
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 19, 2024
48d2457
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 19, 2024
ed6e1dc
feat: remove orphaned TierQuotaDefinition entries using ChangeTracker
NikolaVetnic Feb 20, 2024
a81194f
chore: remove EntityFrameworkCore.Triggered dependency
NikolaVetnic Feb 20, 2024
a6528e1
Merge branch 'tierquotadefinition-deletion-bug' of github.com:nmshd/b…
NikolaVetnic Feb 20, 2024
803a69b
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 20, 2024
a408012
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 21, 2024
3540b68
chore: remove unnecessary method
NikolaVetnic Feb 21, 2024
01e8901
feat: ensure only modified and orphaned TierQuotaDefinitions are deleted
NikolaVetnic Feb 21, 2024
f102a56
Merge branch 'tierquotadefinition-deletion-bug' of github.com:nmshd/b…
NikolaVetnic Feb 21, 2024
9fecb56
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 21, 2024
53b189b
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 21, 2024
a71abe0
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 22, 2024
d7ef973
test: add TierQuotaDefinition deletion test
NikolaVetnic Feb 22, 2024
41e1abc
Merge branch 'tierquotadefinition-deletion-bug' of github.com:nmshd/b…
NikolaVetnic Feb 22, 2024
ab2827c
chore: fix formatting
NikolaVetnic Feb 22, 2024
3d4047c
refactor: simplify RemoveOrphanedTierQuotaDefinitions
tnotheis Feb 22, 2024
bd58afa
test: improve/rewrite test
tnotheis Feb 22, 2024
d1ae496
chore: move MessagesRepositoryTests to Quotas.Infrastructure.Tests
tnotheis Feb 22, 2024
df7f138
refactor: simplify "IsNullOrEmpty" extension method
tnotheis Feb 22, 2024
fe63a16
chore: remove redundant properties from Quotas.Infrastructure.Tests.c…
tnotheis Feb 22, 2024
971e25c
Merge branch 'main' into tierquotadefinition-deletion-bug
mergify[bot] Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ public interface ITiersRepository
Task<Tier?> Find(string id, CancellationToken cancellationToken, bool track = false);
Task<TierQuotaDefinition> FindTierQuotaDefinition(string id, CancellationToken cancellationToken, bool track = false);
Task RemoveById(TierId tierId);
Task RemoveTierQuotaDefinitionIfOrphaned(TierQuotaDefinitionId tierQuotaDefinitionId);
Task Update(Tier tier, CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,22 @@ public async Task RemoveById(TierId tierId)
await _tiers.Where(t => t.Id == tierId).ExecuteDeleteAsync();
}

public async Task RemoveTierQuotaDefinitionIfOrphaned(TierQuotaDefinitionId tierQuotaDefinitionId)
{
var tierQuotaDefinition = await _tierQuotaDefinitions.FirstWithId(tierQuotaDefinitionId, CancellationToken.None);

if (_dbContext.Entry(tierQuotaDefinition).Property("TierId").CurrentValue == null)
await _tierQuotaDefinitions.Where(t => t.Id == tierQuotaDefinitionId).ExecuteDeleteAsync();
}

public async Task Update(Tier tier, CancellationToken cancellationToken)
{
_dbContext.RemoveRange(_dbContext.ChangeTracker
.Entries<TierQuotaDefinition>()
.Where(e => e.State == EntityState.Modified)
.Select(e => e.Entity)
.ToList());

_tiers.Update(tier);
await _dbContext.SaveChangesAsync(cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public Task RemoveById(TierId tierId)
throw new NotImplementedException();
}

public Task RemoveTierQuotaDefinitionIfOrphaned(TierQuotaDefinitionId tierQuotaDefinitionId)
{
throw new NotImplementedException();
}

public Task Update(Tier tier, CancellationToken cancellationToken)
{
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public Task RemoveById(TierId tierId)
throw new NotImplementedException();
}

public Task RemoveTierQuotaDefinitionIfOrphaned(TierQuotaDefinitionId tierQuotaDefinitionId)
{
throw new NotImplementedException();
}

public Task Update(Tier tier, CancellationToken cancellationToken)
{
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public Task RemoveById(TierId tierId)
throw new NotImplementedException();
}

public Task RemoveTierQuotaDefinitionIfOrphaned(TierQuotaDefinitionId tierQuotaDefinitionId)
{
throw new NotImplementedException();
}

public Task Update(Tier tier, CancellationToken cancellationToken)
{
throw new NotImplementedException();
Expand Down