diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-05-30 04:00:45 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-01 01:59:07 +1000 |
| commit | abe500bdb2cee643a593fe11286be383bd481af9 (patch) | |
| tree | 4433115d6797f23f3699bddf0029f5a828603dec | |
| parent | c3e9d39034e5afc3f2c3a12c8c7682eabe360b7d (diff) | |
Added tag source to API tag model
| -rw-r--r-- | HBContext.cs | 3 | ||||
| -rw-r--r-- | Pages/Component/MediaTagTable.razor | 2 | ||||
| -rw-r--r-- | Pages/Component/TagSelectDialog.razor | 2 | ||||
| -rw-r--r-- | Pages/TagDefinitions.razor | 4 | ||||
| -rw-r--r-- | Tag.cs | 9 |
5 files changed, 9 insertions, 11 deletions
diff --git a/HBContext.cs b/HBContext.cs index b684a51..766c0a3 100644 --- a/HBContext.cs +++ b/HBContext.cs @@ -1,4 +1,5 @@ -using HyperBooru.Services; +using HyperBooru.ApiModels; +using HyperBooru.Services; using Microsoft.EntityFrameworkCore; namespace HyperBooru; diff --git a/Pages/Component/MediaTagTable.razor b/Pages/Component/MediaTagTable.razor index e687529..1b62832 100644 --- a/Pages/Component/MediaTagTable.razor +++ b/Pages/Component/MediaTagTable.razor @@ -61,7 +61,7 @@ var media = db.Media.First(m => m.ObjectId == Media.ObjectId); tagDefs = tagService.GetAllTags(Media) - .Where(e => e.tagDefinition.Source == TagSource.UserTag) + .Where(e => e.tagDefinition.Source == ApiModels.TagSource.UserTag) .ToArray(); } diff --git a/Pages/Component/TagSelectDialog.razor b/Pages/Component/TagSelectDialog.razor index 87065d7..d33b178 100644 --- a/Pages/Component/TagSelectDialog.razor +++ b/Pages/Component/TagSelectDialog.razor @@ -97,7 +97,7 @@ tagDefinitions = db.TagDefinitions .Include(td => td.ImplicitTags) - .Where(td => td.Source == TagSource.UserTag) + .Where(td => td.Source == ApiModels.TagSource.UserTag) .OrderBy(td => td.Name) .AsEnumerable() .Where(td => userService.UserSessionState.ShowNsfw || !td.ImplicitTags diff --git a/Pages/TagDefinitions.razor b/Pages/TagDefinitions.razor index f3dca0f..c67a43f 100644 --- a/Pages/TagDefinitions.razor +++ b/Pages/TagDefinitions.razor @@ -34,7 +34,7 @@ <i> @{ var implicitTags = tagDef.ImplicitTags - .Where(td => td.Source == TagSource.UserTag); + .Where(td => td.Source == ApiModels.TagSource.UserTag); foreach(var tag in implicitTags) { <a href="/Gallery?q=@tag.Name" class="nondecorated"> @tag.Name @@ -108,7 +108,7 @@ tagDefinitions = dbFactory.CreateDbContext().TagDefinitions .Include(td => td.ImplicitTags) - .Where(td => td.Source == TagSource.UserTag) + .Where(td => td.Source == ApiModels.TagSource.UserTag) .OrderBy(td => td.Namespace) .ThenBy(td => td.Name) .AsEnumerable() @@ -1,12 +1,8 @@ -using System.ComponentModel.DataAnnotations.Schema; +using HyperBooru.ApiModels; +using System.ComponentModel.DataAnnotations.Schema; namespace HyperBooru; -public enum TagSource { - Internal, - UserTag -} - public class TagDefinition : HBObject { public TagSource Source { get; set; } = TagSource.Internal; public string? Namespace { get; set; } @@ -16,6 +12,7 @@ public class TagDefinition : HBObject { public static explicit operator ApiModels.TagDefinition(TagDefinition tagDefinition) => new() { TagDefinitionId = tagDefinition.Guid, + Source = tagDefinition.Source, Namespace = tagDefinition.Namespace, Name = tagDefinition.Name, Alias = tagDefinition.Alias, |
