Reorganize root folder structure: Remove apps layer layer
This commit is contained in:
48
backend/src/Modules/Chats/Domain/TextMessage.cs
Normal file
48
backend/src/Modules/Chats/Domain/TextMessage.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
|
||||
namespace Knot.Modules.Chats.Domain;
|
||||
|
||||
public class TextMessage : Message
|
||||
{
|
||||
public override string Type => "text";
|
||||
public override string? Content { get; protected set; }
|
||||
public override string? Quote { get; protected set; }
|
||||
|
||||
private TextMessage() : base()
|
||||
{
|
||||
Content = string.Empty;
|
||||
}
|
||||
|
||||
public TextMessage(
|
||||
Guid id,
|
||||
Guid chatId,
|
||||
Guid senderId,
|
||||
string content,
|
||||
Guid? replyToId,
|
||||
string? quote,
|
||||
Guid? forwardedFromId,
|
||||
DateTime createdAt,
|
||||
bool isImported)
|
||||
: base(id, chatId, senderId, replyToId, forwardedFromId, createdAt, isImported)
|
||||
{
|
||||
Content = content;
|
||||
Quote = quote;
|
||||
|
||||
if (!isImported)
|
||||
{
|
||||
RaiseDomainEvent(new MessageSentDomainEvent(Id, ChatId, SenderId, Content));
|
||||
}
|
||||
}
|
||||
|
||||
public void Edit(string newContent)
|
||||
{
|
||||
Content = newContent;
|
||||
AddState(MessageState.IsEdited);
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
Content = string.Empty;
|
||||
base.Delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user