feat(esppApi): Добавлено поле ExpirationDate в модель EsppOrder
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using PARR.EsppApi.Settings;
|
||||||
|
using System.Globalization;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace PARR.EsppApi.Models
|
namespace PARR.EsppApi.Models
|
||||||
@@ -10,14 +11,33 @@ namespace PARR.EsppApi.Models
|
|||||||
{
|
{
|
||||||
[JsonPropertyName("recordid")]
|
[JsonPropertyName("recordid")]
|
||||||
public string Number { get; set; } = string.Empty;
|
public string Number { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonPropertyName("assignment")]
|
[JsonPropertyName("assignment")]
|
||||||
public string? WorkGroup { get; set; }
|
public string? WorkGroup { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("status")]
|
[JsonPropertyName("status")]
|
||||||
public string Status { get; set; } = string.Empty;
|
public string Status { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonPropertyName("title")]
|
[JsonPropertyName("title")]
|
||||||
public string ShortName { get; set; } = string.Empty;
|
public string ShortName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[JsonPropertyName("templateName")]
|
[JsonPropertyName("templateName")]
|
||||||
public string TemplateName { get; set; } = string.Empty;
|
public string TemplateName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[JsonPropertyName("expirationDate")]
|
||||||
|
public string ExpirationDate { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTimeOffset ExpirationDateUTC
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var dateTime = DateTime.ParseExact(ExpirationDate, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
|
||||||
|
var utc = dateTime.AddHours(-EsppUserTimeZoneSettings.TimeZone);
|
||||||
|
|
||||||
|
return new DateTimeOffset(utc, new TimeSpan(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace PARR.EsppApi
|
|||||||
configuration.GetSection(nameof(EsppOrderSettings)).Bind(esppSettings);
|
configuration.GetSection(nameof(EsppOrderSettings)).Bind(esppSettings);
|
||||||
services.AddSingleton(esppSettings);
|
services.AddSingleton(esppSettings);
|
||||||
|
|
||||||
|
EsppUserTimeZoneSettings.TimeZone = esppSettings.EsppUserTimeZone;
|
||||||
|
|
||||||
services.AddTransient<IEsppApiService, EsppApiService>();
|
services.AddTransient<IEsppApiService, EsppApiService>();
|
||||||
|
|
||||||
|
|||||||
7
PARR.EsppApi/Settings/EsppUserTimeZoneSettings.cs
Normal file
7
PARR.EsppApi/Settings/EsppUserTimeZoneSettings.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PARR.EsppApi.Settings
|
||||||
|
{
|
||||||
|
internal static class EsppUserTimeZoneSettings
|
||||||
|
{
|
||||||
|
public static int TimeZone = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user