-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #871 from dlcs/feature/empty_members
Allow batch with empty 'members' in legacy mode
- Loading branch information
Showing
6 changed files
with
133 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/protagonist/API/Features/Queues/Requests/CreateEmptyBatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using API.Infrastructure.Requests; | ||
using DLCS.Core; | ||
using DLCS.Model.Assets; | ||
using MediatR; | ||
|
||
namespace API.Features.Queues.Requests; | ||
|
||
/// <summary> | ||
/// Handler that creates an empty batch of 0 images | ||
/// </summary> | ||
public class CreateEmptyBatch : IRequest<ModifyEntityResult<Batch>> | ||
{ | ||
public int CustomerId { get; } | ||
|
||
public CreateEmptyBatch(int customerId) | ||
{ | ||
CustomerId = customerId; | ||
} | ||
} | ||
|
||
public class CreateEmptyBatchHandler : IRequestHandler<CreateEmptyBatch, ModifyEntityResult<Batch>> | ||
{ | ||
private readonly IBatchRepository batchRepository; | ||
|
||
public CreateEmptyBatchHandler(IBatchRepository batchRepository) | ||
{ | ||
this.batchRepository = batchRepository; | ||
} | ||
|
||
public async Task<ModifyEntityResult<Batch>> Handle(CreateEmptyBatch request, CancellationToken cancellationToken) | ||
{ | ||
var batch = await batchRepository.CreateBatch(request.CustomerId, Array.Empty<Asset>(), cancellationToken); | ||
return ModifyEntityResult<Batch>.Success(batch, WriteResult.Created); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters