-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code(API::ChatMessage): Add ChatMessage model
- Loading branch information
1 parent
9cc480b
commit 0fc06e3
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/Server/StellarChat.Server.Api/Models/Chat/ChatMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Server/StellarChat.Server.Api/Models/Chat/ChatMessageType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters