mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
PM-11123: Notification Status Details view (#4848)
* PM-11123: Notification Status Details view * PM-11123: Test Typo * PM-11123: New line missing * PM-11123: Delete unnecessary field * PM-11123: Moved NotificationStatusDetails to Models/Data
This commit is contained in:
@ -0,0 +1,25 @@
|
||||
#nullable enable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.NotificationCenter.Enums;
|
||||
|
||||
namespace Bit.Core.NotificationCenter.Models.Data;
|
||||
|
||||
public class NotificationStatusDetails
|
||||
{
|
||||
// Notification fields
|
||||
public Guid Id { get; set; }
|
||||
public Priority Priority { get; set; }
|
||||
public bool Global { get; set; }
|
||||
public ClientType ClientType { get; set; }
|
||||
public Guid? UserId { get; set; }
|
||||
public Guid? OrganizationId { get; set; }
|
||||
[MaxLength(256)]
|
||||
public string? Title { get; set; }
|
||||
public string? Body { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public DateTime RevisionDate { get; set; }
|
||||
// Notification Status fields
|
||||
public DateTime? ReadDate { get; set; }
|
||||
public DateTime? DeletedDate { get; set; }
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.NotificationCenter.Entities;
|
||||
using Bit.Core.NotificationCenter.Models.Data;
|
||||
using Bit.Core.NotificationCenter.Models.Filter;
|
||||
using Bit.Core.NotificationCenter.Queries.Interfaces;
|
||||
using Bit.Core.NotificationCenter.Repositories;
|
||||
@ -9,19 +9,20 @@ using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.NotificationCenter.Queries;
|
||||
|
||||
public class GetNotificationsForUserQuery : IGetNotificationsForUserQuery
|
||||
public class GetNotificationStatusDetailsForUserQuery : IGetNotificationStatusDetailsForUserQuery
|
||||
{
|
||||
private readonly ICurrentContext _currentContext;
|
||||
private readonly INotificationRepository _notificationRepository;
|
||||
|
||||
public GetNotificationsForUserQuery(ICurrentContext currentContext,
|
||||
public GetNotificationStatusDetailsForUserQuery(ICurrentContext currentContext,
|
||||
INotificationRepository notificationRepository)
|
||||
{
|
||||
_currentContext = currentContext;
|
||||
_notificationRepository = notificationRepository;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Notification>> GetByUserIdStatusFilterAsync(NotificationStatusFilter statusFilter)
|
||||
public async Task<IEnumerable<NotificationStatusDetails>> GetByUserIdStatusFilterAsync(
|
||||
NotificationStatusFilter statusFilter)
|
||||
{
|
||||
if (!_currentContext.UserId.HasValue)
|
||||
{
|
@ -0,0 +1,10 @@
|
||||
#nullable enable
|
||||
using Bit.Core.NotificationCenter.Models.Data;
|
||||
using Bit.Core.NotificationCenter.Models.Filter;
|
||||
|
||||
namespace Bit.Core.NotificationCenter.Queries.Interfaces;
|
||||
|
||||
public interface IGetNotificationStatusDetailsForUserQuery
|
||||
{
|
||||
Task<IEnumerable<NotificationStatusDetails>> GetByUserIdStatusFilterAsync(NotificationStatusFilter statusFilter);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
#nullable enable
|
||||
using Bit.Core.NotificationCenter.Entities;
|
||||
using Bit.Core.NotificationCenter.Models.Filter;
|
||||
|
||||
namespace Bit.Core.NotificationCenter.Queries.Interfaces;
|
||||
|
||||
public interface IGetNotificationsForUserQuery
|
||||
{
|
||||
Task<IEnumerable<Notification>> GetByUserIdStatusFilterAsync(NotificationStatusFilter statusFilter);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.NotificationCenter.Entities;
|
||||
using Bit.Core.NotificationCenter.Models.Data;
|
||||
using Bit.Core.NotificationCenter.Models.Filter;
|
||||
using Bit.Core.Repositories;
|
||||
|
||||
@ -23,7 +24,8 @@ public interface INotificationRepository : IRepository<Notification, Guid>
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Ordered by priority (highest to lowest) and creation date (descending).
|
||||
/// Includes all fields from <see cref="Notification"/> and <see cref="NotificationStatus"/>
|
||||
/// </returns>
|
||||
Task<IEnumerable<Notification>> GetByUserIdAndStatusAsync(Guid userId, ClientType clientType,
|
||||
Task<IEnumerable<NotificationStatusDetails>> GetByUserIdAndStatusAsync(Guid userId, ClientType clientType,
|
||||
NotificationStatusFilter? statusFilter);
|
||||
}
|
||||
|
Reference in New Issue
Block a user