mirror of
https://github.com/bitwarden/server
synced 2025-12-26 05:03:18 +00:00
[PM-18555] Main part of notifications refactor (#5757)
* More tests * More tests * Add non-guid tests * Introduce slimmer services * Implement IPushEngine on services * Implement IPushEngine * Fix tests * Format * Switch to `Guid` on `PushSendRequestModel` * Remove TODOs
This commit is contained in:
@@ -4,22 +4,22 @@ using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Api;
|
||||
|
||||
public class PushSendRequestModel : IValidatableObject
|
||||
public class PushSendRequestModel<T> : IValidatableObject
|
||||
{
|
||||
public string? UserId { get; set; }
|
||||
public string? OrganizationId { get; set; }
|
||||
public string? DeviceId { get; set; }
|
||||
public Guid? UserId { get; set; }
|
||||
public Guid? OrganizationId { get; set; }
|
||||
public Guid? DeviceId { get; set; }
|
||||
public string? Identifier { get; set; }
|
||||
public required PushType Type { get; set; }
|
||||
public required object Payload { get; set; }
|
||||
public required T Payload { get; set; }
|
||||
public ClientType? ClientType { get; set; }
|
||||
public string? InstallationId { get; set; }
|
||||
public Guid? InstallationId { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(UserId) &&
|
||||
string.IsNullOrWhiteSpace(OrganizationId) &&
|
||||
string.IsNullOrWhiteSpace(InstallationId))
|
||||
if (!UserId.HasValue &&
|
||||
!OrganizationId.HasValue &&
|
||||
!InstallationId.HasValue)
|
||||
{
|
||||
yield return new ValidationResult(
|
||||
$"{nameof(UserId)} or {nameof(OrganizationId)} or {nameof(InstallationId)} is required.");
|
||||
|
||||
Reference in New Issue
Block a user