Rework dictionary CRUD operations (#13688)

* Rework dictionary CRUD operations

* Update OpenAPI json

* Move responsibility to localization service, introduce new attempt pattern for create and update operations, update unit tests accordingly

* Fix merge

* Rollback assumption that we can map entities from scratch (entity relations got in the way)

* Update OpenAPI JSON

* Add breakage supressions

* Add compat suppressions for integration test project

* Make dictionary item deletion follow same pattern as create and update

* Review comments + update delete to use new pattern

* Update breakage suppressions to match the new Delete method
This commit is contained in:
Kenn Jacobsen
2023-01-20 13:40:24 +01:00
committed by GitHub
parent 4be798ddfb
commit ff2d90d775
29 changed files with 871 additions and 840 deletions

View File

@@ -240,9 +240,10 @@ public class ScopedRepositoryTests : UmbracoIntegrationTest
var lang = new Language("fr-FR", "French (France)");
service.Save(lang);
var item = (IDictionaryItem)new DictionaryItem("item-key");
item.Translations = new IDictionaryTranslation[] { new DictionaryTranslation(lang.Id, "item-value") };
service.Save(item);
var item = service.Create(
"item-key",
null,
new IDictionaryTranslation[] { new DictionaryTranslation(lang.Id, "item-value") }).Result!;
// Refresh the cache manually because we can't unbind
service.GetDictionaryItemById(item.Id);
@@ -266,7 +267,7 @@ public class ScopedRepositoryTests : UmbracoIntegrationTest
Assert.AreNotSame(globalCache, scopedCache);
item.ItemKey = "item-changed";
service.Save(item);
service.Update(item);
// scoped cache contains the "new" entity
var scopeCached = (IDictionaryItem)scopedCache.Get(GetCacheIdKey<IDictionaryItem>(item.Id), () => null);