public CreateNotificationCommand(NotificationCorrelationId notificationCorrelationId, Username username, NotificationTitle notificationTitle, NotificationContent notificationContent, DateTime operationDate) { NotificationCorrelationId = notificationCorrelationId; Username = username; NotificationTitle = notificationTitle; NotificationContent = notificationContent; OperationDate = operationDate; }
public Notification(NotificationCorrelationId correlationId, Username username, NotificationTitle title, NotificationContent content, bool isSeen, DateTime operationDate, DateTime createdOn) { CorrelationId = correlationId; Username = username; Title = title; Content = content; IsSeen = isSeen; OperationDate = operationDate; CreatedOn = createdOn; }
public async Task <IActionResult> SetNotificationAsUnseen([FromRoute] string username, [FromRoute] string notificationCorrelationId) { CheckTokenIsValid(username); Username uName = new Username(username); NotificationCorrelationId correlationId = new NotificationCorrelationId(notificationCorrelationId); ChangeNotificationSeenStatusCommand changeNotificationSeenStatusCommand = new ChangeNotificationSeenStatusCommand(uName, correlationId, false); await _notificationService.ChangeNotificationSeenStatusAsync(changeNotificationSeenStatusCommand, CancellationToken.None); return(StatusCode((int)HttpStatusCode.OK)); }
public async Task Consume(ConsumeContext <OrderShippedEvent> context) { OrderShippedEvent orderShippedEvent = context.Message; NotificationCorrelationId notificationCorrelationId = new NotificationCorrelationId($"{orderShippedEvent.Username}-{orderShippedEvent.OrderId}-{orderShippedEvent.ShipmentId}"); Username username = new Username(orderShippedEvent.Username); NotificationTitle notificationTitle = new NotificationTitle($"Order Shipped"); NotificationContent notificationContent = new NotificationContent($"#{orderShippedEvent.OrderId} order is shipped at {orderShippedEvent.ShipmentDate}"); CreateNotificationCommand createNotificationCommand = new CreateNotificationCommand(notificationCorrelationId, username, notificationTitle, notificationContent, orderShippedEvent.ShipmentDate); await SendCreateNotificationCommandAsync(createNotificationCommand); }
public async Task <Notification> GetNotificationAsync(Username username, NotificationCorrelationId notificationCorrelationId, CancellationToken cancellationToken) { Notification?notification = await(await DbSet.FindAsync(x => x.Username.Value == username.Value && x.CorrelationId.Value == notificationCorrelationId.Value, new FindOptions <Notification>() { Skip = 0, Limit = 1, }, cancellationToken) ).FirstOrDefaultAsync(cancellationToken); if (notification == null) { throw new NotFoundException <Notification>(); } return(notification); }
public ChangeNotificationSeenStatusCommand(Username username, NotificationCorrelationId correlationId, bool seen) { Username = username; CorrelationId = correlationId; Seen = seen; }
public Notification(NotificationCorrelationId correlationId, Username username, NotificationTitle title, NotificationContent content, DateTime operationDate) : this(correlationId, username, title, content, false, operationDate, DateTime.UtcNow) { }
public NotificationAlreadyExistException(NotificationCorrelationId notificationCorrelationId) : base($"#{notificationCorrelationId} notification is already registered") { }