ql_apimanager_backend/Apimanager_backend/Models/Api.cs

66 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Apimanager_backend.Data;
using System.ComponentModel.DataAnnotations;
namespace Apimanager_backend.Models
{
public class Api
{
/// <summary>
/// 主键,自增
/// </summary>
public int Id { get; set; }
/// <summary>
/// API名称
/// </summary>
[MaxLength(200)]
[Required]
public string Name { get; set; } // varchar(20)
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// API地址
/// </summary>
[Required]
public string Endpoint { get; set; } // varchar(255)
/// <summary>
/// 调用方法
/// </summary>
public ApiMethod Method { get; set; } // enum('GET','POST','PUT', 'DELETE')
/// <summary>
/// 套餐Id默认为空免费无限制
/// </summary>
public int? PackageId { get; set; } // int? 使其可为null
/// <summary>
/// 是否第三方API
/// </summary>
public bool IsThirdParty { get; set; } // boolean
/// <summary>
/// 是否启用
/// </summary>
public bool IsActive { get; set; } // boolean
/// <summary>
/// 是否删除
/// </summary>
public bool IsDelete { get; set; } // boolean
/// <summary>
/// 创建时间,默认当前时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow; // timestamp
//导航属性
public Apipackage? Package { get; set; }
public ICollection<ApiPackageItem> ApiPackageItems { get; set; }
public ICollection<ApiCallLog> ApiCalls { get; set; }
public ICollection<ApiRequestExample> ApiRequestExamples { get; set; }
}
}