mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-22 06:13:22 -07:00
Change TMDB id format to integer
This will better integrate with TMDB id type in the request model
This commit is contained in:
parent
9c84acb6fa
commit
eedc8753c3
8 changed files with 18 additions and 20 deletions
|
@ -65,7 +65,7 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
var totalCount = movies.TotalRecordCount;
|
var totalCount = movies.TotalRecordCount;
|
||||||
var processed = 0;
|
var processed = 0;
|
||||||
var mediaToAdd = new HashSet<UserPlayedMovie>();
|
var mediaToAdd = new HashSet<UserPlayedMovie>();
|
||||||
_logger.LogCritical($"Adding {totalCount.ToString()} for {user.UserName}");
|
|
||||||
while (processed < totalCount)
|
while (processed < totalCount)
|
||||||
{
|
{
|
||||||
foreach (var movie in movies.Items)
|
foreach (var movie in movies.Items)
|
||||||
|
@ -94,7 +94,7 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
}
|
}
|
||||||
var userPlayedMovie = new UserPlayedMovie()
|
var userPlayedMovie = new UserPlayedMovie()
|
||||||
{
|
{
|
||||||
TheMovieDbId = movieInfo.ProviderIds.Tmdb,
|
TheMovieDbId = int.Parse(movieInfo.ProviderIds.Tmdb),
|
||||||
UserId = user.Id
|
UserId = user.Id
|
||||||
};
|
};
|
||||||
// Check if it exists
|
// 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; }
|
|
||||||
}
|
|
||||||
}
|
|
8
src/Ombi.Store/Entities/UserPlayedMovie.cs
Normal file
8
src/Ombi.Store/Entities/UserPlayedMovie.cs
Normal file
|
@ -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
|
namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ExternalSqliteContext))]
|
[DbContext(typeof(ExternalSqliteContext))]
|
||||||
[Migration("20230309182556_MovieUserPlayed")]
|
[Migration("20230310130339_MovieUserPlayed")]
|
||||||
partial class MovieUserPlayed
|
partial class MovieUserPlayed
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
@ -494,8 +494,8 @@ namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("TheMovieDbId")
|
b.Property<int>("TheMovieDbId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
b.Property<string>("UserId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
|
@ -14,7 +14,7 @@ namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
.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)
|
UserId = table.Column<string>(type: "TEXT", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
|
@ -492,8 +492,8 @@ namespace Ombi.Store.Migrations.ExternalSqlite
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("TheMovieDbId")
|
b.Property<int>("TheMovieDbId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
b.Property<string>("UserId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
|
@ -8,6 +8,6 @@ namespace Ombi.Store.Repository
|
||||||
{
|
{
|
||||||
public interface IUserPlayedMovieRepository : IExternalRepository<UserPlayedMovie>
|
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;
|
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);
|
return await Db.UserPlayedMovie.FirstOrDefaultAsync(x => x.TheMovieDbId == theMovieDbId && x.UserId == userId);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue