aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2021-12-24 02:41:50 +0000
committerGitHub <noreply@github.com>2021-12-24 02:41:50 +0000
commit634ce40c2facfbfaf6454ad8d3a7f2aca4723b46 (patch)
treecf2f3c660f4dfbd8ea19614a10fc1cc0052d55de /Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs
parent6648b7d7dabeaa84835fc7a8a7a2a468a00cad5c (diff)
parentb5459f49d32d0fce3944f816915fb7380fd84681 (diff)
Merge branch 'master' into comparisons
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs')
-rw-r--r--Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs
new file mode 100644
index 000000000..3f19b6986
--- /dev/null
+++ b/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs
@@ -0,0 +1,20 @@
+using Jellyfin.Data.Entities.Security;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace Jellyfin.Server.Implementations.ModelConfiguration
+{
+ /// <summary>
+ /// FluentAPI configuration for the ApiKey entity.
+ /// </summary>
+ public class ApiKeyConfiguration : IEntityTypeConfiguration<ApiKey>
+ {
+ /// <inheritdoc/>
+ public void Configure(EntityTypeBuilder<ApiKey> builder)
+ {
+ builder
+ .HasIndex(entity => entity.AccessToken)
+ .IsUnique();
+ }
+ }
+}