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
@ -65,6 +65,10 @@ public class NotificationDto : IId
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,7 +23,6 @@ public class NotificationService
|
|||||||
/// Сервис для работы с уведомлениями
|
/// Сервис для работы с уведомлениями
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="notificationCategoryRepository"></param>
|
/// <param name="notificationCategoryRepository"></param>
|
||||||
/// <param name="userRepository"></param>
|
|
||||||
/// <param name="notificationRepository"></param>
|
/// <param name="notificationRepository"></param>
|
||||||
/// <param name="notificationTransportServices"></param>
|
/// <param name="notificationTransportServices"></param>
|
||||||
public NotificationService(ICrudRepository<NotificationCategoryDto> notificationCategoryRepository,
|
public NotificationService(ICrudRepository<NotificationCategoryDto> notificationCategoryRepository,
|
||||||
@ -80,13 +79,10 @@ public class NotificationService
|
|||||||
cancellationToken)
|
cancellationToken)
|
||||||
?? throw new ArgumentInvalidException("Уведомление не найдено", nameof(idNotification));
|
?? throw new ArgumentInvalidException("Уведомление не найдено", nameof(idNotification));
|
||||||
|
|
||||||
if (isRead)
|
if(isRead && !notification.SentDate.HasValue)
|
||||||
{
|
throw new ArgumentInvalidException("Уведомление не может быть прочитано", nameof(isRead));
|
||||||
if (notification.SentDate == null)
|
|
||||||
throw new ArgumentInvalidException("Уведомление не может быть прочитано", nameof(isRead));
|
|
||||||
|
|
||||||
notification.ReadDate = DateTime.UtcNow;
|
notification.ReadDate = isRead ? DateTime.UtcNow : null;
|
||||||
}
|
|
||||||
|
|
||||||
await notificationRepository.UpdateAsync(notification,
|
await notificationRepository.UpdateAsync(notification,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
|
@ -431,6 +431,9 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
|||||||
var tzOffsetHours = wellService.GetTimezone(idWell).Hours;
|
var tzOffsetHours = wellService.GetTimezone(idWell).Hours;
|
||||||
|
|
||||||
var merged = MergeArraysBySections(sectionsIds, wellOperationsPlan, wellOperationsFact).ToList();
|
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 tvd = new List<PlanFactPredictBase<WellOperationDto>>(merged.Count);
|
||||||
var (Plan, Fact) = merged.FirstOrDefault();
|
var (Plan, Fact) = merged.FirstOrDefault();
|
||||||
var dateStart = Plan?.DateStart ?? Fact!.DateStart;
|
var dateStart = Plan?.DateStart ?? Fact!.DateStart;
|
||||||
|
@ -94,7 +94,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("/api/admin/user/{idUser}/settings")]
|
[HttpDelete("/api/admin/user/{idUser}/settings")]
|
||||||
[Permission]
|
[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);
|
var result = await service.DeleteAsync(idUser, token).ConfigureAwait(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user