forked from ddrilling/AsbCloudServer
Fixes by review
This commit is contained in:
parent
65120cae74
commit
cfba6143de
@ -3,29 +3,29 @@ using System;
|
|||||||
namespace AsbCloudApp.Data
|
namespace AsbCloudApp.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// временная зона
|
/// временная зона
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SimpleTimezoneDto
|
public class SimpleTimezoneDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// смещение в часах относительно UTC
|
/// смещение в часах относительно UTC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Hours { get; set; }
|
public double Hours { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// идентификатор часовой зоны
|
/// идентификатор часовой зоны
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TimezoneId { get; set; }
|
public string? TimezoneId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// запрет на переопределение
|
/// запрет на переопределение
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsOverride { get; set; }
|
public bool IsOverride { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Смещение часового пояса
|
/// Смещение часового пояса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TimeSpan Offset { get => TimeSpan.FromHours(Hours); }
|
public TimeSpan Offset => TimeSpan.FromHours(Hours);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override bool Equals(object? obj)
|
public override bool Equals(object? obj)
|
||||||
|
@ -14,6 +14,7 @@ namespace AsbCloudApp.Exceptions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IDictionary<string, string[]> ErrorState { get; } = null!;
|
public IDictionary<string, string[]> ErrorState { get; } = null!;
|
||||||
|
|
||||||
|
// TODO: swap arguments, inherit from ArgumentException
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// конструктор
|
/// конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -13,10 +13,12 @@ namespace AsbCloudApp.Repositories
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWellOperationRepository
|
public interface IWellOperationRepository
|
||||||
{
|
{
|
||||||
|
//TODO: replace all references
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// список названий операций
|
/// список названий операций
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[Obsolete("use IWellOperationCategoryRepository.GetCategories(bool includeParents)")]
|
||||||
IEnumerable<WellOperationCategoryDto> GetCategories(bool includeParents);
|
IEnumerable<WellOperationCategoryDto> GetCategories(bool includeParents);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -27,6 +27,7 @@ namespace AsbCloudDb
|
|||||||
private static void TryConvertPostgresExceptionToValidateException(PostgresException pgException)
|
private static void TryConvertPostgresExceptionToValidateException(PostgresException pgException)
|
||||||
{
|
{
|
||||||
if (pgException.SqlState == PostgresErrorCodes.ForeignKeyViolation)
|
if (pgException.SqlState == PostgresErrorCodes.ForeignKeyViolation)
|
||||||
|
// TODO: replace ArgumentException by new Exception
|
||||||
throw new ArgumentException(pgException.Message + "\r\n" + pgException.Detail, "dtos");
|
throw new ArgumentException(pgException.Message + "\r\n" + pgException.Detail, "dtos");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
|||||||
public async Task<int> ClearAndInsertRange(int idUser, TRequest request, IEnumerable<TDto> dtos, CancellationToken token)
|
public async Task<int> ClearAndInsertRange(int idUser, TRequest request, IEnumerable<TDto> dtos, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = 0;
|
var result = 0;
|
||||||
var transaction = await db.Database.BeginTransactionAsync(token);
|
using var transaction = await db.Database.BeginTransactionAsync(token);
|
||||||
result += await Clear(idUser, request, token);
|
result += await Clear(idUser, request, token);
|
||||||
result += await InsertRange(idUser, dtos, token);
|
result += await InsertRange(idUser, dtos, token);
|
||||||
await transaction.CommitAsync(token);
|
await transaction.CommitAsync(token);
|
||||||
|
Loading…
Reference in New Issue
Block a user