diff options
Diffstat (limited to 'Tag.cs')
| -rw-r--r-- | Tag.cs | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,6 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations.Schema; namespace HyperBooru; @@ -15,6 +13,14 @@ public class TagDefinition : HBObject { public string Name { get; set; } public string? Alias { get; set;} public virtual List<TagDefinition> ImplicitTags { get; set; } = new(); + + public static explicit operator ApiModels.TagDefinition(TagDefinition tagDefinition) => new() { + TagDefinitionId = tagDefinition.Guid, + Namespace = tagDefinition.Namespace, + Name = tagDefinition.Name, + Alias = tagDefinition.Alias, + ImplicitTags = tagDefinition.ImplicitTags.Select(td => td.Guid).ToArray() + }; } public class Tag : HBObject { |
