diff options
| author | Fernando Fernández <ferferga@hotmail.com> | 2021-09-06 21:05:21 +0200 |
|---|---|---|
| committer | Fernando Fernández <ferferga@hotmail.com> | 2021-09-06 21:15:31 +0200 |
| commit | f4af78817d5832c11ff96f365714917fad0db4f9 (patch) | |
| tree | b00c18f5133386e962d087e910fbaf5b72eeb001 /Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs | |
| parent | c2652d21e1da0c39e91b8a5dea21c4de1fea3f9d (diff) | |
Move model configuration to its own classes
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs | 30 |
1 files changed, 30 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..5b4e711cc --- /dev/null +++ b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs @@ -0,0 +1,30 @@ +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) + { + // Indexes + + 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); + } + } +} |
