journal/Journal.Core/Models/ConversationMessage.cs
Jacob Schmidt 0d77300c22 feat: Project Journal backend monorepo
Monorepo with centralized build props, npm workspaces, LlamaSharp AI,
SQLite/SQLCipher storage, Svelte frontend, and unified smoke tests.

Co-Authored-By: Oz <oz-agent@warp.dev>
2026-03-02 20:56:26 -06:00

39 lines
1.2 KiB
C#

namespace Journal.Core.Models;
public class ConversationMessage
{
public Guid Id { get; }
public Guid ConversationId { get; }
public string Role { get; set; }
public string Text { get; set; }
public DateTimeOffset CreatedAt { get; set; }
public ConversationMessage(Guid conversationId, string role, string text)
{
if (conversationId == Guid.Empty)
throw new ArgumentException("ConversationId is required", nameof(conversationId));
if (string.IsNullOrWhiteSpace(role))
throw new ArgumentException("Role is required", nameof(role));
if (string.IsNullOrWhiteSpace(text))
throw new ArgumentException("Text is required", nameof(text));
Id = Guid.NewGuid();
ConversationId = conversationId;
Role = role.Trim();
Text = text;
CreatedAt = DateTimeOffset.Now;
}
public ConversationMessage(Guid id, Guid conversationId, string role, string text, DateTimeOffset createdAt)
{
if (id == Guid.Empty)
throw new ArgumentException("Id is required", nameof(id));
Id = id;
ConversationId = conversationId;
Role = role;
Text = text;
CreatedAt = createdAt;
}
}