Skip to content

Commit

Permalink
PlanBGmbH#66 Meal Service updated
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusMeyer13 committed Feb 29, 2020
1 parent 73b4aa1 commit baa6f30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions PlanB.Butler.Services/PlanB.Butler.Services/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ internal static class Constants
/// <summary>
/// The butler correlation trace name.
/// </summary>
internal const string ButlerCorrelationTraceName = "Butler-Correlation-Id";
internal const string ButlerCorrelationTraceName = "ButlerCorrelationId";

/// <summary>
/// The butler correlation trace header.
/// </summary>
internal const string ButlerCorrelationTraceHeader = "ButlerCorrelationId";
internal const string ButlerCorrelationTraceHeader = "Butler-Correlation-Id";
}
}
4 changes: 1 addition & 3 deletions PlanB.Butler.Services/PlanB.Butler.Services/MealService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public static async Task<IActionResult> CreateMeal(
var metaDate = mealModel.Date.ToString("yyyyMMdd", CultureInfo.InvariantCulture);
blob.Metadata.Add(MetaDate, metaDate);
blob.Metadata.Add(MetaRestaurant, mealModel.Restaurant);

// blob.Metadata.Add(Constants.ButlerCorrelationTraceName, correlationId.ToString().Replace("-", string.Empty));
blob.Metadata.Add(Constants.ButlerCorrelationTraceName, correlationId.ToString().Replace("-", string.Empty));
var meal = JsonConvert.SerializeObject(mealModel);
trace.Add("meal", meal);

Expand All @@ -116,7 +115,6 @@ public static async Task<IActionResult> CreateMeal(
};

actionResult = new BadRequestObjectResult(errorModel);
throw;
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static async Task<IActionResult> CreateRestaurant(

RestaurantModel restaurantModel = JsonConvert.DeserializeObject<RestaurantModel>(requestBody);

var filename = $"{restaurantModel.Name}.json";
var filename = $"{restaurantModel.Name}-{restaurantModel.City}.json";
trace.Add($"filename", filename);

req.HttpContext.Response.Headers.Add(Constants.ButlerCorrelationTraceHeader, correlationId.ToString());
Expand All @@ -140,6 +140,7 @@ public static async Task<IActionResult> CreateRestaurant(
trace.Add("restaurant", restaurant);

Task task = blob.UploadTextAsync(requestBody);
task.Wait();
}

log.LogInformation(correlationId, $"'{methodName}' - success", trace);
Expand All @@ -159,7 +160,6 @@ public static async Task<IActionResult> CreateRestaurant(
};

actionResult = new BadRequestObjectResult(errorModel);
throw;
}
finally
{
Expand Down

0 comments on commit baa6f30

Please sign in to comment.