mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Adds the capability of adding a Book via API
This commit is contained in:
1 parent
6459b6f2c2
commit
0eb7b453f6
61 files changed
+1276
-255
No files matched your search
+15
-1
@@ -1,6 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Text.Json.Serialization;
|
||||
using Lumina.Application.Common.Converters;
|
||||
using Lumina.Presentation.Api.Common.Configuration;
|
||||
using Lumina.Presentation.Api.Common.Errors;
|
||||
using Mapster;
|
||||
using MapsterMapper;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
#endregion
|
||||
@@ -21,7 +25,11 @@ public static class PresentationApiLayerServices
|
||||
public static IServiceCollection AddPresentationApiLayerServices(this IServiceCollection services)
|
||||
{
|
||||
// add services to the container
|
||||
services.AddControllers();
|
||||
services.AddControllers().AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
|
||||
options.JsonSerializerOptions.Converters.Add(new OptionalJsonConverterFactory());
|
||||
});
|
||||
|
||||
// add services to the container.
|
||||
services.AddEndpointsApiExplorer();
|
||||
@@ -43,6 +51,12 @@ public static class PresentationApiLayerServices
|
||||
|
||||
services.AddSingleton<ProblemDetailsFactory, CustomProblemDetailsFactory>();
|
||||
|
||||
// register mapster configs
|
||||
var mapsterConfig = TypeAdapterConfig.GlobalSettings;
|
||||
mapsterConfig.Scan(typeof(PresentationApiLayerServices).Assembly);
|
||||
services.AddSingleton(mapsterConfig);
|
||||
services.AddScoped<IMapper, ServiceMapper>();
|
||||
|
||||
return services;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user