From c2bc78d8542bcb5f23c9e6012983b1e8c0cc53c0 Mon Sep 17 00:00:00 2001 From: Omar Faruk Date: Fri, 6 Sep 2024 16:55:33 +0100 Subject: [PATCH] Fixed error in book publishing --- src/Inshapardaz.Api/Program.cs | 8 ++++++-- .../Ports/Command/Library/Book/PublishBookRequest.cs | 6 ++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Inshapardaz.Api/Program.cs b/src/Inshapardaz.Api/Program.cs index 50ed04f2..c2f4f692 100644 --- a/src/Inshapardaz.Api/Program.cs +++ b/src/Inshapardaz.Api/Program.cs @@ -43,11 +43,11 @@ builder.Host.UseSerilog((ctx, cfg) => { var config = cfg.Enrich.WithProperty("Application", serviceName) - .Enrich.WithProperty("Environment", ctx.HostingEnvironment.EnvironmentName) - .WriteTo.Console(new RenderedCompactJsonFormatter()); + .Enrich.WithProperty("Environment", ctx.HostingEnvironment.EnvironmentName); if (!string.IsNullOrEmpty(ctx.Configuration["elk"])) { + config.WriteTo.Console(new RenderedCompactJsonFormatter()); config.WriteTo.Elasticsearch(new[] { new Uri(ctx.Configuration["elk"]) }, opts => { opts.BootstrapMethod = BootstrapMethod.Failure; @@ -64,6 +64,10 @@ // transport.Authentication(new ApiKey(base64EncodedApiKey)); // ApiKey }); } + else + { + config.WriteTo.Console(); + } }); //-------------------------------------------------------------------- diff --git a/src/Inshapardaz.Domain/Ports/Command/Library/Book/PublishBookRequest.cs b/src/Inshapardaz.Domain/Ports/Command/Library/Book/PublishBookRequest.cs index db00ef87..3b13eaac 100644 --- a/src/Inshapardaz.Domain/Ports/Command/Library/Book/PublishBookRequest.cs +++ b/src/Inshapardaz.Domain/Ports/Command/Library/Book/PublishBookRequest.cs @@ -15,16 +15,14 @@ namespace Inshapardaz.Domain.Ports.Command.Library.Book; -public class PublishBookRequest : RequestBase +public class PublishBookRequest : LibraryBaseCommand { - public PublishBookRequest(int libraryId, int bookId) + public PublishBookRequest(int libraryId, int bookId) : base(libraryId) { - LibraryId = libraryId; BookId = bookId; } public string Result { get; set; } - public int LibraryId { get; } public int BookId { get; } }