complete controllers

This commit is contained in:
2023-05-25 21:54:40 +08:00
parent 3b5bd291f9
commit 50e7297848
21 changed files with 2257 additions and 566 deletions

View 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);
}