aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2021-10-08 07:49:40 -0600
committerCody Robibero <cody@robibe.ro>2021-10-08 07:49:40 -0600
commit3bbd98cc3fb4e69b5d5471ab7cbdcc22d59a8eb9 (patch)
treed6a0aeb4896ec9ab4305916f0380606483180786 /Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs
parent7a7fe3e681eca87cde631336c9af565fd6dfe0d7 (diff)
parenta01f9775fffaacfd0fc03b24bff366b4701fe45e (diff)
Merge remote-tracking branch 'upstream/master' into schedules-direct
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs')
-rw-r--r--Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs
new file mode 100644
index 000000000..a750b65c0
--- /dev/null
+++ b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs
@@ -0,0 +1,28 @@
+using Jellyfin.Data.Entities.Security;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace Jellyfin.Server.Implementations.ModelConfiguration
+{
+ /// <summary>
+ /// FluentAPI configuration for the Device entity.
+ /// </summary>
+ public class DeviceConfiguration : IEntityTypeConfiguration<Device>
+ {
+ /// <inheritdoc/>
+ public void Configure(EntityTypeBuilder<Device> builder)
+ {
+ builder
+ .HasIndex(entity => new { entity.DeviceId, entity.DateLastActivity });
+
+ builder
+ .HasIndex(entity => new { entity.AccessToken, entity.DateLastActivity });
+
+ builder
+ .HasIndex(entity => new { entity.UserId, entity.DeviceId });
+
+ builder
+ .HasIndex(entity => entity.DeviceId);
+ }
+ }
+}