using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; namespace Blahblah.FlowerStory.Server.Data.Model; /// /// 花草对象 /// [Table("flowers")] public class FlowerItem { /// /// 自增 id,主键 /// [Column("fid")] [Key] [Required] public int Id { get; set; } /// /// 所有人 uid /// [Column("uid")] [Required] public int OwnerId { get; set; } /// /// 类别 id /// [Column("categoryid")] [Required] public int CategoryId { get; set; } /// /// 花草名称 /// [Column("name")] [Required] public required string Name { get; set; } /// /// 购买时间 /// [Column("datebuy")] [Required] [JsonPropertyName("dateBuy")] public long DateBuyUnixTime { get; set; } /// /// 购买花费 /// [Column("cost", TypeName = "real")] public decimal? Cost { get; set; } /// /// 购买渠道 /// [Column("purchase")] public string? Purchase { get; set; } /// /// 购买照片 /// [Column("photo")] public byte[]? Photo { get; set; } /// /// 购买时间 /// [NotMapped] [JsonIgnore] public DateTimeOffset DateBuy => DateTimeOffset.FromUnixTimeMilliseconds(DateBuyUnixTime); }