Fixes by review

This commit is contained in:
ngfrolov 2024-02-12 13:58:02 +05:00
parent 65120cae74
commit cfba6143de
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
5 changed files with 11 additions and 7 deletions

View File

@ -3,29 +3,29 @@ using System;
namespace AsbCloudApp.Data
{
/// <summary>
/// временная зона
/// временная зона
/// </summary>
public class SimpleTimezoneDto
{
/// <summary>
/// смещение в часах относительно UTC
/// смещение в часах относительно UTC
/// </summary>
public double Hours { get; set; }
/// <summary>
/// идентификатор часовой зоны
/// идентификатор часовой зоны
/// </summary>
public string? TimezoneId { get; set; }
/// <summary>
/// запрет на переопределение
/// запрет на переопределение
/// </summary>
public bool IsOverride { get; set; }
/// <summary>
/// Смещение часового пояса
/// Смещение часового пояса
/// </summary>
public TimeSpan Offset { get => TimeSpan.FromHours(Hours); }
public TimeSpan Offset => TimeSpan.FromHours(Hours);
/// <inheritdoc/>
public override bool Equals(object? obj)

View File

@ -14,6 +14,7 @@ namespace AsbCloudApp.Exceptions
/// </summary>
public IDictionary<string, string[]> ErrorState { get; } = null!;
// TODO: swap arguments, inherit from ArgumentException
/// <summary>
/// конструктор
/// </summary>

View File

@ -13,10 +13,12 @@ namespace AsbCloudApp.Repositories
/// </summary>
public interface IWellOperationRepository
{
//TODO: replace all references
/// <summary>
/// список названий операций
/// </summary>
/// <returns></returns>
[Obsolete("use IWellOperationCategoryRepository.GetCategories(bool includeParents)")]
IEnumerable<WellOperationCategoryDto> GetCategories(bool includeParents);
/// <summary>

View File

@ -27,6 +27,7 @@ namespace AsbCloudDb
private static void TryConvertPostgresExceptionToValidateException(PostgresException pgException)
{
if (pgException.SqlState == PostgresErrorCodes.ForeignKeyViolation)
// TODO: replace ArgumentException by new Exception
throw new ArgumentException(pgException.Message + "\r\n" + pgException.Detail, "dtos");
}
}

View File

@ -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)
{
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 InsertRange(idUser, dtos, token);
await transaction.CommitAsync(token);