aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Startup.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-12-10 13:55:44 +0800
committercrupest <crupest@outlook.com>2019-12-10 13:55:44 +0800
commite95030ec056577143f37c06de8351ba511e7ff75 (patch)
tree584876517cb343d207d2b613706c69d748613370 /Timeline/Startup.cs
parentb89ecc4e9eecec7bd22b0f35db60dd26b7098799 (diff)
parent1bb9a2a622955e7c0a0b75e36fb1673cb9f3aca5 (diff)
downloadtimeline-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.cs16
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>();