Skip to content

Commit

Permalink
code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JackLewis-digirati committed Jan 9, 2024
1 parent 14f6993 commit 60ca350
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public async Task ProcessImage_CreatesAndRemovesRequiredDirectories()
[Fact]
public async Task ProcessImage_False_IfImageProcessorCallFails()
{
// Arrange
// Arrange
var imageProcessorResponse = new AppetiserResponseErrorModel()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async Task<bool> ProcessImage(IngestionContext context)
return (dest, thumb);
}

private async Task<AppetiserResponse> CallImageProcessor(IngestionContext context,
private async Task<IAppetiserResponse> CallImageProcessor(IngestionContext context,
ImageProcessorFlags processorFlags)
{
// call tizer/appetiser
Expand All @@ -113,9 +113,8 @@ private async Task<AppetiserResponse> CallImageProcessor(IngestionContext contex
}

using var response = await httpClient.SendAsync(request);

// TODO - it's possible to get a 200 when appetiser doesn't do anything, e.g. body not understood
AppetiserResponse? responseModel = null;

IAppetiserResponse? responseModel;

if (response.IsSuccessStatusCode)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace Engine.Ingest.Image.Appetiser;

public class AppetiserResponse
public interface IAppetiserResponse
{
public ResponseType ResponseType { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
/// <summary>
/// Response model for receiving error requests back from Appetiser.
/// </summary>
public class AppetiserResponseErrorModel : AppetiserResponse
public class AppetiserResponseErrorModel : IAppetiserResponse
{
public AppetiserResponseErrorModel()
{
ResponseType = ResponseType.ErrorResponse;
}
public string Message { get; set; }
public string Status { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
namespace Engine.Ingest.Image.Appetiser;

public enum ResponseType
{
SuccessResponse,
ErrorResponse
}

/// <summary>
/// Response model for receiving requests back from Appetiser.
/// </summary>
public class AppetiserResponseModel : AppetiserResponse
public class AppetiserResponseModel : IAppetiserResponse
{
public AppetiserResponseModel()
{
ResponseType = ResponseType.SuccessResponse;
}

public string ImageId { get; set; }
public string JobId { get; set; }
public string Optimisation { get; set; }
Expand Down

0 comments on commit 60ca350

Please sign in to comment.