Change TMDB id format to integer

This will better integrate with TMDB id type in the request model
pull/4881/head
sephrat 1 year ago
parent 9c84acb6fa
commit eedc8753c3

@ -65,7 +65,7 @@ namespace Ombi.Schedule.Jobs.Emby
var totalCount = movies.TotalRecordCount;
var processed = 0;
var mediaToAdd = new HashSet<UserPlayedMovie>();
_logger.LogCritical($"Adding {totalCount.ToString()} for {user.UserName}");
while (processed < totalCount)
{
foreach (var movie in movies.Items)
@ -94,7 +94,7 @@ namespace Ombi.Schedule.Jobs.Emby
}
var userPlayedMovie = new UserPlayedMovie()
{
TheMovieDbId = movieInfo.ProviderIds.Tmdb,
TheMovieDbId = int.Parse(movieInfo.ProviderIds.Tmdb),
UserId = user.Id
};
// Check if it exists

@ -1,10 +0,0 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Ombi.Store.Entities
{
public class UserPlayedMovie : Entity
{
public string TheMovieDbId { get; set; }
public string UserId { get; set; }
}
}

@ -0,0 +1,8 @@
namespace Ombi.Store.Entities
{
public class UserPlayedMovie : Entity
{
public int TheMovieDbId { get; set; }
public string UserId { get; set; }
}
}

@ -11,7 +11,7 @@ using Ombi.Store.Context.Sqlite;
namespace Ombi.Store.Migrations.ExternalSqlite
{
[DbContext(typeof(ExternalSqliteContext))]
[Migration("20230309182556_MovieUserPlayed")]
[Migration("20230310130339_MovieUserPlayed")]
partial class MovieUserPlayed
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -494,8 +494,8 @@ namespace Ombi.Store.Migrations.ExternalSqlite
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("TheMovieDbId")
.HasColumnType("TEXT");
b.Property<int>("TheMovieDbId")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");

@ -14,7 +14,7 @@ namespace Ombi.Store.Migrations.ExternalSqlite
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TheMovieDbId = table.Column<string>(type: "TEXT", nullable: true),
TheMovieDbId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>

@ -492,8 +492,8 @@ namespace Ombi.Store.Migrations.ExternalSqlite
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("TheMovieDbId")
.HasColumnType("TEXT");
b.Property<int>("TheMovieDbId")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");

@ -8,6 +8,6 @@ namespace Ombi.Store.Repository
{
public interface IUserPlayedMovieRepository : IExternalRepository<UserPlayedMovie>
{
Task<UserPlayedMovie> Get(string theMovieDbId, string userId);
Task<UserPlayedMovie> Get(int theMovieDbId, string userId);
}
}

@ -18,7 +18,7 @@ namespace Ombi.Store.Repository
Db = db;
}
public async Task<UserPlayedMovie> Get(string theMovieDbId, string userId)
public async Task<UserPlayedMovie> Get(int theMovieDbId, string userId)
{
return await Db.UserPlayedMovie.FirstOrDefaultAsync(x => x.TheMovieDbId == theMovieDbId && x.UserId == userId);

Loading…
Cancel
Save