83f51c6a23
Added shopping cart and items Added quotes Refactored relatinoships Migrated changes Refactored cqrs commands and queries Refactored mappings
64 lines
2.6 KiB
C#
64 lines
2.6 KiB
C#
using LiteCharms.Models;
|
|
|
|
namespace LiteCharms.Features.Notifications.Commands;
|
|
|
|
public class CreateNotificationCommand : IRequest<Result<Guid>>
|
|
{
|
|
public NotificationDirection Direction { get; set; }
|
|
|
|
public string? Author { get; set; }
|
|
|
|
public string? Title { get; set; }
|
|
|
|
public string? Description { get; set; }
|
|
|
|
public string? Platform { get; set; }
|
|
|
|
public string? PlatformAddress { get; set; }
|
|
|
|
public string? CorrelationId { get; set; }
|
|
|
|
public string? CorrelationIdType { get; set; }
|
|
|
|
public bool IsInternal { get; set; }
|
|
|
|
private CreateNotificationCommand(NotificationDirection direction, string author, string title, string description, string platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal)
|
|
{
|
|
Direction = direction;
|
|
Author = author;
|
|
Title = title;
|
|
Description = description;
|
|
Platform = platform;
|
|
PlatformAddress = platformAddress;
|
|
CorrelationId = correlationId;
|
|
CorrelationIdType = correlationIdType;
|
|
IsInternal = isInternal;
|
|
}
|
|
|
|
public static CreateNotificationCommand Create(NotificationDirection direction, string author, string title, string description, string platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(author))
|
|
throw new ArgumentException("Author cannot be null or whitespace.", nameof(author));
|
|
|
|
if (string.IsNullOrWhiteSpace(title))
|
|
throw new ArgumentException("Title cannot be null or whitespace.", nameof(title));
|
|
|
|
if (string.IsNullOrWhiteSpace(description))
|
|
throw new ArgumentException("Description cannot be null or whitespace.", nameof(description));
|
|
|
|
if (string.IsNullOrWhiteSpace(platform))
|
|
throw new ArgumentException("Platform cannot be null or whitespace.", nameof(platform));
|
|
|
|
if (string.IsNullOrWhiteSpace(platformAddress))
|
|
throw new ArgumentException("PlatformAddress cannot be null or whitespace.", nameof(platformAddress));
|
|
|
|
if (string.IsNullOrWhiteSpace(correlationId))
|
|
throw new ArgumentException("CorrelationId cannot be null or whitespace.", nameof(correlationId));
|
|
|
|
if (string.IsNullOrWhiteSpace(correlationIdType))
|
|
throw new ArgumentException("CorrelationIdType cannot be null or whitespace.", nameof(correlationIdType));
|
|
|
|
return new(direction, author, title, description, platform, platformAddress, correlationId, correlationIdType, isInternal);
|
|
}
|
|
}
|