summaryrefslogtreecommitdiff
path: root/Tag.cs
blob: 156079856f193e660137d183f05a06493da909a6 (plain)
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
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace HyperBooru;

public enum TagSource {
    Internal,
    UserTag
}

[AclType(typeof(TagPermissions))]
public class TagDefinition : HBObject {
    public         TagSource           Source       { get; set; } = TagSource.Internal;
    public         string?             Namespace    { get; set; }
    public         string              Name         { get; set; }
    public         string?             Alias        { get; set;}
    public virtual List<TagDefinition> ImplicitTags { get; set; } = new();
}

public class Tag : HBObject {
    [ForeignKey("ObjectId")]
    public         int           TagDefinitionId { get; set; }
    public virtual TagDefinition TagDefinition   { get; set; }
    public         DateTime      CreateTime      { get; set; } = DateTime.UtcNow;
    public virtual HBObject      Target          { get; set; }

    public Tag() {}

    public Tag(TagDefinition tagDef) =>
        this.TagDefinition = tagDef;
}