Added missing scope (#14460)

This commit is contained in:
Andreas Zerbst
2023-06-26 16:43:22 +02:00
committed by GitHub
parent 437db52e5e
commit de235c224a

View File

@@ -176,6 +176,7 @@ public class PackagingService : IPackagingService
/// <inheritdoc/>
public async Task<Attempt<PackageDefinition, PackageOperationStatus>> CreateCreatedPackageAsync(PackageDefinition package, Guid userKey)
{
using ICoreScope scope = _coreScopeProvider.CreateCoreScope();
if (_createdPackages.SavePackage(package) == false)
{
if (string.IsNullOrEmpty(package.Name))
@@ -188,6 +189,7 @@ public class PackagingService : IPackagingService
int currentUserId = _userService.GetAsync(userKey).Result?.Id ?? Constants.Security.SuperUserId;
_auditService.Add(AuditType.New, currentUserId, -1, "Package", $"Created package '{package.Name}' created. Package key: {package.PackageId}");
scope.Complete();
return await Task.FromResult(Attempt.SucceedWithStatus(PackageOperationStatus.Success, package));
}