Bookmark Refactor (#1049)

* Tweaked how the migration to change users with ChangePassword role happens. It will now only run once.

* Refactored bookmarks into it's own service with unit tests. Bookmark management happens in real time and we no longer delete bookmarks on a schedule. This means once you bookmark something, even if you delete the entity, the files will remain.

* Commented out a test that no longer is needed
This commit is contained in:
Joseph Milazzo 2022-02-08 13:43:24 -08:00 committed by GitHub
parent 9c9a5f92a1
commit 05c35a1cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 685 additions and 230 deletions

View file

@ -5,6 +5,7 @@ using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
using API.Entities;
using API.Extensions;
@ -150,7 +151,12 @@ namespace API
await MigrateBookmarks.Migrate(directoryService, unitOfWork,
logger, cacheService);
await MigrateChangePasswordRoles.Migrate(unitOfWork, userManager);
// Only run this if we are upgrading
var usersWithRole = await userManager.GetUsersInRoleAsync(PolicyConstants.ChangePasswordRole);
if (usersWithRole.Count == 0)
{
await MigrateChangePasswordRoles.Migrate(unitOfWork, userManager);
}
var requiresCoverImageMigration = !Directory.Exists(directoryService.CoverImageDirectory);
try