forked from ddrilling/AsbCloudServer
Merge branch 'fix/reading_notifications' into feature/notifications_updates
# Conflicts: # AsbCloudApp/Services/Notifications/NotificationService.cs
This commit is contained in:
commit
60921a2bcf
@ -46,7 +46,7 @@ public class NotificationDto : IId
|
||||
/// Дата прочтения уведомления
|
||||
/// </summary>
|
||||
public DateTime? ReadDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Состояние уведомления
|
||||
/// 0 - Зарегистрировано,
|
||||
@ -65,6 +65,10 @@ public class NotificationDto : IId
|
||||
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -23,7 +23,6 @@ public class NotificationService
|
||||
/// Сервис для работы с уведомлениями
|
||||
/// </summary>
|
||||
/// <param name="notificationCategoryRepository"></param>
|
||||
/// <param name="userRepository"></param>
|
||||
/// <param name="notificationRepository"></param>
|
||||
/// <param name="notificationTransportServices"></param>
|
||||
public NotificationService(ICrudRepository<NotificationCategoryDto> notificationCategoryRepository,
|
||||
@ -80,13 +79,10 @@ public class NotificationService
|
||||
cancellationToken)
|
||||
?? throw new ArgumentInvalidException("Уведомление не найдено", nameof(idNotification));
|
||||
|
||||
if (isRead)
|
||||
{
|
||||
if (notification.SentDate == null)
|
||||
throw new ArgumentInvalidException("Уведомление не может быть прочитано", nameof(isRead));
|
||||
|
||||
notification.ReadDate = DateTime.UtcNow;
|
||||
}
|
||||
if(isRead && !notification.SentDate.HasValue)
|
||||
throw new ArgumentInvalidException("Уведомление не может быть прочитано", nameof(isRead));
|
||||
|
||||
notification.ReadDate = isRead ? DateTime.UtcNow : null;
|
||||
|
||||
await notificationRepository.UpdateAsync(notification,
|
||||
cancellationToken);
|
||||
|
@ -431,6 +431,9 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
var tzOffsetHours = wellService.GetTimezone(idWell).Hours;
|
||||
|
||||
var merged = MergeArraysBySections(sectionsIds, wellOperationsPlan, wellOperationsFact).ToList();
|
||||
if (merged.Count ==0)
|
||||
return Enumerable.Empty<PlanFactPredictBase<WellOperationDto>>();
|
||||
|
||||
var tvd = new List<PlanFactPredictBase<WellOperationDto>>(merged.Count);
|
||||
var (Plan, Fact) = merged.FirstOrDefault();
|
||||
var dateStart = Plan?.DateStart ?? Fact!.DateStart;
|
||||
|
@ -94,7 +94,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpDelete("/api/admin/user/{idUser}/settings")]
|
||||
[Permission]
|
||||
public virtual async Task<ActionResult<int>> DeleteAsync(int idUser, CancellationToken token)
|
||||
public virtual async Task<ActionResult<int>> DeleteAllAsync(int idUser, CancellationToken token)
|
||||
{
|
||||
var result = await service.DeleteAsync(idUser, token).ConfigureAwait(false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user