File size: 1,461 Bytes
5fc700d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using FreeSql.DataAnnotations;

namespace ToolHub.Models;

[Table(Name = "Tools")]
public class Tool
{
    [Column(IsIdentity = true, IsPrimary = true)]
    public int Id { get; set; }

    [Column(StringLength = 200)]
    public string Name { get; set; } = string.Empty;

    [Column(StringLength = 1000)]
    public string? Description { get; set; }

    [Column(StringLength = 500)]
    public string? Icon { get; set; }

    [Column(StringLength = 500)]
    public string? Image { get; set; }

    [Column(StringLength = 500)]
    public string? Url { get; set; }

    public int CategoryId { get; set; }

    public int ViewCount { get; set; } = 0;

    public int FavoriteCount { get; set; } = 0;

    public decimal Rating { get; set; } = 0;

    public int RatingCount { get; set; } = 0;

    public bool IsHot { get; set; } = false;

    public bool IsNew { get; set; } = false;

    public bool IsRecommended { get; set; } = false;

    public bool IsActive { get; set; } = true;

    public int SortOrder { get; set; } = 0;

    public DateTime CreatedAt { get; set; } = DateTime.Now;

    public DateTime? UpdatedAt { get; set; }

    // 导航属性
    [Navigate(nameof(CategoryId))]
    public Category Category { get; set; } = null!;

    [Navigate(nameof(UserFavorite.ToolId))]
    public List<UserFavorite> UserFavorites { get; set; } = new();

    [Navigate(nameof(ToolTag.ToolId))]
    public List<ToolTag> ToolTags { get; set; } = new();
}