Skip to content

Commit b3e94e7

Browse files
committed
EES-5639 Simplifying some logic when deleting Release blob cache
1 parent 61074d2 commit b3e94e7

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/GovUk.Education.ExploreEducationStatistics.Content.Services.Tests/Cache/ReleaseCacheServiceTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Threading.Tasks;
44
using GovUk.Education.ExploreEducationStatistics.Common.Model;
55
using GovUk.Education.ExploreEducationStatistics.Common.Model.Chart;
6+
using GovUk.Education.ExploreEducationStatistics.Common.Services;
7+
using GovUk.Education.ExploreEducationStatistics.Common.Services.Interfaces;
68
using GovUk.Education.ExploreEducationStatistics.Common.Tests.Extensions;
79
using GovUk.Education.ExploreEducationStatistics.Common.Tests.Fixtures;
810
using GovUk.Education.ExploreEducationStatistics.Content.Model;
@@ -373,10 +375,12 @@ private static ContentSectionViewModel ContentSectionWithHtmlBlock()
373375
}
374376

375377
private static ReleaseCacheService BuildService(
376-
IReleaseService? releaseService = null
378+
IReleaseService? releaseService = null,
379+
IPublicBlobStorageService? publicBlobStorageService = null
377380
)
378381
{
379382
return new ReleaseCacheService(
380-
releaseService: releaseService ?? Mock.Of<IReleaseService>(Strict));
383+
releaseService: releaseService ?? Mock.Of<IReleaseService>(Strict),
384+
publicBlobStorageService: publicBlobStorageService ?? Mock.Of<IPublicBlobStorageService>(Strict));
381385
}
382386
}

src/GovUk.Education.ExploreEducationStatistics.Content.Services/Cache/ReleaseCacheService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using GovUk.Education.ExploreEducationStatistics.Common.Cache;
77
using GovUk.Education.ExploreEducationStatistics.Common.Extensions;
88
using GovUk.Education.ExploreEducationStatistics.Common.Model;
9+
using GovUk.Education.ExploreEducationStatistics.Common.Services;
910
using GovUk.Education.ExploreEducationStatistics.Common.Services.Interfaces;
1011
using GovUk.Education.ExploreEducationStatistics.Content.Services.Interfaces;
1112
using GovUk.Education.ExploreEducationStatistics.Content.Services.Interfaces.Cache;
@@ -50,12 +51,11 @@ public async Task<Either<ActionResult, Unit>> RemoveRelease(
5051
string publicationSlug,
5152
string releaseSlug)
5253
{
53-
await publicBlobStorageService.DeleteBlobs(
54+
await publicBlobStorageService.DeleteBlob(
5455
containerName: BlobContainers.PublicContent,
55-
options: new IBlobStorageService.DeleteBlobsOptions
56-
{
57-
IncludeRegex = new Regex($"^publications/{publicationSlug.TrimToLower()}/releases/{releaseSlug.TrimToLower()}.json")
58-
}
56+
path: FileStoragePathUtils.PublicContentReleasePath(
57+
publicationSlug: publicationSlug,
58+
releaseSlug: releaseSlug)
5959
);
6060

6161
return Unit.Instance;

0 commit comments

Comments
 (0)