81 lines
1.7 KiB
C#
81 lines
1.7 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("flowers")]
|
||
public class FlowerItem
|
||
{
|
||
/// <summary>
|
||
/// 自增 id,主键
|
||
/// </summary>
|
||
[Column("fid")]
|
||
[Key]
|
||
[Required]
|
||
public int Id { get; set; }
|
||
|
||
/// <summary>
|
||
/// 所有人 uid
|
||
/// </summary>
|
||
[Column("uid")]
|
||
[Required]
|
||
public int OwnerId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 类别 id
|
||
/// </summary>
|
||
[Column("categoryid")]
|
||
[Required]
|
||
public int CategoryId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 花草名称
|
||
/// </summary>
|
||
[Column("name")]
|
||
[Required]
|
||
public required string Name { get; set; }
|
||
|
||
/// <summary>
|
||
/// 购买时间
|
||
/// </summary>
|
||
[Column("datebuy")]
|
||
[Required]
|
||
[JsonPropertyName("dateBuy")]
|
||
public long DateBuyUnixTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 购买花费
|
||
/// </summary>
|
||
[Column("cost", TypeName = "real")]
|
||
public decimal? Cost { get; set; }
|
||
|
||
/// <summary>
|
||
/// 购买渠道
|
||
/// </summary>
|
||
[Column("purchase")]
|
||
public string? Purchase { get; set; }
|
||
|
||
/// <summary>
|
||
/// 购买照片
|
||
/// </summary>
|
||
[Column("photo")]
|
||
public byte[]? Photo { get; set; }
|
||
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
[Column("memo")]
|
||
public string? Memo { get; set; }
|
||
|
||
/// <summary>
|
||
/// 购买时间
|
||
/// </summary>
|
||
[NotMapped]
|
||
[JsonIgnore]
|
||
public DateTimeOffset DateBuy => DateTimeOffset.FromUnixTimeMilliseconds(DateBuyUnixTime);
|
||
}
|