Skip to content

Commit

Permalink
Code(API::ChatMessage): Add ChatMessage model
Browse files Browse the repository at this point in the history
  • Loading branch information
ktutak1337 committed Mar 24, 2024
1 parent 9cc480b commit 0fc06e3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Server/StellarChat.Server.Api/Models/Chat/ChatMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace StellarChat.Server.Api.Models.Chat;

public class ChatMessage
{
/// <summary>
/// Id of the message.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// Id of the chat this message belongs to.
/// </summary>
public Guid ChatId { get; set; }
public ChatMessageType Type { get; set; }
public string Author { get; set; }
public string Content { get; set; }
public int TokenCount { get; set; }
public DateTimeOffset Timestamp { get; set; }

public ChatMessage(Guid id, Guid chatId, ChatMessageType type, string author, string content, int tokenCount, DateTimeOffset timestamp)
{
Id = id;
ChatId = chatId;
Type = type;
Author = author;
Content = content;
TokenCount = tokenCount;
Timestamp = timestamp;
}

public static ChatMessage Create(Guid id, Guid chatId, ChatMessageType type, string author, string content, int tokenCount, DateTimeOffset timestamp)
=> new(id, chatId, type, author, content, tokenCount, timestamp);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace StellarChat.Server.Api.Models.Chat;

public enum ChatMessageType
{
Message,
File,
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<UserSecretsId>23f11947-c5c2-4954-80cc-5830f6ae6c16</UserSecretsId>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 0fc06e3

Please sign in to comment.