100 lines
2.1 KiB
C#
100 lines
2.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
using System.Text.Json.Serialization;
|
||
|
||
namespace Blahblah.FlowerStory.Server.Data.Model;
|
||
|
||
/// <summary>
|
||
/// 评论对象
|
||
/// </summary>
|
||
[Table("comments")]
|
||
public class CommentItem
|
||
{
|
||
/// <summary>
|
||
/// 自增 id,主键
|
||
/// </summary>
|
||
[Column("cid")]
|
||
[Key]
|
||
[Required]
|
||
public int Id { get; set; }
|
||
|
||
/// <summary>
|
||
/// 关联人 id
|
||
/// </summary>
|
||
[Column("uid")]
|
||
[ForeignKey(nameof(Owner))]
|
||
[Required]
|
||
public int OwnerId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 关联人
|
||
/// </summary>
|
||
[JsonIgnore]
|
||
public UserItem? Owner { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作时间
|
||
/// </summary>
|
||
[Column("date")]
|
||
[Required]
|
||
[JsonPropertyName("date")]
|
||
public long DateUnixTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 关联的事件 id
|
||
/// </summary>
|
||
[Column("rid")]
|
||
[Required]
|
||
[ForeignKey(nameof(Record))]
|
||
public int RecordId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 关联的事件
|
||
/// </summary>
|
||
[JsonIgnore]
|
||
public RecordItem Record { get; set; } = null!;
|
||
|
||
/// <summary>
|
||
/// 评论类别:1-点赞,2-收藏,3-标签,default-评论
|
||
/// </summary>
|
||
[Column("category")]
|
||
public int? CommentCategoryId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作人 uid
|
||
/// </summary>
|
||
[Column("byuid")]
|
||
public int? ByUserId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作人名称
|
||
/// </summary>
|
||
[Column("byname")]
|
||
public string? ByUserName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
[Column("text")]
|
||
public string? Text { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作时间
|
||
/// </summary>
|
||
[NotMapped]
|
||
[JsonIgnore]
|
||
public DateTimeOffset Date => DateTimeOffset.FromUnixTimeMilliseconds(DateUnixTime);
|
||
|
||
/// <summary>
|
||
/// 纬度
|
||
/// </summary>
|
||
[Column("latitude")]
|
||
public double? Latitude { get; set; }
|
||
|
||
/// <summary>
|
||
/// 经度
|
||
/// </summary>
|
||
[Column("longitude")]
|
||
public double? Longitude { get; set; }
|
||
}
|