complete controllers
This commit is contained in:
84
Server/Data/Model/PhotoItem.cs
Normal file
84
Server/Data/Model/PhotoItem.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Blahblah.FlowerStory.Server.Data.Model;
|
||||
|
||||
/// <summary>
|
||||
/// 照片对象
|
||||
/// </summary>
|
||||
[Table("photos")]
|
||||
public class PhotoItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增 id,主键
|
||||
/// </summary>
|
||||
[Column("pid")]
|
||||
[Key]
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联花草 id
|
||||
/// </summary>
|
||||
[Column("fid")]
|
||||
[ForeignKey(nameof(Flower))]
|
||||
[Required]
|
||||
public int FlowerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联花草
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public FlowerItem? Flower { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的事件 id
|
||||
/// </summary>
|
||||
[Column("rid")]
|
||||
[ForeignKey(nameof(Record))]
|
||||
[Required]
|
||||
public int RecordId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的事件
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public RecordItem? Record { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片类型
|
||||
/// </summary>
|
||||
[Column("filetype")]
|
||||
[Required]
|
||||
public required string FileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件名
|
||||
/// </summary>
|
||||
[Column("filename")]
|
||||
[Required]
|
||||
public required string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件路径
|
||||
/// </summary>
|
||||
[Column("path")]
|
||||
[Required]
|
||||
public required string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传时间
|
||||
/// </summary>
|
||||
[Column("dateupload")]
|
||||
[Required]
|
||||
[JsonPropertyName("dateUpload")]
|
||||
public long DateUploadUnixTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传时间
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
public DateTimeOffset DateUpload => DateTimeOffset.FromUnixTimeMilliseconds(DateUploadUnixTime);
|
||||
}
|
Reference in New Issue
Block a user