From a4134c14543592daeedff2d46215822a41e57a53 Mon Sep 17 00:00:00 2001 From: Andrii Voznesenskyi Date: Mon, 16 Sep 2024 18:34:06 +0200 Subject: [PATCH] (#411) posts: udpate post created event to add shoudl notify flag --- .../Commands/Handlers/CreatePostHandler.cs | 5 +++-- .../Events/PostCreated.cs | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Commands/Handlers/CreatePostHandler.cs b/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Commands/Handlers/CreatePostHandler.cs index b9a7af8af..86cbafbf2 100644 --- a/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Commands/Handlers/CreatePostHandler.cs +++ b/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Commands/Handlers/CreatePostHandler.cs @@ -121,8 +121,9 @@ await _messageBroker.PublishAsync(new PostCreated( command.EventId, command.TextContent, command.MediaFiles, - command.Context.ToString(), - command.Visibility + command.Context.ToString(), + command.Visibility, + shouldNotify: true )); } } diff --git a/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Events/PostCreated.cs b/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Events/PostCreated.cs index 641b149b8..f5444aeb1 100644 --- a/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Events/PostCreated.cs +++ b/MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Application/Events/PostCreated.cs @@ -7,16 +7,17 @@ namespace MiniSpace.Services.Posts.Application.Events public class PostCreated : IEvent { public Guid PostId { get; } - public Guid? UserId { get; } - public Guid? OrganizationId { get; } - public Guid? EventId { get; } - public string TextContent { get; } - public IEnumerable MediaFilesUrls { get; } - public string Context { get; } - public string Visibility { get; } + public Guid? UserId { get; } + public Guid? OrganizationId { get; } + public Guid? EventId { get; } + public string TextContent { get; } + public IEnumerable MediaFilesUrls { get; } + public string Context { get; } + public string Visibility { get; } + public bool ShouldNotify { get; } public PostCreated(Guid postId, Guid? userId, Guid? organizationId, Guid? eventId, string textContent, - IEnumerable mediaFilesUrls, string context, string visibility) + IEnumerable mediaFilesUrls, string context, string visibility, bool shouldNotify) { PostId = postId; UserId = userId; @@ -26,6 +27,7 @@ public PostCreated(Guid postId, Guid? userId, Guid? organizationId, Guid? eventI MediaFilesUrls = mediaFilesUrls; Context = context; Visibility = visibility; + ShouldNotify = shouldNotify; } } }