Beispiel #1
0
        private async Task DeleteLazilyCachedReleaseResults(string publicationSlug, string releaseSlug)
        {
            await _blobCacheService.DeleteCacheFolder(new ReleaseDataBlockResultsFolderCacheKey(publicationSlug, releaseSlug));

            await _blobCacheService.DeleteItem(new ReleaseSubjectsCacheKey(publicationSlug, releaseSlug));

            await _blobCacheService.DeleteCacheFolder(new ReleaseFastTrackResultsFolderCacheKey(publicationSlug, releaseSlug));

            await _blobCacheService.DeleteCacheFolder(new ReleaseSubjectMetaFolderCacheKey(publicationSlug, releaseSlug));
        }
Beispiel #2
0
        public Task <Either <ActionResult, Unit> > DeleteRelease(Guid releaseId)
        {
            return(_persistenceHelper
                   .CheckEntityExists <Release>(releaseId)
                   .OnSuccess(_userService.CheckCanDeleteRelease)
                   .OnSuccessDo(async release => await _cacheService.DeleteCacheFolder(
                                    new ReleaseContentFolderCacheKey(release.PublicationId, release.Id)))
                   .OnSuccessDo(async() => await _releaseDataFileService.DeleteAll(releaseId))
                   .OnSuccessDo(async() => await _releaseFileService.DeleteAll(releaseId))
                   .OnSuccessVoid(async release =>
            {
                release.SoftDeleted = true;
                _context.Update(release);

                var roles = await _context
                            .UserReleaseRoles
                            .AsQueryable()
                            .Where(r => r.ReleaseId == releaseId)
                            .ToListAsync();
                roles.ForEach(r => r.SoftDeleted = true);
                _context.UpdateRange(roles);

                var invites = await _context
                              .UserReleaseInvites
                              .AsQueryable()
                              .Where(r => r.ReleaseId == releaseId)
                              .ToListAsync();
                invites.ForEach(r => r.SoftDeleted = true);
                _context.UpdateRange(invites);

                var methodologiesScheduledWithRelease =
                    GetMethodologiesScheduledWithRelease(releaseId);

                // TODO EES-2747 - this should be looked at to see how best to reuse similar "set to draft" logic
                // in MethodologyApprovalService.
                methodologiesScheduledWithRelease.ForEach(m =>
                {
                    m.PublishingStrategy = Immediately;
                    m.Status = Draft;
                    m.ScheduledWithRelease = null;
                    m.ScheduledWithReleaseId = null;
                    m.InternalReleaseNote = null;
                    m.Updated = DateTime.UtcNow;
                });

                _context.UpdateRange(methodologiesScheduledWithRelease);

                await _context.SaveChangesAsync();

                await _releaseSubjectRepository.SoftDeleteAllReleaseSubjects(releaseId);
            }));
        }
Beispiel #3
0
 private Task DeleteCachedReleaseContent(Guid releaseId, Guid publicationId)
 {
     return(_cacheService.DeleteCacheFolder(new ReleaseContentFolderCacheKey(publicationId, releaseId)));
 }