using Blahblah.FlowerStory.Server.Data.Model;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
namespace Blahblah.FlowerStory.Server.Controller;
///
/// 封面参数
///
public record CoverParameter
{
///
/// 封面
///
[FromForm(Name = "cover")]
public IFormFile? Cover { get; init; }
///
/// 封面 id
///
[FromForm(Name = "cid")]
public int? CoverId { get; init; }
}
///
/// 花草参数
///
public record FlowerParameter : CoverParameter
{
///
/// 类别 id
///
[Required]
[FromForm(Name = "categoryId")]
public required int CategoryId { get; init; }
///
/// 花草名称
///
[Required]
[FromForm(Name = "name")]
public required string Name { get; init; }
///
/// 购买时间
///
[Required]
[FromForm(Name = "dateBuy")]
public required long DateBuy { get; init; }
///
/// 购买花费
///
[FromForm(Name = "cost")]
public decimal? Cost { get; init; }
///
/// 购买渠道
///
[FromForm(Name = "purchase")]
public string? Purchase { get; init; }
///
/// 备注
///
[FromForm(Name = "memo")]
public string? Memo { get; set; }
///
/// 纬度
///
[FromForm(Name = "lat")]
public double? Latitude { get; set; }
///
/// 经度
///
[FromForm(Name = "lon")]
public double? Longitude { get; set; }
}
///
/// 花草修改参数
///
public record FlowerUpdateParameter : FlowerParameter
{
///
/// 花草唯一 id
///
[Required]
[FromForm(Name = "id")]
public required int Id { get; init; }
}
///
/// 花草封面修改参数
///
public record FlowerCoverParameter : CoverParameter
{
///
/// 花草唯一 id
///
[Required]
[FromForm(Name = "id")]
public required int Id { get; init; }
///
/// 纬度
///
[FromForm(Name = "lat")]
public double? Latitude { get; set; }
///
/// 经度
///
[FromForm(Name = "lon")]
public double? Longitude { get; set; }
}
///
/// 花草结果对象
///
public record FlowerResult
{
///
/// 花草列表
///
public required FlowerItem[] Flowers { get; init; }
///
/// 花草总数
///
public int Count { get; init; }
}