forked from ddrilling/AsbCloudServer
Merge branch 'dev' into well_statistic
This commit is contained in:
commit
9ad290550c
30
AsbCloudApp/Data/GTR/WitsItemRecordDto.cs
Normal file
30
AsbCloudApp/Data/GTR/WitsItemRecordDto.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Data.GTR
|
||||
{
|
||||
/// <summary>
|
||||
/// Запись WITS
|
||||
/// </summary>
|
||||
public class WitsItemRecordDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Record Id
|
||||
/// </summary>
|
||||
public int IdRecord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item Id
|
||||
/// </summary>
|
||||
public int IdItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата создания записи
|
||||
/// </summary>
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Значение
|
||||
/// </summary>
|
||||
public JsonValue Value { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -23,5 +23,5 @@ namespace AsbCloudApp.Data
|
||||
/// </summary>
|
||||
public IEnumerable<WellFinalDocumentDto> WellFinalDocuments { get; set; } = Enumerable.Empty<WellFinalDocumentDto>();
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -58,4 +58,3 @@ public class WellGroupOpertionDto
|
||||
/// </summary>
|
||||
public IEnumerable<WellGroupOpertionDto>? Items { get; set; }
|
||||
}
|
||||
#nullable disable
|
@ -22,5 +22,5 @@ namespace AsbCloudApp.Data
|
||||
public DateTime? DateLastAssosiatedPlanOperation { get; set; }
|
||||
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -4,10 +4,8 @@ using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace AsbCloudApp.Repositories
|
||||
{
|
||||
#nullable enable
|
||||
/// <summary>
|
||||
/// данные ГТИ
|
||||
/// </summary>
|
||||
@ -34,6 +32,14 @@ namespace AsbCloudApp.Repositories
|
||||
Task<IEnumerable<WitsRecordDto>> GetAsync(int idWell,
|
||||
DateTime? dateBegin, double intervalSec = 600d,
|
||||
int approxPointsCount = 1024, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// получение последних данных ГТИ по record id
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idRecord"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<WitsItemRecordDto>> GetLastDataByRecordIdAsync(int idWell, int idRecord, CancellationToken token = default);
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model.GTR;
|
||||
using Mapster;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -13,7 +12,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
|
||||
public class GtrWitsRepository : IGtrRepository
|
||||
{
|
||||
private readonly IAsbCloudDbContext db;
|
||||
@ -39,9 +37,18 @@ namespace AsbCloudInfrastructure.Repository
|
||||
DateTimeOffset? dateBeginUtc = dateBegin?.ToUtcDateTimeOffset(timezone.Hours);
|
||||
var dateEnd = dateBeginUtc?.AddSeconds(intervalSec);
|
||||
|
||||
var recordAllInt = await GetItemsOrDefaultAsync<WitsItemInt, int>(telemetry.Id, dateBeginUtc, dateEnd, approxPointsCount, timezone.Hours, token);
|
||||
var recordAllFloat = await GetItemsOrDefaultAsync<WitsItemFloat, float>(telemetry.Id, dateBeginUtc, dateEnd, approxPointsCount,timezone.Hours, token);
|
||||
var recordAllString = await GetItemsOrDefaultAsync<WitsItemString, string>(telemetry.Id, dateBeginUtc, dateEnd, approxPointsCount, timezone.Hours, token);
|
||||
var witsRequest = new WitsRequest()
|
||||
{
|
||||
IdTelemetry = telemetry.Id,
|
||||
DateBeginUtc = dateBeginUtc,
|
||||
DateEnd = dateEnd,
|
||||
ApproxPointsCount = approxPointsCount,
|
||||
TimezoneHours = timezone.Hours
|
||||
};
|
||||
|
||||
var recordAllInt = await GetItemsOrDefaultAsync<WitsItemInt, int>(witsRequest, token);
|
||||
var recordAllFloat = await GetItemsOrDefaultAsync<WitsItemFloat, float>(witsRequest, token);
|
||||
var recordAllString = await GetItemsOrDefaultAsync<WitsItemString, string>(witsRequest, token);
|
||||
|
||||
var dtos = (recordAllFloat.Union(recordAllInt)).Union(recordAllString)
|
||||
.GroupBy(g => new
|
||||
@ -53,43 +60,88 @@ namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
Id = g.Key.IdRecord,
|
||||
Date = g.Key.Date,
|
||||
Items = g.Select(r => new {
|
||||
Items = g.Select(r => new
|
||||
{
|
||||
Key = r.IdItem,
|
||||
Value = r.Item
|
||||
r.Value
|
||||
}).ToDictionary(x => x.Key, x => x.Value)
|
||||
});
|
||||
return dtos;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<ItemRecord>> GetItemsOrDefaultAsync<TEntity, TValue>(
|
||||
int idTelemetry,
|
||||
DateTimeOffset? dateBegin,
|
||||
DateTimeOffset? dateEnd,
|
||||
int approxPointsCount,
|
||||
double timezoneHours,
|
||||
CancellationToken token)
|
||||
where TEntity: WitsItemBase<TValue>
|
||||
where TValue: notnull
|
||||
public async Task<IEnumerable<WitsItemRecordDto>> GetLastDataByRecordIdAsync(int idWell, int idRecord, CancellationToken token = default)
|
||||
{
|
||||
var query = db.Set<TEntity>()
|
||||
.Where(i => i.IdTelemetry == idTelemetry);
|
||||
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
|
||||
if (telemetry is null)
|
||||
return Enumerable.Empty<WitsItemRecordDto>();
|
||||
|
||||
if (dateBegin is not null)
|
||||
query = query
|
||||
.Where(d => d.DateTime >= dateBegin);
|
||||
var timezone = telemetryService.GetTimezone(telemetry.Id);
|
||||
|
||||
if (dateEnd is not null)
|
||||
query = query
|
||||
.Where(d => d.DateTime <= dateEnd);
|
||||
var witsRequest = new WitsRequest()
|
||||
{
|
||||
IdTelemetry = telemetry.Id,
|
||||
TimezoneHours = timezone.Hours,
|
||||
IdRecord = idRecord,
|
||||
};
|
||||
|
||||
var recordAllInt = await GetGroupedItemsOrDefaultAsync<WitsItemInt, int>(witsRequest, token);
|
||||
var recordAllFloat = await GetGroupedItemsOrDefaultAsync<WitsItemFloat, float>(witsRequest, token);
|
||||
var recordAllString = await GetGroupedItemsOrDefaultAsync<WitsItemString, string>(witsRequest, token);
|
||||
|
||||
var dtos = recordAllFloat.Union(recordAllInt).Union(recordAllString);
|
||||
return dtos;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<WitsItemRecordDto>> GetGroupedItemsOrDefaultAsync<TEntity, TValue>(WitsRequest request, CancellationToken token)
|
||||
where TEntity : WitsItemBase<TValue>
|
||||
where TValue : notnull
|
||||
{
|
||||
var query = BuildQuery<TEntity, TValue>(request);
|
||||
var groupedQuery = query.GroupBy(g => new
|
||||
{
|
||||
g.IdRecord,
|
||||
g.IdTelemetry,
|
||||
g.IdItem
|
||||
})
|
||||
.Select(g => new
|
||||
{
|
||||
g.Key.IdRecord,
|
||||
g.Key.IdItem,
|
||||
Data = g.OrderByDescending(i => i.DateTime)
|
||||
.FirstOrDefault()
|
||||
});
|
||||
|
||||
var groupedEntities = await groupedQuery
|
||||
.ToArrayAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var dtos = groupedEntities
|
||||
.Select(e => new WitsItemRecordDto()
|
||||
{
|
||||
IdRecord = e.IdRecord,
|
||||
IdItem = e.IdItem,
|
||||
Date = e.Data!.DateTime.ToRemoteDateTime(request.TimezoneHours),
|
||||
Value = new JsonValue(e.Data!.Value)
|
||||
});
|
||||
|
||||
return dtos;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<WitsItemRecordDto>> GetItemsOrDefaultAsync<TEntity, TValue>(
|
||||
WitsRequest request,
|
||||
CancellationToken token)
|
||||
where TEntity : WitsItemBase<TValue>
|
||||
where TValue : notnull
|
||||
{
|
||||
var query = BuildQuery<TEntity, TValue>(request);
|
||||
|
||||
var fullDataCount = await query.CountAsync(token);
|
||||
|
||||
if (fullDataCount == 0)
|
||||
return Enumerable.Empty<ItemRecord>();
|
||||
return Enumerable.Empty<WitsItemRecordDto>();
|
||||
|
||||
if (fullDataCount > 1.75 * approxPointsCount)
|
||||
if (request.ApproxPointsCount is not null && fullDataCount > 1.75 * request.ApproxPointsCount)
|
||||
{
|
||||
var m = (int)Math.Round(1d * fullDataCount / approxPointsCount);
|
||||
var m = (int)Math.Round(1d * fullDataCount / request.ApproxPointsCount!.Value);
|
||||
if (m > 1)
|
||||
query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % m == 0);
|
||||
}
|
||||
@ -100,17 +152,37 @@ namespace AsbCloudInfrastructure.Repository
|
||||
.ToListAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var items = entities.Select(e => new ItemRecord
|
||||
var items = entities.Select(e => new WitsItemRecordDto
|
||||
{
|
||||
IdRecord = e.IdRecord,
|
||||
IdTelemetry = e.IdTelemetry,
|
||||
Date = e.DateTime.ToRemoteDateTime(timezoneHours),
|
||||
Date = e.DateTime.ToRemoteDateTime(request.TimezoneHours),
|
||||
IdItem = e.IdItem,
|
||||
Item = new JsonValue(e.Value)
|
||||
Value = new JsonValue(e.Value)
|
||||
});
|
||||
return items;
|
||||
}
|
||||
|
||||
private IQueryable<TEntity> BuildQuery<TEntity, TValue>(WitsRequest request)
|
||||
where TEntity : WitsItemBase<TValue>
|
||||
where TValue : notnull
|
||||
{
|
||||
var query = db.Set<TEntity>().Where(i => i.IdTelemetry == request.IdTelemetry);
|
||||
|
||||
if (request.IdRecord is not null)
|
||||
query = query
|
||||
.Where(d => d.IdRecord == request.IdRecord);
|
||||
|
||||
if (request.DateBeginUtc is not null)
|
||||
query = query
|
||||
.Where(d => d.DateTime >= request.DateBeginUtc);
|
||||
|
||||
if (request.DateEnd is not null)
|
||||
query = query
|
||||
.Where(d => d.DateTime <= request.DateEnd);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
public async Task SaveDataAsync(int idTelemetry, WitsRecordDto dto, CancellationToken token)
|
||||
{
|
||||
var timezoneHours = telemetryService.GetTimezone(idTelemetry).Hours;
|
||||
@ -119,7 +191,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
var dateTime = dto.Date.ToUtcDateTimeOffset(timezoneHours);
|
||||
if (item.Value.Value is string valueString)
|
||||
{
|
||||
var entity = MakeEntity<WitsItemString, string>( dto.Id, item.Key, idTelemetry, dateTime, valueString);
|
||||
var entity = MakeEntity<WitsItemString, string>(dto.Id, item.Key, idTelemetry, dateTime, valueString);
|
||||
db.WitsItemString.Add(entity);
|
||||
}
|
||||
if (item.Value.Value is float valueFloat)
|
||||
@ -138,8 +210,9 @@ namespace AsbCloudInfrastructure.Repository
|
||||
|
||||
private static TEntity MakeEntity<TEntity, TValue>(int idRecord, int idItem, int idTelemetry, DateTimeOffset dateTime, TValue value)
|
||||
where TEntity : WitsItemBase<TValue>, new()
|
||||
where TValue: notnull
|
||||
=> new TEntity() {
|
||||
where TValue : notnull
|
||||
=> new TEntity()
|
||||
{
|
||||
IdRecord = idRecord,
|
||||
IdItem = idItem,
|
||||
IdTelemetry = idTelemetry,
|
||||
@ -147,14 +220,14 @@ namespace AsbCloudInfrastructure.Repository
|
||||
Value = value,
|
||||
};
|
||||
|
||||
internal class ItemRecord
|
||||
private class WitsRequest
|
||||
{
|
||||
public int IdRecord { get; set; }
|
||||
public int IdTelemetry { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public int IdItem { get; set; }
|
||||
public JsonValue Item { get; set; } = default!;
|
||||
public DateTimeOffset? DateBeginUtc { get; set; }
|
||||
public DateTimeOffset? DateEnd { get; set; }
|
||||
public int? ApproxPointsCount { get; set; }
|
||||
public double TimezoneHours { get; set; }
|
||||
public int? IdRecord { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// CRUD контроллер для админки.
|
||||
/// </summary>
|
||||
@ -140,5 +140,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// CRUD контроллер dto связных со скважиной для админки.
|
||||
/// </summary>
|
||||
@ -161,5 +161,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Суточный рапорт
|
||||
/// </summary>
|
||||
@ -194,5 +194,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using AsbCloudApp.Repositories;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Хранение файлов
|
||||
/// </summary>
|
||||
@ -244,5 +244,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Статистика по операциям (заведенным вручную) на скважине
|
||||
/// </summary>
|
||||
@ -166,5 +166,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Плановая траектория (загрузка и хранение)
|
||||
/// </summary>
|
||||
@ -249,5 +249,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// РТК
|
||||
/// </summary>
|
||||
@ -152,5 +152,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
return await base.UpdateAsync(value, token);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Мониторинг запросов, ошибок, пользователей
|
||||
/// </summary>
|
||||
@ -88,5 +88,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.SAUB
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GtrWitsController : ControllerBase
|
||||
@ -68,6 +68,33 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
return Ok(content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// получение последних данных ГТИ по ключу record
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="idRecord">id record</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idWell}/{idRecord}")]
|
||||
[Permission]
|
||||
public async Task<ActionResult<IEnumerable<WitsItemRecordDto>>> GetLastDataByRecordIdAsync(int idWell, int idRecord, CancellationToken token = default)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false);
|
||||
|
||||
if (!isCompanyOwnsWell)
|
||||
return Forbid();
|
||||
|
||||
var content = await gtrRepository.GetLastDataByRecordIdAsync(idWell, idRecord, token).ConfigureAwait(false);
|
||||
|
||||
return Ok(content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод для получения WITS записи от панели оператора.
|
||||
/// Сохраняет в БД.
|
||||
@ -91,5 +118,5 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using AsbCloudApp.Repositories;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.SAUB
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Наработка талевого каната
|
||||
/// </summary>
|
||||
@ -112,5 +112,5 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
}
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Расписание бурильщиков
|
||||
/// </summary>
|
||||
|
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Композитная скважина
|
||||
/// </summary>
|
||||
@ -90,5 +90,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using AsbCloudApp.Repositories;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Дело скважины
|
||||
/// </summary>
|
||||
@ -175,5 +175,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// Буровые операции (вводимые вручную)
|
||||
/// </summary>
|
||||
@ -393,5 +393,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
idWell, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AsbCloudWebApi.Converters
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
public class DateOnlyJsonConverter : JsonConverter<DateOnly>
|
||||
{
|
||||
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
@ -18,5 +18,5 @@ namespace AsbCloudWebApi.Converters
|
||||
writer.WriteStringValue(isoDate);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AsbCloudWebApi.Converters
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
public class DateOnlyTypeConverter : TypeConverter
|
||||
{
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
|
||||
@ -44,5 +44,5 @@ namespace AsbCloudWebApi.Converters
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using System.Globalization;
|
||||
|
||||
namespace AsbCloudWebApi.Converters
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
public class TimeOnlyTypeConverter : TypeConverter
|
||||
{
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
|
||||
@ -42,5 +42,5 @@ namespace AsbCloudWebApi.Converters
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Middlewares
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
public class PermissionsMiddlware
|
||||
{
|
||||
private readonly RequestDelegate next;
|
||||
@ -80,5 +80,5 @@ namespace AsbCloudWebApi.Middlewares
|
||||
await context.ForbidAsync();
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Middlewares
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
public class RequerstTrackerMiddleware
|
||||
{
|
||||
private readonly RequestDelegate next;
|
||||
@ -49,5 +49,5 @@ namespace AsbCloudWebApi.Middlewares
|
||||
}
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Middlewares
|
||||
{
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// This is not real middleware it`s part of PermissionsMiddlware.
|
||||
/// DO NOT register it in setup.cs as middleware.
|
||||
@ -69,5 +69,5 @@ namespace AsbCloudWebApi.Middlewares
|
||||
}
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user