diff options
author | crupest <crupest@outlook.com> | 2019-12-10 13:55:44 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-12-10 13:55:44 +0800 |
commit | e95030ec056577143f37c06de8351ba511e7ff75 (patch) | |
tree | 584876517cb343d207d2b613706c69d748613370 /Timeline/Startup.cs | |
parent | b89ecc4e9eecec7bd22b0f35db60dd26b7098799 (diff) | |
parent | 1bb9a2a622955e7c0a0b75e36fb1673cb9f3aca5 (diff) | |
download | timeline-e95030ec056577143f37c06de8351ba511e7ff75.tar.gz timeline-e95030ec056577143f37c06de8351ba511e7ff75.tar.bz2 timeline-e95030ec056577143f37c06de8351ba511e7ff75.zip |
Merge branch 'master' of github.com:crupest/Timeline
Diffstat (limited to 'Timeline/Startup.cs')
-rw-r--r-- | Timeline/Startup.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Timeline/Startup.cs b/Timeline/Startup.cs index b2e958f9..672e5f15 100644 --- a/Timeline/Startup.cs +++ b/Timeline/Startup.cs @@ -8,11 +8,13 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Globalization;
+using System.Text.Json.Serialization;
using Timeline.Auth;
using Timeline.Configs;
using Timeline.Entities;
using Timeline.Formatters;
using Timeline.Helpers;
+using Timeline.Models.Converters;
using Timeline.Services;
namespace Timeline
@@ -36,11 +38,15 @@ namespace Timeline {
setup.InputFormatters.Add(new StringInputFormatter());
})
- .ConfigureApiBehaviorOptions(options =>
- {
- options.InvalidModelStateResponseFactory = InvalidModelResponseFactory.Factory;
- })
- .AddNewtonsoftJson(); // TODO: Remove this.
+ .AddJsonOptions(options =>
+ {
+ options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
+ options.JsonSerializerOptions.Converters.Add(new JsonDateTimeConverter());
+ })
+ .ConfigureApiBehaviorOptions(options =>
+ {
+ options.InvalidModelStateResponseFactory = InvalidModelResponseFactory.Factory;
+ });
services.Configure<JwtConfig>(Configuration.GetSection(nameof(JwtConfig)));
var jwtConfig = Configuration.GetSection(nameof(JwtConfig)).Get<JwtConfig>();
|