| | | 1 | | using Jellyfin.Database.Implementations.Entities; |
| | | 2 | | using Microsoft.EntityFrameworkCore; |
| | | 3 | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | 4 | | |
| | | 5 | | namespace Jellyfin.Database.Implementations.ModelConfiguration; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// FluentAPI configuration for the UserData entity. |
| | | 9 | | /// </summary> |
| | | 10 | | public class UserDataConfiguration : IEntityTypeConfiguration<UserData> |
| | | 11 | | { |
| | | 12 | | /// <inheritdoc/> |
| | | 13 | | public void Configure(EntityTypeBuilder<UserData> builder) |
| | | 14 | | { |
| | 2 | 15 | | builder.HasKey(d => new { d.ItemId, d.UserId, d.CustomDataKey }); |
| | 2 | 16 | | builder.HasIndex(d => new { d.ItemId, d.UserId, d.Played }); |
| | 2 | 17 | | builder.HasIndex(d => new { d.ItemId, d.UserId, d.PlaybackPositionTicks }); |
| | 2 | 18 | | builder.HasIndex(d => new { d.ItemId, d.UserId, d.IsFavorite }); |
| | 2 | 19 | | builder.HasIndex(d => new { d.ItemId, d.UserId, d.LastPlayedDate }); |
| | 2 | 20 | | builder.HasOne(e => e.Item).WithMany(e => e.UserData); |
| | 2 | 21 | | } |
| | | 22 | | } |