RegexBot/Data/CachedGuildMessage.cs
Noi 1149f2800d Reorganized project
Moved modules into the assembly itself to simplify development of
further features and reduce complexity in building this project.

Additionally, many small adjustments were made, including:
- Add documentation to most public methods that had it missing
- Minor style updates
- Updated readme to reflect near-completion of this rewrite
- Remove any last remaining references to old project name Kerobot
- Update dependencies
2022-07-20 18:55:08 -07:00

62 lines
1.9 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RegexBot.Data;
/// <summary>
/// Represents an item in the guild message cache.
/// </summary>
[Table("cache_guildmessages")]
public class CachedGuildMessage {
/// <summary>
/// Gets the message's snowflake ID.
/// </summary>
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public long MessageId { get; set; }
/// <summary>
/// Gets the message author's snowflake ID.
/// </summary>
public long AuthorId { get; set; }
/// <summary>
/// Gets the associated guild's snowflake ID.
/// </summary>
public long GuildId { get; set; }
/// <summary>
/// Gets the corresponding channel's snowflake ID.
/// </summary>
public long ChannelId { get; set; }
/// <summary>
/// Gets the timestamp showing when this message was originally created.
/// </summary>
/// <remarks>
/// Though it's possible to draw this from <see cref="MessageId"/>, it is stored in the database
/// as a separate field for any possible necessary use via database queries.
/// </remarks>
public DateTimeOffset CreatedAt { get; set; }
/// <summary>
/// Gets the timestamp, if any, showing when this message was last edited.
/// </summary>
public DateTimeOffset? EditedAt { get; set; }
/// <summary>
/// Gets a list of file names thata were attached to this message.
/// </summary>
public List<string> AttachmentNames { get; set; } = null!;
/// <summary>
/// Gets this message's content.
/// </summary>
public string Content { get; set; } = null!;
/// <summary>
/// If included in the query, references the associated <seealso cref="CachedUser"/> for this entry.
/// </summary>
[ForeignKey(nameof(AuthorId))]
[InverseProperty(nameof(CachedUser.GuildMessages))]
public CachedUser Author { get; set; } = null!;
}