mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Handle external ids
This commit is contained in:
parent
19ae15f53f
commit
5c270a0362
@ -64,7 +64,7 @@ namespace Kyoo.Abstractions.Models
|
||||
{
|
||||
public ItemKind Kind { get; }
|
||||
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Slug { get; set; }
|
||||
|
||||
|
@ -20,16 +20,16 @@ namespace Kyoo.Abstractions.Models
|
||||
/// <summary>
|
||||
/// ID and link of an item on an external provider.
|
||||
/// </summary>
|
||||
public class MetadataID
|
||||
public class MetadataId
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID of the resource on the external provider.
|
||||
/// </summary>
|
||||
public string DataID { get; set; }
|
||||
public string DataId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The URL of the resource on the external provider.
|
||||
/// </summary>
|
||||
public string Link { get; set; }
|
||||
public string? Link { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -93,14 +93,14 @@ namespace Kyoo.Abstractions.Models
|
||||
|
||||
if (items.Count > 0 && query.ContainsKey("afterID"))
|
||||
{
|
||||
query["afterID"] = items.First().ID.ToString();
|
||||
query["afterID"] = items.First().Id.ToString();
|
||||
query["reverse"] = "true";
|
||||
Previous = url + query.ToQueryString();
|
||||
}
|
||||
query.Remove("reverse");
|
||||
if (items.Count == limit && limit > 0)
|
||||
{
|
||||
query["afterID"] = items.Last().ID.ToString();
|
||||
query["afterID"] = items.Last().Id.ToString();
|
||||
Next = url + query.ToQueryString();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class PeopleRole : IResource
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Slug => ForPeople ? Show.Slug : People.Slug;
|
||||
|
@ -31,7 +31,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class Collection : IResource, IMetadata, IThumbnails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[MaxLength(256)] public string Slug { get; set; }
|
||||
@ -66,7 +66,7 @@ namespace Kyoo.Abstractions.Models
|
||||
[LoadableRelation] public ICollection<Show>? Shows { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
public Collection() { }
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class Episode : IResource, IMetadata, IThumbnails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Computed]
|
||||
@ -148,7 +148,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public Image? Logo { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get the slug of an episode.
|
||||
|
@ -26,8 +26,8 @@ namespace Kyoo.Abstractions.Models
|
||||
public interface IMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// The link to metadata providers that this show has. See <see cref="MetadataID"/> for more information.
|
||||
/// The link to metadata providers that this show has. See <see cref="MetadataId"/> for more information.
|
||||
/// </summary>
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; }
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace Kyoo.Abstractions.Models
|
||||
/// You don't need to specify an ID manually when creating a new resource,
|
||||
/// this field is automatically assigned by the <see cref="IRepository{T}"/>.
|
||||
/// </remarks>
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A human-readable identifier that can be used instead of an ID.
|
||||
|
@ -32,7 +32,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class Movie : IResource, IMetadata, IOnMerge, IThumbnails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[MaxLength(256)]
|
||||
@ -98,7 +98,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public string? Trailer { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the Studio that made this show.
|
||||
|
@ -30,7 +30,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class People : IResource, IMetadata, IThumbnails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[MaxLength(256)]
|
||||
@ -51,7 +51,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public Image? Logo { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The list of roles this person has played in. See <see cref="PeopleRole"/> for more information.
|
||||
|
@ -32,7 +32,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class Season : IResource, IMetadata, IThumbnails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Computed]
|
||||
@ -110,7 +110,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public Image? Logo { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The list of episodes that this season contains.
|
||||
|
@ -32,7 +32,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class Show : IResource, IMetadata, IOnMerge, IThumbnails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[MaxLength(256)]
|
||||
@ -100,7 +100,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public string? Trailer { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the Studio that made this show.
|
||||
|
@ -30,7 +30,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class Studio : IResource, IMetadata
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[MaxLength(256)]
|
||||
@ -52,7 +52,7 @@ namespace Kyoo.Abstractions.Models
|
||||
[LoadableRelation] public ICollection<Movie>? Movies { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, MetadataID> ExternalId { get; set; } = new();
|
||||
public Dictionary<string, MetadataId> ExternalId { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new, empty, <see cref="Studio"/>.
|
||||
|
@ -30,7 +30,7 @@ namespace Kyoo.Abstractions.Models
|
||||
public class User : IResource
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public int ID { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[MaxLength(256)]
|
||||
|
@ -139,7 +139,7 @@ namespace Kyoo.Abstractions.Models.Utils
|
||||
public bool IsSame(IResource resource)
|
||||
{
|
||||
return Match(
|
||||
id => resource.ID == id,
|
||||
id => resource.Id == id,
|
||||
slug => resource.Slug == slug
|
||||
);
|
||||
}
|
||||
@ -155,7 +155,7 @@ namespace Kyoo.Abstractions.Models.Utils
|
||||
where T : IResource
|
||||
{
|
||||
return _id.HasValue
|
||||
? x => x.ID == _id.Value
|
||||
? x => x.Id == _id.Value
|
||||
: x => x.Slug == _slug;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace Kyoo.Authentication
|
||||
: string.Empty;
|
||||
List<Claim> claims = new()
|
||||
{
|
||||
new Claim(Claims.Id, user.ID.ToString(CultureInfo.InvariantCulture)),
|
||||
new Claim(Claims.Id, user.Id.ToString(CultureInfo.InvariantCulture)),
|
||||
new Claim(Claims.Name, user.Username),
|
||||
new Claim(Claims.Permissions, permissions),
|
||||
new Claim(Claims.Type, "access")
|
||||
@ -85,7 +85,7 @@ namespace Kyoo.Authentication
|
||||
signingCredentials: credential,
|
||||
claims: new[]
|
||||
{
|
||||
new Claim(Claims.Id, user.ID.ToString(CultureInfo.InvariantCulture)),
|
||||
new Claim(Claims.Id, user.Id.ToString(CultureInfo.InvariantCulture)),
|
||||
new Claim(Claims.Guid, Guid.NewGuid().ToString()),
|
||||
new Claim(Claims.Type, "refresh")
|
||||
},
|
||||
|
@ -228,7 +228,7 @@ namespace Kyoo.Authentication.Views
|
||||
return Unauthorized(new RequestError("User not authenticated or token invalid."));
|
||||
try
|
||||
{
|
||||
user.ID = userID;
|
||||
user.Id = userID;
|
||||
return await _users.Edit(user, true);
|
||||
}
|
||||
catch (ItemNotFoundException)
|
||||
@ -258,7 +258,7 @@ namespace Kyoo.Authentication.Views
|
||||
return Unauthorized(new RequestError("User not authenticated or token invalid."));
|
||||
try
|
||||
{
|
||||
user.ID = userID;
|
||||
user.Id = userID;
|
||||
return await _users.Edit(user, false);
|
||||
}
|
||||
catch (ItemNotFoundException)
|
||||
|
@ -252,73 +252,73 @@ namespace Kyoo.Core.Controllers
|
||||
return (obj, member: memberName) switch
|
||||
{
|
||||
(Collection c, nameof(Collection.Shows)) => ShowRepository
|
||||
.GetAll(x => x.Collections.Any(y => y.ID == obj.ID))
|
||||
.GetAll(x => x.Collections.Any(y => y.Id == obj.Id))
|
||||
.Then(x => c.Shows = x),
|
||||
|
||||
(Show s, nameof(Show.People)) => PeopleRepository
|
||||
.GetFromShow(obj.ID)
|
||||
.GetFromShow(obj.Id)
|
||||
.Then(x => s.People = x),
|
||||
|
||||
(Show s, nameof(Show.Seasons)) => _SetRelation(s,
|
||||
SeasonRepository.GetAll(x => x.Show.ID == obj.ID),
|
||||
SeasonRepository.GetAll(x => x.Show.Id == obj.Id),
|
||||
(x, y) => x.Seasons = y,
|
||||
(x, y) => { x.Show = y; x.ShowID = y.ID; }),
|
||||
(x, y) => { x.Show = y; x.ShowID = y.Id; }),
|
||||
|
||||
(Show s, nameof(Show.Episodes)) => _SetRelation(s,
|
||||
EpisodeRepository.GetAll(x => x.Show.ID == obj.ID),
|
||||
EpisodeRepository.GetAll(x => x.Show.Id == obj.Id),
|
||||
(x, y) => x.Episodes = y,
|
||||
(x, y) => { x.Show = y; x.ShowID = y.ID; }),
|
||||
(x, y) => { x.Show = y; x.ShowID = y.Id; }),
|
||||
|
||||
(Show s, nameof(Show.Collections)) => CollectionRepository
|
||||
.GetAll(x => x.Shows.Any(y => y.ID == obj.ID))
|
||||
.GetAll(x => x.Shows.Any(y => y.Id == obj.Id))
|
||||
.Then(x => s.Collections = x),
|
||||
|
||||
(Show s, nameof(Show.Studio)) => StudioRepository
|
||||
.GetOrDefault(x => x.Shows.Any(y => y.ID == obj.ID))
|
||||
.GetOrDefault(x => x.Shows.Any(y => y.Id == obj.Id))
|
||||
.Then(x =>
|
||||
{
|
||||
s.Studio = x;
|
||||
s.StudioID = x?.ID ?? 0;
|
||||
s.StudioID = x?.Id ?? 0;
|
||||
}),
|
||||
|
||||
|
||||
(Season s, nameof(Season.Episodes)) => _SetRelation(s,
|
||||
EpisodeRepository.GetAll(x => x.Season.ID == obj.ID),
|
||||
EpisodeRepository.GetAll(x => x.Season.Id == obj.Id),
|
||||
(x, y) => x.Episodes = y,
|
||||
(x, y) => { x.Season = y; x.SeasonID = y.ID; }),
|
||||
(x, y) => { x.Season = y; x.SeasonID = y.Id; }),
|
||||
|
||||
(Season s, nameof(Season.Show)) => ShowRepository
|
||||
.GetOrDefault(x => x.Seasons.Any(y => y.ID == obj.ID))
|
||||
.GetOrDefault(x => x.Seasons.Any(y => y.Id == obj.Id))
|
||||
.Then(x =>
|
||||
{
|
||||
s.Show = x;
|
||||
s.ShowID = x?.ID ?? 0;
|
||||
s.ShowID = x?.Id ?? 0;
|
||||
}),
|
||||
|
||||
|
||||
(Episode e, nameof(Episode.Show)) => ShowRepository
|
||||
.GetOrDefault(x => x.Episodes.Any(y => y.ID == obj.ID))
|
||||
.GetOrDefault(x => x.Episodes.Any(y => y.Id == obj.Id))
|
||||
.Then(x =>
|
||||
{
|
||||
e.Show = x;
|
||||
e.ShowID = x?.ID ?? 0;
|
||||
e.ShowID = x?.Id ?? 0;
|
||||
}),
|
||||
|
||||
(Episode e, nameof(Episode.Season)) => SeasonRepository
|
||||
.GetOrDefault(x => x.Episodes.Any(y => y.ID == e.ID))
|
||||
.GetOrDefault(x => x.Episodes.Any(y => y.Id == e.Id))
|
||||
.Then(x =>
|
||||
{
|
||||
e.Season = x;
|
||||
e.SeasonID = x?.ID ?? 0;
|
||||
e.SeasonID = x?.Id ?? 0;
|
||||
}),
|
||||
|
||||
|
||||
(Studio s, nameof(Studio.Shows)) => ShowRepository
|
||||
.GetAll(x => x.Studio.ID == obj.ID)
|
||||
.GetAll(x => x.Studio.Id == obj.Id)
|
||||
.Then(x => s.Shows = x),
|
||||
|
||||
(People p, nameof(People.Roles)) => PeopleRepository
|
||||
.GetFromPeople(obj.ID)
|
||||
.GetFromPeople(obj.Id)
|
||||
.Then(x => p.Roles = x),
|
||||
|
||||
_ => throw new ArgumentException($"Couldn't find a way to load {memberName} of {obj.Slug}.")
|
||||
|
@ -64,7 +64,7 @@ namespace Kyoo.Core.Controllers
|
||||
// Edit episode slugs when the show's slug changes.
|
||||
shows.OnEdited += (show) =>
|
||||
{
|
||||
List<Episode> episodes = _database.Episodes.AsTracking().Where(x => x.ShowID == show.ID).ToList();
|
||||
List<Episode> episodes = _database.Episodes.AsTracking().Where(x => x.ShowID == show.Id).ToList();
|
||||
foreach (Episode ep in episodes)
|
||||
{
|
||||
ep.ShowSlug = show.Slug;
|
||||
@ -142,7 +142,7 @@ namespace Kyoo.Core.Controllers
|
||||
public override async Task<Episode> Create(Episode obj)
|
||||
{
|
||||
await base.Create(obj);
|
||||
obj.ShowSlug = obj.Show?.Slug ?? _database.Shows.First(x => x.ID == obj.ShowID).Slug;
|
||||
obj.ShowSlug = obj.Show?.Slug ?? _database.Shows.First(x => x.Id == obj.ShowID).Slug;
|
||||
_database.Entry(obj).State = EntityState.Added;
|
||||
await _database.SaveChangesAsync(() =>
|
||||
obj.SeasonNumber != null && obj.EpisodeNumber != null
|
||||
@ -163,7 +163,7 @@ namespace Kyoo.Core.Controllers
|
||||
throw new ArgumentException($"Can't store an episode not related " +
|
||||
$"to any show (showID: {resource.ShowID}).");
|
||||
}
|
||||
resource.ShowID = resource.Show.ID;
|
||||
resource.ShowID = resource.Show.Id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace Kyoo.Core.Controllers
|
||||
/// <inheritdoc />
|
||||
public override async Task<ILibraryItem> GetOrDefault(int id)
|
||||
{
|
||||
return (await _database.LibraryItems.FirstOrDefaultAsync(x => x.ID == id)).ToItem();
|
||||
return (await _database.LibraryItems.FirstOrDefaultAsync(x => x.Id == id)).ToItem();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -112,7 +112,7 @@ namespace Kyoo.Core.Controllers
|
||||
throw new SwitchExpressionException();
|
||||
}
|
||||
}
|
||||
return _Sort(query, sortBy, false).ThenBy(x => x.ID);
|
||||
return _Sort(query, sortBy, false).ThenBy(x => x.Id);
|
||||
}
|
||||
|
||||
private static Func<Expression, Expression, BinaryExpression> _GetComparisonExpression(
|
||||
@ -167,7 +167,7 @@ namespace Kyoo.Core.Controllers
|
||||
}
|
||||
|
||||
// Don't forget that every sorts must end with a ID sort (to differenciate equalities).
|
||||
Sort<T>.By id = new(x => x.ID);
|
||||
Sort<T>.By id = new(x => x.Id);
|
||||
IEnumerable<Sort<T>.By> sorts = _GetSortsBy(sort).Append(id);
|
||||
|
||||
BinaryExpression filter = null;
|
||||
@ -234,7 +234,7 @@ namespace Kyoo.Core.Controllers
|
||||
/// <returns>The tracked resource with the given ID</returns>
|
||||
protected virtual async Task<T> GetWithTracking(int id)
|
||||
{
|
||||
T ret = await Database.Set<T>().AsTracking().FirstOrDefaultAsync(x => x.ID == id);
|
||||
T ret = await Database.Set<T>().AsTracking().FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (ret == null)
|
||||
throw new ItemNotFoundException($"No {typeof(T).Name} found with the id {id}");
|
||||
return ret;
|
||||
@ -270,7 +270,7 @@ namespace Kyoo.Core.Controllers
|
||||
/// <inheritdoc />
|
||||
public virtual Task<T> GetOrDefault(int id)
|
||||
{
|
||||
return Database.Set<T>().FirstOrDefaultAsync(x => x.ID == id);
|
||||
return Database.Set<T>().FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -394,7 +394,7 @@ namespace Kyoo.Core.Controllers
|
||||
Database.ChangeTracker.LazyLoadingEnabled = false;
|
||||
try
|
||||
{
|
||||
T old = await GetWithTracking(edited.ID);
|
||||
T old = await GetWithTracking(edited.Id);
|
||||
|
||||
if (resetOld)
|
||||
old = Merger.Nullify(old);
|
||||
|
@ -95,7 +95,7 @@ namespace Kyoo.Core.Controllers
|
||||
if (resource.Studio != null)
|
||||
{
|
||||
resource.Studio = await _studios.CreateIfNotExists(resource.Studio);
|
||||
resource.StudioID = resource.Studio.ID;
|
||||
resource.StudioID = resource.Studio.Id;
|
||||
}
|
||||
|
||||
if (resource.People != null)
|
||||
@ -104,7 +104,7 @@ namespace Kyoo.Core.Controllers
|
||||
{
|
||||
role.People = _database.LocalEntity<People>(role.People.Slug)
|
||||
?? await _people.CreateIfNotExists(role.People);
|
||||
role.PeopleID = role.People.ID;
|
||||
role.PeopleID = role.People.Id;
|
||||
_database.Entry(role).State = EntityState.Added;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace Kyoo.Core.Controllers
|
||||
{
|
||||
role.Show = _database.LocalEntity<Show>(role.Show.Slug)
|
||||
?? await _shows.Value.CreateIfNotExists(role.Show);
|
||||
role.ShowID = role.Show.ID;
|
||||
role.ShowID = role.Show.Id;
|
||||
_database.Entry(role).State = EntityState.Added;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace Kyoo.Core.Controllers
|
||||
// Edit seasons slugs when the show's slug changes.
|
||||
shows.OnEdited += (show) =>
|
||||
{
|
||||
List<Season> seasons = _database.Seasons.AsTracking().Where(x => x.ShowID == show.ID).ToList();
|
||||
List<Season> seasons = _database.Seasons.AsTracking().Where(x => x.ShowID == show.Id).ToList();
|
||||
foreach (Season season in seasons)
|
||||
{
|
||||
season.ShowSlug = show.Slug;
|
||||
@ -112,7 +112,7 @@ namespace Kyoo.Core.Controllers
|
||||
public override async Task<Season> Create(Season obj)
|
||||
{
|
||||
await base.Create(obj);
|
||||
obj.ShowSlug = _database.Shows.First(x => x.ID == obj.ShowID).Slug;
|
||||
obj.ShowSlug = _database.Shows.First(x => x.Id == obj.ShowID).Slug;
|
||||
_database.Entry(obj).State = EntityState.Added;
|
||||
await _database.SaveChangesAsync(() => Get(obj.ShowID, obj.SeasonNumber));
|
||||
OnResourceCreated(obj);
|
||||
@ -130,7 +130,7 @@ namespace Kyoo.Core.Controllers
|
||||
throw new ArgumentException($"Can't store a season not related to any show " +
|
||||
$"(showID: {resource.ShowID}).");
|
||||
}
|
||||
resource.ShowID = resource.Show.ID;
|
||||
resource.ShowID = resource.Show.Id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace Kyoo.Core.Controllers
|
||||
if (resource.Studio != null)
|
||||
{
|
||||
resource.Studio = await _studios.CreateIfNotExists(resource.Studio);
|
||||
resource.StudioID = resource.Studio.ID;
|
||||
resource.StudioID = resource.Studio.Id;
|
||||
}
|
||||
|
||||
if (resource.People != null)
|
||||
@ -106,7 +106,7 @@ namespace Kyoo.Core.Controllers
|
||||
{
|
||||
role.People = _database.LocalEntity<People>(role.People.Slug)
|
||||
?? await _people.CreateIfNotExists(role.People);
|
||||
role.PeopleID = role.People.ID;
|
||||
role.PeopleID = role.People.Id;
|
||||
_database.Entry(role).State = EntityState.Added;
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace Kyoo.Core.Controllers
|
||||
/// <inheritdoc />
|
||||
public Task<string> GetSlug(int showID)
|
||||
{
|
||||
return _database.Shows.Where(x => x.ID == showID)
|
||||
return _database.Shows.Where(x => x.Id == showID)
|
||||
.Select(x => x.Slug)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
@ -161,11 +161,11 @@ namespace Kyoo.Core.Api
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<T>> Edit([FromBody] T resource)
|
||||
{
|
||||
if (resource.ID > 0)
|
||||
if (resource.Id > 0)
|
||||
return await Repository.Edit(resource, true);
|
||||
|
||||
T old = await Repository.Get(resource.Slug);
|
||||
resource.ID = old.ID;
|
||||
resource.Id = old.Id;
|
||||
return await Repository.Edit(resource, true);
|
||||
}
|
||||
|
||||
@ -187,11 +187,11 @@ namespace Kyoo.Core.Api
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<T>> Patch([FromBody] T resource)
|
||||
{
|
||||
if (resource.ID > 0)
|
||||
if (resource.Id > 0)
|
||||
return await Repository.Edit(resource, false);
|
||||
|
||||
T old = await Repository.Get(resource.Slug);
|
||||
resource.ID = old.ID;
|
||||
resource.Id = old.Id;
|
||||
return await Repository.Edit(resource, false);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace Kyoo.Postgresql
|
||||
public IQueryable<BagItem> LibraryItems =>
|
||||
Shows.Select(x => new BagItem
|
||||
{
|
||||
ID = x.ID,
|
||||
Id = x.Id,
|
||||
Slug = x.Slug,
|
||||
Name = x.Name,
|
||||
AirDate = x.StartAir,
|
||||
@ -103,7 +103,7 @@ namespace Kyoo.Postgresql
|
||||
Rest = x
|
||||
}).Union(Movies.Select(x => new BagItem
|
||||
{
|
||||
ID = x.ID,
|
||||
Id = x.Id,
|
||||
Slug = x.Slug,
|
||||
Name = x.Name,
|
||||
AirDate = x.AirDate,
|
||||
@ -111,7 +111,7 @@ namespace Kyoo.Postgresql
|
||||
Rest = x
|
||||
})).Union(Collections.Select(x => new BagItem
|
||||
{
|
||||
ID = x.ID,
|
||||
Id = x.Id,
|
||||
Slug = x.Slug,
|
||||
Name = x.Name,
|
||||
AirDate = null,
|
||||
@ -199,7 +199,7 @@ namespace Kyoo.Postgresql
|
||||
.Property(x => x.ExternalId)
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, (JsonSerializerOptions)null),
|
||||
v => JsonSerializer.Deserialize<Dictionary<string, MetadataID>>(v, (JsonSerializerOptions)null)
|
||||
v => JsonSerializer.Deserialize<Dictionary<string, MetadataId>>(v, (JsonSerializerOptions)null)
|
||||
)
|
||||
.HasColumnType("json");
|
||||
}
|
||||
@ -350,7 +350,7 @@ namespace Kyoo.Postgresql
|
||||
public T GetTemporaryObject<T>(T model)
|
||||
where T : class, IResource
|
||||
{
|
||||
T tmp = Set<T>().Local.FirstOrDefault(x => x.ID == model.ID);
|
||||
T tmp = Set<T>().Local.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (tmp != null)
|
||||
return tmp;
|
||||
Entry(model).State = EntityState.Unchanged;
|
||||
|
@ -13,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
[DbContext(typeof(PostgresContext))]
|
||||
[Migration("20230805051120_initial")]
|
||||
[Migration("20230805052627_initial")]
|
||||
partial class initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -30,18 +30,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("CollectionMovie", b =>
|
||||
{
|
||||
b.Property<int>("CollectionsID")
|
||||
b.Property<int>("CollectionsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("collections_id");
|
||||
|
||||
b.Property<int>("MoviesID")
|
||||
b.Property<int>("MoviesId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("movies_id");
|
||||
|
||||
b.HasKey("CollectionsID", "MoviesID")
|
||||
b.HasKey("CollectionsId", "MoviesId")
|
||||
.HasName("pk_collection_movie");
|
||||
|
||||
b.HasIndex("MoviesID")
|
||||
b.HasIndex("MoviesId")
|
||||
.HasDatabaseName("ix_collection_movie_movies_id");
|
||||
|
||||
b.ToTable("collection_movie", (string)null);
|
||||
@ -49,12 +49,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Collection", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.IsRequired()
|
||||
@ -76,7 +76,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_collections");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -88,12 +88,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Episode", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AbsoluteNumber")
|
||||
.HasColumnType("integer")
|
||||
@ -143,7 +143,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_episodes");
|
||||
|
||||
b.HasIndex("SeasonID")
|
||||
@ -162,12 +162,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Movie", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("AirDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
@ -229,7 +229,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("trailer");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_movies");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -244,12 +244,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.People", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.IsRequired()
|
||||
@ -267,7 +267,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_people");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -279,12 +279,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.PeopleRole", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("MovieID")
|
||||
.HasColumnType("integer")
|
||||
@ -308,7 +308,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_people_roles");
|
||||
|
||||
b.HasIndex("MovieID")
|
||||
@ -325,12 +325,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Season", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("EndDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
@ -367,7 +367,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_seasons");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -383,12 +383,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Show", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string[]>("Aliases")
|
||||
.IsRequired()
|
||||
@ -449,7 +449,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("trailer");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_shows");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -464,12 +464,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Studio", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.IsRequired()
|
||||
@ -487,7 +487,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_studios");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -499,12 +499,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
@ -532,7 +532,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -567,18 +567,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("ShowUser", b =>
|
||||
{
|
||||
b.Property<int>("UsersID")
|
||||
b.Property<int>("UsersId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("users_id");
|
||||
|
||||
b.Property<int>("WatchedID")
|
||||
b.Property<int>("WatchedId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("watched_id");
|
||||
|
||||
b.HasKey("UsersID", "WatchedID")
|
||||
b.HasKey("UsersId", "WatchedId")
|
||||
.HasName("pk_link_user_show");
|
||||
|
||||
b.HasIndex("WatchedID")
|
||||
b.HasIndex("WatchedId")
|
||||
.HasDatabaseName("ix_link_user_show_watched_id");
|
||||
|
||||
b.ToTable("link_user_show", (string)null);
|
||||
@ -607,14 +607,14 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.HasOne("Kyoo.Abstractions.Models.Collection", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionsID")
|
||||
.HasForeignKey("CollectionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_collection_movie_collections_collections_id");
|
||||
|
||||
b.HasOne("Kyoo.Abstractions.Models.Movie", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("MoviesID")
|
||||
.HasForeignKey("MoviesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_collection_movie_movies_movies_id");
|
||||
@ -624,7 +624,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("CollectionID")
|
||||
b1.Property<int>("CollectionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -639,18 +639,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("CollectionID");
|
||||
b1.HasKey("CollectionId");
|
||||
|
||||
b1.ToTable("collections");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CollectionID")
|
||||
.HasForeignKey("CollectionId")
|
||||
.HasConstraintName("fk_collections_collections_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("CollectionID")
|
||||
b1.Property<int>("CollectionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -665,18 +665,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("CollectionID");
|
||||
b1.HasKey("CollectionId");
|
||||
|
||||
b1.ToTable("collections");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CollectionID")
|
||||
.HasForeignKey("CollectionId")
|
||||
.HasConstraintName("fk_collections_collections_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("CollectionID")
|
||||
b1.Property<int>("CollectionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -691,12 +691,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("CollectionID");
|
||||
b1.HasKey("CollectionId");
|
||||
|
||||
b1.ToTable("collections");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CollectionID")
|
||||
.HasForeignKey("CollectionId")
|
||||
.HasConstraintName("fk_collections_collections_id");
|
||||
});
|
||||
|
||||
@ -724,7 +724,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("EpisodeID")
|
||||
b1.Property<int>("EpisodeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -739,18 +739,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("EpisodeID");
|
||||
b1.HasKey("EpisodeId");
|
||||
|
||||
b1.ToTable("episodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("EpisodeID")
|
||||
.HasForeignKey("EpisodeId")
|
||||
.HasConstraintName("fk_episodes_episodes_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("EpisodeID")
|
||||
b1.Property<int>("EpisodeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -765,18 +765,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("EpisodeID");
|
||||
b1.HasKey("EpisodeId");
|
||||
|
||||
b1.ToTable("episodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("EpisodeID")
|
||||
.HasForeignKey("EpisodeId")
|
||||
.HasConstraintName("fk_episodes_episodes_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("EpisodeID")
|
||||
b1.Property<int>("EpisodeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -791,12 +791,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("EpisodeID");
|
||||
b1.HasKey("EpisodeId");
|
||||
|
||||
b1.ToTable("episodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("EpisodeID")
|
||||
.HasForeignKey("EpisodeId")
|
||||
.HasConstraintName("fk_episodes_episodes_id");
|
||||
});
|
||||
|
||||
@ -821,7 +821,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("MovieID")
|
||||
b1.Property<int>("MovieId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -836,18 +836,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("MovieID");
|
||||
b1.HasKey("MovieId");
|
||||
|
||||
b1.ToTable("movies");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("MovieID")
|
||||
.HasForeignKey("MovieId")
|
||||
.HasConstraintName("fk_movies_movies_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("MovieID")
|
||||
b1.Property<int>("MovieId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -862,18 +862,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("MovieID");
|
||||
b1.HasKey("MovieId");
|
||||
|
||||
b1.ToTable("movies");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("MovieID")
|
||||
.HasForeignKey("MovieId")
|
||||
.HasConstraintName("fk_movies_movies_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("MovieID")
|
||||
b1.Property<int>("MovieId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -888,12 +888,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("MovieID");
|
||||
b1.HasKey("MovieId");
|
||||
|
||||
b1.ToTable("movies");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("MovieID")
|
||||
.HasForeignKey("MovieId")
|
||||
.HasConstraintName("fk_movies_movies_id");
|
||||
});
|
||||
|
||||
@ -910,7 +910,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("PeopleID")
|
||||
b1.Property<int>("PeopleId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -925,18 +925,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("PeopleID");
|
||||
b1.HasKey("PeopleId");
|
||||
|
||||
b1.ToTable("people");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PeopleID")
|
||||
.HasForeignKey("PeopleId")
|
||||
.HasConstraintName("fk_people_people_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("PeopleID")
|
||||
b1.Property<int>("PeopleId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -951,18 +951,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("PeopleID");
|
||||
b1.HasKey("PeopleId");
|
||||
|
||||
b1.ToTable("people");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PeopleID")
|
||||
.HasForeignKey("PeopleId")
|
||||
.HasConstraintName("fk_people_people_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("PeopleID")
|
||||
b1.Property<int>("PeopleId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -977,12 +977,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("PeopleID");
|
||||
b1.HasKey("PeopleId");
|
||||
|
||||
b1.ToTable("people");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PeopleID")
|
||||
.HasForeignKey("PeopleId")
|
||||
.HasConstraintName("fk_people_people_id");
|
||||
});
|
||||
|
||||
@ -1030,7 +1030,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("SeasonID")
|
||||
b1.Property<int>("SeasonId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1045,18 +1045,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("SeasonID");
|
||||
b1.HasKey("SeasonId");
|
||||
|
||||
b1.ToTable("seasons");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("SeasonID")
|
||||
.HasForeignKey("SeasonId")
|
||||
.HasConstraintName("fk_seasons_seasons_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("SeasonID")
|
||||
b1.Property<int>("SeasonId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1071,18 +1071,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("SeasonID");
|
||||
b1.HasKey("SeasonId");
|
||||
|
||||
b1.ToTable("seasons");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("SeasonID")
|
||||
.HasForeignKey("SeasonId")
|
||||
.HasConstraintName("fk_seasons_seasons_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("SeasonID")
|
||||
b1.Property<int>("SeasonId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1097,12 +1097,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("SeasonID");
|
||||
b1.HasKey("SeasonId");
|
||||
|
||||
b1.ToTable("seasons");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("SeasonID")
|
||||
.HasForeignKey("SeasonId")
|
||||
.HasConstraintName("fk_seasons_seasons_id");
|
||||
});
|
||||
|
||||
@ -1125,7 +1125,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("ShowID")
|
||||
b1.Property<int>("ShowId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1140,18 +1140,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("ShowID");
|
||||
b1.HasKey("ShowId");
|
||||
|
||||
b1.ToTable("shows");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ShowID")
|
||||
.HasForeignKey("ShowId")
|
||||
.HasConstraintName("fk_shows_shows_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("ShowID")
|
||||
b1.Property<int>("ShowId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1166,18 +1166,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("ShowID");
|
||||
b1.HasKey("ShowId");
|
||||
|
||||
b1.ToTable("shows");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ShowID")
|
||||
.HasForeignKey("ShowId")
|
||||
.HasConstraintName("fk_shows_shows_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("ShowID")
|
||||
b1.Property<int>("ShowId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1192,12 +1192,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("ShowID");
|
||||
b1.HasKey("ShowId");
|
||||
|
||||
b1.ToTable("shows");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ShowID")
|
||||
.HasForeignKey("ShowId")
|
||||
.HasConstraintName("fk_shows_shows_id");
|
||||
});
|
||||
|
||||
@ -1214,7 +1214,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("UserID")
|
||||
b1.Property<int>("UserId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1229,12 +1229,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("UserID");
|
||||
b1.HasKey("UserId");
|
||||
|
||||
b1.ToTable("users");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("UserID")
|
||||
.HasForeignKey("UserId")
|
||||
.HasConstraintName("fk_users_users_id");
|
||||
});
|
||||
|
||||
@ -1264,14 +1264,14 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.HasOne("Kyoo.Abstractions.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UsersID")
|
||||
.HasForeignKey("UsersId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_link_user_show_users_users_id");
|
||||
|
||||
b.HasOne("Kyoo.Abstractions.Models.Show", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WatchedID")
|
||||
.HasForeignKey("WatchedId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_link_user_show_shows_watched_id");
|
@ -27,18 +27,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("CollectionMovie", b =>
|
||||
{
|
||||
b.Property<int>("CollectionsID")
|
||||
b.Property<int>("CollectionsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("collections_id");
|
||||
|
||||
b.Property<int>("MoviesID")
|
||||
b.Property<int>("MoviesId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("movies_id");
|
||||
|
||||
b.HasKey("CollectionsID", "MoviesID")
|
||||
b.HasKey("CollectionsId", "MoviesId")
|
||||
.HasName("pk_collection_movie");
|
||||
|
||||
b.HasIndex("MoviesID")
|
||||
b.HasIndex("MoviesId")
|
||||
.HasDatabaseName("ix_collection_movie_movies_id");
|
||||
|
||||
b.ToTable("collection_movie", (string)null);
|
||||
@ -46,12 +46,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Collection", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.IsRequired()
|
||||
@ -73,7 +73,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_collections");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -85,12 +85,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Episode", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AbsoluteNumber")
|
||||
.HasColumnType("integer")
|
||||
@ -140,7 +140,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_episodes");
|
||||
|
||||
b.HasIndex("SeasonID")
|
||||
@ -159,12 +159,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Movie", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("AirDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
@ -226,7 +226,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("trailer");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_movies");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -241,12 +241,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.People", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.IsRequired()
|
||||
@ -264,7 +264,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_people");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -276,12 +276,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.PeopleRole", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("MovieID")
|
||||
.HasColumnType("integer")
|
||||
@ -305,7 +305,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_people_roles");
|
||||
|
||||
b.HasIndex("MovieID")
|
||||
@ -322,12 +322,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Season", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("EndDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
@ -364,7 +364,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_seasons");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -380,12 +380,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Show", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string[]>("Aliases")
|
||||
.IsRequired()
|
||||
@ -446,7 +446,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("trailer");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_shows");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -461,12 +461,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.Studio", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.IsRequired()
|
||||
@ -484,7 +484,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("slug");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_studios");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -496,12 +496,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("Kyoo.Abstractions.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
@ -529,7 +529,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("ID")
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
@ -564,18 +564,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
modelBuilder.Entity("ShowUser", b =>
|
||||
{
|
||||
b.Property<int>("UsersID")
|
||||
b.Property<int>("UsersId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("users_id");
|
||||
|
||||
b.Property<int>("WatchedID")
|
||||
b.Property<int>("WatchedId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("watched_id");
|
||||
|
||||
b.HasKey("UsersID", "WatchedID")
|
||||
b.HasKey("UsersId", "WatchedId")
|
||||
.HasName("pk_link_user_show");
|
||||
|
||||
b.HasIndex("WatchedID")
|
||||
b.HasIndex("WatchedId")
|
||||
.HasDatabaseName("ix_link_user_show_watched_id");
|
||||
|
||||
b.ToTable("link_user_show", (string)null);
|
||||
@ -604,14 +604,14 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.HasOne("Kyoo.Abstractions.Models.Collection", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionsID")
|
||||
.HasForeignKey("CollectionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_collection_movie_collections_collections_id");
|
||||
|
||||
b.HasOne("Kyoo.Abstractions.Models.Movie", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("MoviesID")
|
||||
.HasForeignKey("MoviesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_collection_movie_movies_movies_id");
|
||||
@ -621,7 +621,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("CollectionID")
|
||||
b1.Property<int>("CollectionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -636,18 +636,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("CollectionID");
|
||||
b1.HasKey("CollectionId");
|
||||
|
||||
b1.ToTable("collections");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CollectionID")
|
||||
.HasForeignKey("CollectionId")
|
||||
.HasConstraintName("fk_collections_collections_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("CollectionID")
|
||||
b1.Property<int>("CollectionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -662,18 +662,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("CollectionID");
|
||||
b1.HasKey("CollectionId");
|
||||
|
||||
b1.ToTable("collections");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CollectionID")
|
||||
.HasForeignKey("CollectionId")
|
||||
.HasConstraintName("fk_collections_collections_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("CollectionID")
|
||||
b1.Property<int>("CollectionId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -688,12 +688,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("CollectionID");
|
||||
b1.HasKey("CollectionId");
|
||||
|
||||
b1.ToTable("collections");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CollectionID")
|
||||
.HasForeignKey("CollectionId")
|
||||
.HasConstraintName("fk_collections_collections_id");
|
||||
});
|
||||
|
||||
@ -721,7 +721,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("EpisodeID")
|
||||
b1.Property<int>("EpisodeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -736,18 +736,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("EpisodeID");
|
||||
b1.HasKey("EpisodeId");
|
||||
|
||||
b1.ToTable("episodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("EpisodeID")
|
||||
.HasForeignKey("EpisodeId")
|
||||
.HasConstraintName("fk_episodes_episodes_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("EpisodeID")
|
||||
b1.Property<int>("EpisodeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -762,18 +762,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("EpisodeID");
|
||||
b1.HasKey("EpisodeId");
|
||||
|
||||
b1.ToTable("episodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("EpisodeID")
|
||||
.HasForeignKey("EpisodeId")
|
||||
.HasConstraintName("fk_episodes_episodes_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("EpisodeID")
|
||||
b1.Property<int>("EpisodeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -788,12 +788,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("EpisodeID");
|
||||
b1.HasKey("EpisodeId");
|
||||
|
||||
b1.ToTable("episodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("EpisodeID")
|
||||
.HasForeignKey("EpisodeId")
|
||||
.HasConstraintName("fk_episodes_episodes_id");
|
||||
});
|
||||
|
||||
@ -818,7 +818,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("MovieID")
|
||||
b1.Property<int>("MovieId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -833,18 +833,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("MovieID");
|
||||
b1.HasKey("MovieId");
|
||||
|
||||
b1.ToTable("movies");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("MovieID")
|
||||
.HasForeignKey("MovieId")
|
||||
.HasConstraintName("fk_movies_movies_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("MovieID")
|
||||
b1.Property<int>("MovieId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -859,18 +859,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("MovieID");
|
||||
b1.HasKey("MovieId");
|
||||
|
||||
b1.ToTable("movies");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("MovieID")
|
||||
.HasForeignKey("MovieId")
|
||||
.HasConstraintName("fk_movies_movies_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("MovieID")
|
||||
b1.Property<int>("MovieId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -885,12 +885,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("MovieID");
|
||||
b1.HasKey("MovieId");
|
||||
|
||||
b1.ToTable("movies");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("MovieID")
|
||||
.HasForeignKey("MovieId")
|
||||
.HasConstraintName("fk_movies_movies_id");
|
||||
});
|
||||
|
||||
@ -907,7 +907,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("PeopleID")
|
||||
b1.Property<int>("PeopleId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -922,18 +922,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("PeopleID");
|
||||
b1.HasKey("PeopleId");
|
||||
|
||||
b1.ToTable("people");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PeopleID")
|
||||
.HasForeignKey("PeopleId")
|
||||
.HasConstraintName("fk_people_people_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("PeopleID")
|
||||
b1.Property<int>("PeopleId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -948,18 +948,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("PeopleID");
|
||||
b1.HasKey("PeopleId");
|
||||
|
||||
b1.ToTable("people");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PeopleID")
|
||||
.HasForeignKey("PeopleId")
|
||||
.HasConstraintName("fk_people_people_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("PeopleID")
|
||||
b1.Property<int>("PeopleId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -974,12 +974,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("PeopleID");
|
||||
b1.HasKey("PeopleId");
|
||||
|
||||
b1.ToTable("people");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("PeopleID")
|
||||
.HasForeignKey("PeopleId")
|
||||
.HasConstraintName("fk_people_people_id");
|
||||
});
|
||||
|
||||
@ -1027,7 +1027,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("SeasonID")
|
||||
b1.Property<int>("SeasonId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1042,18 +1042,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("SeasonID");
|
||||
b1.HasKey("SeasonId");
|
||||
|
||||
b1.ToTable("seasons");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("SeasonID")
|
||||
.HasForeignKey("SeasonId")
|
||||
.HasConstraintName("fk_seasons_seasons_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("SeasonID")
|
||||
b1.Property<int>("SeasonId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1068,18 +1068,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("SeasonID");
|
||||
b1.HasKey("SeasonId");
|
||||
|
||||
b1.ToTable("seasons");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("SeasonID")
|
||||
.HasForeignKey("SeasonId")
|
||||
.HasConstraintName("fk_seasons_seasons_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("SeasonID")
|
||||
b1.Property<int>("SeasonId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1094,12 +1094,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("SeasonID");
|
||||
b1.HasKey("SeasonId");
|
||||
|
||||
b1.ToTable("seasons");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("SeasonID")
|
||||
.HasForeignKey("SeasonId")
|
||||
.HasConstraintName("fk_seasons_seasons_id");
|
||||
});
|
||||
|
||||
@ -1122,7 +1122,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("ShowID")
|
||||
b1.Property<int>("ShowId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1137,18 +1137,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("ShowID");
|
||||
b1.HasKey("ShowId");
|
||||
|
||||
b1.ToTable("shows");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ShowID")
|
||||
.HasForeignKey("ShowId")
|
||||
.HasConstraintName("fk_shows_shows_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
|
||||
{
|
||||
b1.Property<int>("ShowID")
|
||||
b1.Property<int>("ShowId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1163,18 +1163,18 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("poster_source");
|
||||
|
||||
b1.HasKey("ShowID");
|
||||
b1.HasKey("ShowId");
|
||||
|
||||
b1.ToTable("shows");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ShowID")
|
||||
.HasForeignKey("ShowId")
|
||||
.HasConstraintName("fk_shows_shows_id");
|
||||
});
|
||||
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
|
||||
{
|
||||
b1.Property<int>("ShowID")
|
||||
b1.Property<int>("ShowId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1189,12 +1189,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("thumbnail_source");
|
||||
|
||||
b1.HasKey("ShowID");
|
||||
b1.HasKey("ShowId");
|
||||
|
||||
b1.ToTable("shows");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ShowID")
|
||||
.HasForeignKey("ShowId")
|
||||
.HasConstraintName("fk_shows_shows_id");
|
||||
});
|
||||
|
||||
@ -1211,7 +1211,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
|
||||
{
|
||||
b1.Property<int>("UserID")
|
||||
b1.Property<int>("UserId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
@ -1226,12 +1226,12 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logo_source");
|
||||
|
||||
b1.HasKey("UserID");
|
||||
b1.HasKey("UserId");
|
||||
|
||||
b1.ToTable("users");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("UserID")
|
||||
.HasForeignKey("UserId")
|
||||
.HasConstraintName("fk_users_users_id");
|
||||
});
|
||||
|
||||
@ -1261,14 +1261,14 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
b.HasOne("Kyoo.Abstractions.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UsersID")
|
||||
.HasForeignKey("UsersId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_link_user_show_users_users_id");
|
||||
|
||||
b.HasOne("Kyoo.Abstractions.Models.Show", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("WatchedID")
|
||||
.HasForeignKey("WatchedId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_link_user_show_shows_watched_id");
|
||||
|
@ -63,7 +63,7 @@ namespace Kyoo.Tests.Database
|
||||
[Fact]
|
||||
public async Task GetByIdTest()
|
||||
{
|
||||
T value = await _repository.Get(TestSample.Get<T>().ID);
|
||||
T value = await _repository.Get(TestSample.Get<T>().Id);
|
||||
KAssert.DeepEqual(TestSample.Get<T>(), value);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ namespace Kyoo.Tests.Database
|
||||
[Fact]
|
||||
public async Task DeleteByIdTest()
|
||||
{
|
||||
await _repository.Delete(TestSample.Get<T>().ID);
|
||||
await _repository.Delete(TestSample.Get<T>().Id);
|
||||
Assert.Equal(0, await _repository.GetCount());
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ namespace Kyoo.Tests.Database
|
||||
await _repository.Delete(TestSample.Get<T>());
|
||||
|
||||
T expected = TestSample.Get<T>();
|
||||
expected.ID = 0;
|
||||
expected.Id = 0;
|
||||
await _repository.Create(expected);
|
||||
KAssert.DeepEqual(expected, await _repository.Get(expected.Slug));
|
||||
}
|
||||
@ -149,13 +149,13 @@ namespace Kyoo.Tests.Database
|
||||
[Fact]
|
||||
public async Task EditNonExistingTest()
|
||||
{
|
||||
await Assert.ThrowsAsync<ItemNotFoundException>(() => _repository.Edit(new T { ID = 56 }, false));
|
||||
await Assert.ThrowsAsync<ItemNotFoundException>(() => _repository.Edit(new T { Id = 56 }, false));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetExpressionIDTest()
|
||||
{
|
||||
KAssert.DeepEqual(TestSample.Get<T>(), await _repository.Get(x => x.ID == TestSample.Get<T>().ID));
|
||||
KAssert.DeepEqual(TestSample.Get<T>(), await _repository.Get(x => x.Id == TestSample.Get<T>().Id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -80,17 +80,17 @@ namespace Kyoo.Tests.Database
|
||||
Collection collection = TestSample.GetNew<Collection>();
|
||||
collection.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "new-provider-link",
|
||||
DataID = "new-id"
|
||||
DataId = "new-id"
|
||||
}
|
||||
};
|
||||
await _repository.Create(collection);
|
||||
@ -125,11 +125,11 @@ namespace Kyoo.Tests.Database
|
||||
Collection value = await _repository.Get(TestSample.Get<Collection>().Slug);
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -147,13 +147,13 @@ namespace Kyoo.Tests.Database
|
||||
public async Task AddMetadataTest()
|
||||
{
|
||||
Collection value = await _repository.Get(TestSample.Get<Collection>().Slug);
|
||||
value.ExternalId = new List<MetadataID>
|
||||
value.ExternalId = new List<MetadataId>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -168,11 +168,11 @@ namespace Kyoo.Tests.Database
|
||||
KAssert.DeepEqual(value, retrieved);
|
||||
}
|
||||
|
||||
value.ExternalId.Add(new MetadataID
|
||||
value.ExternalId.Add(new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
});
|
||||
await _repository.Edit(value, false);
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace Kyoo.Tests.Database
|
||||
Assert.Equal($"{TestSample.Get<Show>().Slug}-s1e1", episode.Slug);
|
||||
Show show = new()
|
||||
{
|
||||
ID = episode.ShowID,
|
||||
Id = episode.ShowID,
|
||||
Slug = "new-slug"
|
||||
};
|
||||
await Repositories.LibraryManager.ShowRepository.Edit(show, false);
|
||||
@ -72,7 +72,7 @@ namespace Kyoo.Tests.Database
|
||||
Assert.Equal($"{TestSample.Get<Show>().Slug}-s1e1", episode.Slug);
|
||||
episode = await _repository.Edit(new Episode
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
SeasonNumber = 2,
|
||||
ShowID = 1
|
||||
}, false);
|
||||
@ -88,7 +88,7 @@ namespace Kyoo.Tests.Database
|
||||
Assert.Equal($"{TestSample.Get<Show>().Slug}-s1e1", episode.Slug);
|
||||
episode = await _repository.Edit(new Episode
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
EpisodeNumber = 2,
|
||||
ShowID = 1
|
||||
}, false);
|
||||
@ -102,7 +102,7 @@ namespace Kyoo.Tests.Database
|
||||
{
|
||||
Episode episode = await _repository.Create(new Episode
|
||||
{
|
||||
ShowID = TestSample.Get<Show>().ID,
|
||||
ShowID = TestSample.Get<Show>().Id,
|
||||
SeasonNumber = 2,
|
||||
EpisodeNumber = 4
|
||||
});
|
||||
@ -129,7 +129,7 @@ namespace Kyoo.Tests.Database
|
||||
Episode episode = await _repository.Create(TestSample.GetAbsoluteEpisode());
|
||||
Show show = new()
|
||||
{
|
||||
ID = episode.ShowID,
|
||||
Id = episode.ShowID,
|
||||
Slug = "new-slug"
|
||||
};
|
||||
await Repositories.LibraryManager.ShowRepository.Edit(show, false);
|
||||
@ -143,7 +143,7 @@ namespace Kyoo.Tests.Database
|
||||
await _repository.Create(TestSample.GetAbsoluteEpisode());
|
||||
Episode episode = await _repository.Edit(new Episode
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
AbsoluteNumber = 56,
|
||||
ShowID = 1
|
||||
}, false);
|
||||
@ -158,7 +158,7 @@ namespace Kyoo.Tests.Database
|
||||
await _repository.Create(TestSample.GetAbsoluteEpisode());
|
||||
Episode episode = await _repository.Edit(new Episode
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
SeasonNumber = 1,
|
||||
EpisodeNumber = 2,
|
||||
ShowID = 1
|
||||
@ -195,7 +195,7 @@ namespace Kyoo.Tests.Database
|
||||
await _repository.Create(TestSample.GetMovieEpisode());
|
||||
await Repositories.LibraryManager.Edit(new Show
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
Slug = "john-wick"
|
||||
}, false);
|
||||
Episode episode = await _repository.Get(3);
|
||||
@ -208,17 +208,17 @@ namespace Kyoo.Tests.Database
|
||||
Episode value = TestSample.GetNew<Episode>();
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "new-provider-link",
|
||||
DataID = "new-id"
|
||||
DataId = "new-id"
|
||||
}
|
||||
};
|
||||
await _repository.Create(value);
|
||||
@ -253,11 +253,11 @@ namespace Kyoo.Tests.Database
|
||||
Episode value = await _repository.Get(TestSample.Get<Episode>().Slug);
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -275,13 +275,13 @@ namespace Kyoo.Tests.Database
|
||||
public async Task AddMetadataTest()
|
||||
{
|
||||
Episode value = await _repository.Get(TestSample.Get<Episode>().Slug);
|
||||
value.ExternalId = new List<MetadataID>
|
||||
value.ExternalId = new List<MetadataId>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -296,11 +296,11 @@ namespace Kyoo.Tests.Database
|
||||
KAssert.DeepEqual(value, retrieved);
|
||||
}
|
||||
|
||||
value.ExternalId.Add(new MetadataID
|
||||
value.ExternalId.Add(new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
});
|
||||
await _repository.Edit(value, false);
|
||||
|
||||
@ -342,9 +342,9 @@ namespace Kyoo.Tests.Database
|
||||
await _repository.Delete(TestSample.Get<Episode>());
|
||||
|
||||
Episode expected = TestSample.Get<Episode>();
|
||||
expected.ID = 0;
|
||||
expected.ShowID = (await Repositories.LibraryManager.ShowRepository.Create(TestSample.Get<Show>())).ID;
|
||||
expected.SeasonID = (await Repositories.LibraryManager.SeasonRepository.Create(TestSample.Get<Season>())).ID;
|
||||
expected.Id = 0;
|
||||
expected.ShowID = (await Repositories.LibraryManager.ShowRepository.Create(TestSample.Get<Show>())).Id;
|
||||
expected.SeasonID = (await Repositories.LibraryManager.SeasonRepository.Create(TestSample.Get<Season>())).Id;
|
||||
await _repository.Create(expected);
|
||||
KAssert.DeepEqual(expected, await _repository.Get(expected.Slug));
|
||||
}
|
||||
@ -355,8 +355,8 @@ namespace Kyoo.Tests.Database
|
||||
Episode expected = TestSample.Get<Episode>();
|
||||
KAssert.DeepEqual(expected, await _repository.CreateIfNotExists(TestSample.Get<Episode>()));
|
||||
await _repository.Delete(TestSample.Get<Episode>());
|
||||
expected.ShowID = (await Repositories.LibraryManager.ShowRepository.Create(TestSample.Get<Show>())).ID;
|
||||
expected.SeasonID = (await Repositories.LibraryManager.SeasonRepository.Create(TestSample.Get<Season>())).ID;
|
||||
expected.ShowID = (await Repositories.LibraryManager.ShowRepository.Create(TestSample.Get<Show>())).Id;
|
||||
expected.SeasonID = (await Repositories.LibraryManager.SeasonRepository.Create(TestSample.Get<Season>())).Id;
|
||||
KAssert.DeepEqual(expected, await _repository.CreateIfNotExists(expected));
|
||||
}
|
||||
}
|
||||
|
@ -54,17 +54,17 @@ namespace Kyoo.Tests.Database
|
||||
People value = TestSample.GetNew<People>();
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "new-provider-link",
|
||||
DataID = "new-id"
|
||||
DataId = "new-id"
|
||||
}
|
||||
};
|
||||
await _repository.Create(value);
|
||||
@ -99,11 +99,11 @@ namespace Kyoo.Tests.Database
|
||||
People value = await _repository.Get(TestSample.Get<People>().Slug);
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -121,13 +121,13 @@ namespace Kyoo.Tests.Database
|
||||
public async Task AddMetadataTest()
|
||||
{
|
||||
People value = await _repository.Get(TestSample.Get<People>().Slug);
|
||||
value.ExternalId = new List<MetadataID>
|
||||
value.ExternalId = new List<MetadataId>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -142,11 +142,11 @@ namespace Kyoo.Tests.Database
|
||||
KAssert.DeepEqual(value, retrieved);
|
||||
}
|
||||
|
||||
value.ExternalId.Add(new MetadataID
|
||||
value.ExternalId.Add(new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
});
|
||||
await _repository.Edit(value, false);
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace Kyoo.Tests.Database
|
||||
Assert.Equal("anohana-s1", season.Slug);
|
||||
Show show = new()
|
||||
{
|
||||
ID = season.ShowID,
|
||||
Id = season.ShowID,
|
||||
Slug = "new-slug"
|
||||
};
|
||||
await Repositories.LibraryManager.ShowRepository.Edit(show, false);
|
||||
@ -70,7 +70,7 @@ namespace Kyoo.Tests.Database
|
||||
Assert.Equal("anohana-s1", season.Slug);
|
||||
await _repository.Edit(new Season
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
SeasonNumber = 2,
|
||||
ShowID = 1
|
||||
}, false);
|
||||
@ -83,7 +83,7 @@ namespace Kyoo.Tests.Database
|
||||
{
|
||||
Season season = await _repository.Create(new Season
|
||||
{
|
||||
ShowID = TestSample.Get<Show>().ID,
|
||||
ShowID = TestSample.Get<Show>().Id,
|
||||
SeasonNumber = 2
|
||||
});
|
||||
Assert.Equal($"{TestSample.Get<Show>().Slug}-s2", season.Slug);
|
||||
@ -95,17 +95,17 @@ namespace Kyoo.Tests.Database
|
||||
Season season = TestSample.GetNew<Season>();
|
||||
season.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "new-provider-link",
|
||||
DataID = "new-id"
|
||||
DataId = "new-id"
|
||||
}
|
||||
};
|
||||
await _repository.Create(season);
|
||||
@ -140,11 +140,11 @@ namespace Kyoo.Tests.Database
|
||||
Season value = await _repository.Get(TestSample.Get<Season>().Slug);
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -162,13 +162,13 @@ namespace Kyoo.Tests.Database
|
||||
public async Task AddMetadataTest()
|
||||
{
|
||||
Season value = await _repository.Get(TestSample.Get<Season>().Slug);
|
||||
value.ExternalId = new List<MetadataID>
|
||||
value.ExternalId = new List<MetadataId>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
},
|
||||
};
|
||||
await _repository.Edit(value, false);
|
||||
@ -183,11 +183,11 @@ namespace Kyoo.Tests.Database
|
||||
KAssert.DeepEqual(value, retrieved);
|
||||
}
|
||||
|
||||
value.ExternalId.Add(new MetadataID
|
||||
value.ExternalId.Add(new MetadataId
|
||||
{
|
||||
Provider = TestSample.GetNew<Provider>(),
|
||||
Link = "link",
|
||||
DataID = "id"
|
||||
DataId = "id"
|
||||
});
|
||||
await _repository.Edit(value, false);
|
||||
|
||||
|
@ -159,7 +159,7 @@ namespace Kyoo.Tests.Database
|
||||
Show edited = await _repository.Edit(value, false);
|
||||
|
||||
Assert.Equal(value.Slug, edited.Slug);
|
||||
Assert.Equal(edited.People.First().ShowID, value.ID);
|
||||
Assert.Equal(edited.People.First().ShowID, value.Id);
|
||||
Assert.Equal(
|
||||
value.People.Select(x => new { x.Role, x.Slug, x.People.Name }),
|
||||
edited.People.Select(x => new { x.Role, x.Slug, x.People.Name }));
|
||||
@ -182,10 +182,10 @@ namespace Kyoo.Tests.Database
|
||||
Show value = await _repository.Get(TestSample.Get<Show>().Slug);
|
||||
value.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = new Provider("test", "test.png"),
|
||||
DataID = "1234"
|
||||
DataId = "1234"
|
||||
}
|
||||
};
|
||||
Show edited = await _repository.Edit(value, false);
|
||||
@ -213,14 +213,14 @@ namespace Kyoo.Tests.Database
|
||||
Show value = await _repository.Get(TestSample.Get<Show>().Slug);
|
||||
Show newValue = new()
|
||||
{
|
||||
ID = value.ID,
|
||||
Id = value.Id,
|
||||
Slug = "reset",
|
||||
Name = "Reset"
|
||||
};
|
||||
|
||||
Show edited = await _repository.Edit(newValue, true);
|
||||
|
||||
Assert.Equal(value.ID, edited.ID);
|
||||
Assert.Equal(value.Id, edited.Id);
|
||||
Assert.Null(edited.Overview);
|
||||
Assert.Equal("reset", edited.Slug);
|
||||
Assert.Equal("Reset", edited.Name);
|
||||
@ -235,14 +235,14 @@ namespace Kyoo.Tests.Database
|
||||
public async Task CreateWithRelationsTest()
|
||||
{
|
||||
Show expected = TestSample.Get<Show>();
|
||||
expected.ID = 0;
|
||||
expected.Id = 0;
|
||||
expected.Slug = "created-relation-test";
|
||||
expected.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = new Provider("provider", "provider.png"),
|
||||
DataID = "ID"
|
||||
DataId = "ID"
|
||||
}
|
||||
};
|
||||
expected.Genres = new[]
|
||||
@ -275,7 +275,7 @@ namespace Kyoo.Tests.Database
|
||||
.Include(x => x.People)
|
||||
.ThenInclude(x => x.People)
|
||||
.Include(x => x.Studio)
|
||||
.FirstAsync(x => x.ID == created.ID);
|
||||
.FirstAsync(x => x.Id == created.Id);
|
||||
retrieved.People.ForEach(x =>
|
||||
{
|
||||
x.Show = null;
|
||||
@ -298,14 +298,14 @@ namespace Kyoo.Tests.Database
|
||||
public async Task CreateWithExternalID()
|
||||
{
|
||||
Show expected = TestSample.Get<Show>();
|
||||
expected.ID = 0;
|
||||
expected.Id = 0;
|
||||
expected.Slug = "created-relation-test";
|
||||
expected.ExternalId = new[]
|
||||
{
|
||||
new MetadataID
|
||||
new MetadataId
|
||||
{
|
||||
Provider = TestSample.Get<Provider>(),
|
||||
DataID = "ID"
|
||||
DataId = "ID"
|
||||
}
|
||||
};
|
||||
Show created = await _repository.Create(expected);
|
||||
@ -314,7 +314,7 @@ namespace Kyoo.Tests.Database
|
||||
Show retrieved = await context.Shows
|
||||
.Include(x => x.ExternalId)
|
||||
.ThenInclude(x => x.Provider)
|
||||
.FirstAsync(x => x.ID == created.ID);
|
||||
.FirstAsync(x => x.Id == created.Id);
|
||||
KAssert.DeepEqual(expected, retrieved);
|
||||
Assert.Single(retrieved.ExternalId);
|
||||
Assert.Equal("ID", retrieved.ExternalId.First().DataID);
|
||||
@ -324,7 +324,7 @@ namespace Kyoo.Tests.Database
|
||||
public async Task SlugDuplicationTest()
|
||||
{
|
||||
Show test = TestSample.Get<Show>();
|
||||
test.ID = 0;
|
||||
test.Id = 0;
|
||||
test.Slug = "300";
|
||||
Show created = await _repository.Create(test);
|
||||
Assert.Equal("300!", created.Slug);
|
||||
@ -334,7 +334,7 @@ namespace Kyoo.Tests.Database
|
||||
public async Task GetSlugTest()
|
||||
{
|
||||
Show reference = TestSample.Get<Show>();
|
||||
Assert.Equal(reference.Slug, await _repository.GetSlug(reference.ID));
|
||||
Assert.Equal(reference.Slug, await _repository.GetSlug(reference.Id));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
@ -31,7 +31,7 @@ namespace Kyoo.Tests
|
||||
typeof(Collection),
|
||||
() => new Collection
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
Slug = "new-collection",
|
||||
Name = "New Collection",
|
||||
Overview = "A collection created by new sample",
|
||||
@ -45,7 +45,7 @@ namespace Kyoo.Tests
|
||||
typeof(Show),
|
||||
() => new Show
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
Slug = "new-show",
|
||||
Name = "New Show",
|
||||
Overview = "overview",
|
||||
@ -66,7 +66,7 @@ namespace Kyoo.Tests
|
||||
typeof(Season),
|
||||
() => new Season
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
ShowID = 1,
|
||||
ShowSlug = Get<Show>().Slug,
|
||||
Name = "New season",
|
||||
@ -84,7 +84,7 @@ namespace Kyoo.Tests
|
||||
typeof(Episode),
|
||||
() => new Episode
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
ShowID = 1,
|
||||
ShowSlug = Get<Show>().Slug,
|
||||
SeasonID = 1,
|
||||
@ -118,7 +118,7 @@ namespace Kyoo.Tests
|
||||
typeof(People),
|
||||
() => new People
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
Slug = "new-person-name",
|
||||
Name = "New person name",
|
||||
Images = new Dictionary<int, string>
|
||||
@ -146,7 +146,7 @@ namespace Kyoo.Tests
|
||||
typeof(Collection),
|
||||
() => new Collection
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
Slug = "collection",
|
||||
Name = "Collection",
|
||||
Overview = "A nice collection for tests",
|
||||
@ -160,7 +160,7 @@ namespace Kyoo.Tests
|
||||
typeof(Show),
|
||||
() => new Show
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
Slug = "anohana",
|
||||
Name = "Anohana: The Flower We Saw That Day",
|
||||
Aliases = new[]
|
||||
@ -190,7 +190,7 @@ namespace Kyoo.Tests
|
||||
typeof(Season),
|
||||
() => new Season
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
ShowSlug = "anohana",
|
||||
ShowID = 1,
|
||||
SeasonNumber = 1,
|
||||
@ -210,7 +210,7 @@ namespace Kyoo.Tests
|
||||
typeof(Episode),
|
||||
() => new Episode
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
ShowSlug = "anohana",
|
||||
ShowID = 1,
|
||||
SeasonID = 1,
|
||||
@ -233,7 +233,7 @@ namespace Kyoo.Tests
|
||||
typeof(People),
|
||||
() => new People
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
Slug = "the-actor",
|
||||
Name = "The Actor",
|
||||
Images = new Dictionary<int, string>
|
||||
@ -248,7 +248,7 @@ namespace Kyoo.Tests
|
||||
typeof(Studio),
|
||||
() => new Studio
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
Slug = "hyper-studio",
|
||||
Name = "Hyper studio",
|
||||
}
|
||||
@ -281,7 +281,7 @@ namespace Kyoo.Tests
|
||||
typeof(User),
|
||||
() => new User
|
||||
{
|
||||
ID = 1,
|
||||
Id = 1,
|
||||
Slug = "user",
|
||||
Username = "User",
|
||||
Email = "user@im-a-user.com",
|
||||
@ -304,22 +304,22 @@ namespace Kyoo.Tests
|
||||
public static void FillDatabase(DatabaseContext context)
|
||||
{
|
||||
Collection collection = Get<Collection>();
|
||||
collection.ID = 0;
|
||||
collection.Id = 0;
|
||||
context.Collections.Add(collection);
|
||||
|
||||
Show show = Get<Show>();
|
||||
show.ID = 0;
|
||||
show.Id = 0;
|
||||
show.StudioID = 0;
|
||||
context.Shows.Add(show);
|
||||
|
||||
Season season = Get<Season>();
|
||||
season.ID = 0;
|
||||
season.Id = 0;
|
||||
season.ShowID = 0;
|
||||
season.Show = show;
|
||||
context.Seasons.Add(season);
|
||||
|
||||
Episode episode = Get<Episode>();
|
||||
episode.ID = 0;
|
||||
episode.Id = 0;
|
||||
episode.ShowID = 0;
|
||||
episode.Show = show;
|
||||
episode.SeasonID = 0;
|
||||
@ -327,7 +327,7 @@ namespace Kyoo.Tests
|
||||
context.Episodes.Add(episode);
|
||||
|
||||
Studio studio = Get<Studio>();
|
||||
studio.ID = 0;
|
||||
studio.Id = 0;
|
||||
studio.Shows = new List<Show> { show };
|
||||
context.Studios.Add(studio);
|
||||
|
||||
@ -337,7 +337,7 @@ namespace Kyoo.Tests
|
||||
context.Genres.Add(genre);
|
||||
|
||||
People people = Get<People>();
|
||||
people.ID = 0;
|
||||
people.Id = 0;
|
||||
context.People.Add(people);
|
||||
|
||||
Library library = Get<Library>();
|
||||
@ -346,7 +346,7 @@ namespace Kyoo.Tests
|
||||
context.Libraries.Add(library);
|
||||
|
||||
User user = Get<User>();
|
||||
user.ID = 0;
|
||||
user.Id = 0;
|
||||
context.Users.Add(user);
|
||||
|
||||
context.SaveChanges();
|
||||
@ -356,7 +356,7 @@ namespace Kyoo.Tests
|
||||
{
|
||||
return new()
|
||||
{
|
||||
ID = 2,
|
||||
Id = 2,
|
||||
ShowSlug = "anohana",
|
||||
ShowID = 1,
|
||||
SeasonNumber = null,
|
||||
@ -379,7 +379,7 @@ namespace Kyoo.Tests
|
||||
{
|
||||
return new()
|
||||
{
|
||||
ID = 3,
|
||||
Id = 3,
|
||||
ShowSlug = "anohana",
|
||||
ShowID = 1,
|
||||
Path = "/home/kyoo/john-wick",
|
||||
|
@ -223,7 +223,7 @@ namespace Kyoo.Tests.Utility
|
||||
{
|
||||
Show test = new()
|
||||
{
|
||||
ID = 5,
|
||||
Id = 5,
|
||||
Genres = new[] { new Genre("test") }
|
||||
};
|
||||
Show test2 = new()
|
||||
@ -236,7 +236,7 @@ namespace Kyoo.Tests.Utility
|
||||
};
|
||||
Show ret = Merger.Merge(test, test2);
|
||||
Assert.True(ReferenceEquals(test, ret));
|
||||
Assert.Equal(5, ret.ID);
|
||||
Assert.Equal(5, ret.Id);
|
||||
|
||||
Assert.Equal(2, ret.Genres.Count);
|
||||
Assert.Equal("test", ret.Genres.ToArray()[0].Slug);
|
||||
@ -351,7 +351,7 @@ namespace Kyoo.Tests.Utility
|
||||
{
|
||||
Collection collection = new()
|
||||
{
|
||||
ID = 5,
|
||||
Id = 5,
|
||||
Name = "merged",
|
||||
};
|
||||
Collection collection2 = new()
|
||||
@ -360,7 +360,7 @@ namespace Kyoo.Tests.Utility
|
||||
};
|
||||
Collection ret = Merger.Complete(collection, collection2);
|
||||
Assert.True(ReferenceEquals(collection, ret));
|
||||
Assert.Equal(5, ret.ID);
|
||||
Assert.Equal(5, ret.Id);
|
||||
Assert.Equal("test", ret.Name);
|
||||
Assert.Null(ret.Slug);
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ namespace Kyoo.Tests.Utility
|
||||
[Fact]
|
||||
public void IsPropertyExpression_Tests()
|
||||
{
|
||||
Expression<Func<Show, int>> member = x => x.ID;
|
||||
Expression<Func<Show, object>> memberCast = x => x.ID;
|
||||
Expression<Func<Show, int>> member = x => x.Id;
|
||||
Expression<Func<Show, object>> memberCast = x => x.Id;
|
||||
|
||||
Assert.False(KUtility.IsPropertyExpression(null));
|
||||
Assert.True(KUtility.IsPropertyExpression(member));
|
||||
@ -46,8 +46,8 @@ namespace Kyoo.Tests.Utility
|
||||
[Fact]
|
||||
public void GetPropertyName_Test()
|
||||
{
|
||||
Expression<Func<Show, int>> member = x => x.ID;
|
||||
Expression<Func<Show, object>> memberCast = x => x.ID;
|
||||
Expression<Func<Show, int>> member = x => x.Id;
|
||||
Expression<Func<Show, object>> memberCast = x => x.Id;
|
||||
|
||||
Assert.Equal("ID", KUtility.GetPropertyName(member));
|
||||
Assert.Equal("ID", KUtility.GetPropertyName(memberCast));
|
||||
|
@ -89,7 +89,7 @@ class TheMovieDatabase(Provider):
|
||||
logos=[f"https://image.tmdb.org/t/p/original{company['logo_path']}"]
|
||||
if "logo_path" in company
|
||||
else [],
|
||||
external_ids={
|
||||
external_id={
|
||||
self.name: MetadataID(
|
||||
company["id"], f"https://www.themoviedb.org/company/{company['id']}"
|
||||
)
|
||||
@ -135,15 +135,24 @@ class TheMovieDatabase(Provider):
|
||||
for x in movie["genres"]
|
||||
if x["id"] in self.genre_map
|
||||
],
|
||||
external_ids={
|
||||
self.name: MetadataID(
|
||||
movie["id"], f"https://www.themoviedb.org/movie/{movie['id']}"
|
||||
),
|
||||
"imdb": MetadataID(
|
||||
movie["imdb_id"],
|
||||
f"https://www.imdb.com/title/{movie['imdb_id']}",
|
||||
),
|
||||
}
|
||||
external_id=(
|
||||
{
|
||||
self.name: MetadataID(
|
||||
movie["id"],
|
||||
f"https://www.themoviedb.org/movie/{movie['id']}",
|
||||
)
|
||||
}
|
||||
| (
|
||||
{
|
||||
"imdb": MetadataID(
|
||||
movie["imdb_id"],
|
||||
f"https://www.imdb.com/title/{movie['imdb_id']}",
|
||||
)
|
||||
}
|
||||
if movie["imdb_id"]
|
||||
else {}
|
||||
)
|
||||
)
|
||||
# TODO: Add cast information
|
||||
)
|
||||
translation = MovieTranslation(
|
||||
@ -171,7 +180,7 @@ class TheMovieDatabase(Provider):
|
||||
*,
|
||||
language: list[str],
|
||||
) -> Show:
|
||||
show_id = show.external_ids[self.name].id
|
||||
show_id = show.external_id[self.name].data_id
|
||||
if show.original_language not in language:
|
||||
language.append(show.original_language)
|
||||
|
||||
@ -206,7 +215,7 @@ class TheMovieDatabase(Provider):
|
||||
for x in show["genres"]
|
||||
if x["id"] in self.genre_map
|
||||
],
|
||||
external_ids={
|
||||
external_id={
|
||||
self.name: MetadataID(
|
||||
show["id"], f"https://www.themoviedb.org/tv/{show['id']}"
|
||||
),
|
||||
@ -271,7 +280,7 @@ class TheMovieDatabase(Provider):
|
||||
if season["air_date"]
|
||||
else None,
|
||||
end_air=None,
|
||||
external_ids={
|
||||
external_id={
|
||||
self.name: MetadataID(
|
||||
season["id"],
|
||||
f"https://www.themoviedb.org/tv/{show_id}/season/{season['season_number']}",
|
||||
@ -329,7 +338,7 @@ class TheMovieDatabase(Provider):
|
||||
show=PartialShow(
|
||||
name=search["name"],
|
||||
original_language=search["original_language"],
|
||||
external_ids={
|
||||
external_id={
|
||||
self.name: MetadataID(
|
||||
show_id, f"https://www.themoviedb.org/tv/{show_id}"
|
||||
)
|
||||
@ -345,7 +354,7 @@ class TheMovieDatabase(Provider):
|
||||
thumbnail=f"https://image.tmdb.org/t/p/original{episode['still_path']}"
|
||||
if "still_path" in episode and episode["still_path"] is not None
|
||||
else None,
|
||||
external_ids={
|
||||
external_id={
|
||||
self.name: MetadataID(
|
||||
episode["id"],
|
||||
f"https://www.themoviedb.org/tv/{show_id}/season/{episode['season_number']}/episode/{episode['episode_number']}",
|
||||
|
@ -11,7 +11,7 @@ from .metadataid import MetadataID
|
||||
class PartialShow:
|
||||
name: str
|
||||
original_language: str
|
||||
external_ids: dict[str, MetadataID]
|
||||
external_id: dict[str, MetadataID]
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -28,7 +28,7 @@ class Episode:
|
||||
absolute_number: Optional[int]
|
||||
release_date: Optional[date | int]
|
||||
thumbnail: Optional[str]
|
||||
external_ids: dict[str, MetadataID]
|
||||
external_id: dict[str, MetadataID]
|
||||
|
||||
path: Optional[str] = None
|
||||
show_id: Optional[str] = None
|
||||
|
@ -4,5 +4,5 @@ from typing import Optional
|
||||
|
||||
@dataclass
|
||||
class MetadataID:
|
||||
id: str
|
||||
data_id: str
|
||||
link: Optional[str]
|
||||
|
@ -40,7 +40,7 @@ class Movie:
|
||||
genres: list[Genre] = field(default_factory=list)
|
||||
# TODO: handle staff
|
||||
# staff: list[Staff]
|
||||
external_ids: dict[str, MetadataID] = field(default_factory=dict)
|
||||
external_id: dict[str, MetadataID] = field(default_factory=dict)
|
||||
|
||||
translations: dict[str, MovieTranslation] = field(default_factory=dict)
|
||||
|
||||
|
@ -19,7 +19,7 @@ class Season:
|
||||
season_number: int
|
||||
start_air: Optional[date | int] = None
|
||||
end_air: Optional[date | int] = None
|
||||
external_ids: dict[str, MetadataID] = field(default_factory=dict)
|
||||
external_id: dict[str, MetadataID] = field(default_factory=dict)
|
||||
|
||||
show_id: Optional[str] = None
|
||||
translations: dict[str, SeasonTranslation] = field(default_factory=dict)
|
||||
|
@ -42,7 +42,7 @@ class Show:
|
||||
seasons: list[Season]
|
||||
# TODO: handle staff
|
||||
# staff: list[Staff]
|
||||
external_ids: dict[str, MetadataID]
|
||||
external_id: dict[str, MetadataID]
|
||||
|
||||
translations: dict[str, ShowTranslation] = field(default_factory=dict)
|
||||
|
||||
|
@ -7,7 +7,7 @@ from .metadataid import MetadataID
|
||||
class Studio:
|
||||
name: str
|
||||
logos: list[str] = field(default_factory=list)
|
||||
external_ids: dict[str, MetadataID] = field(default_factory=dict)
|
||||
external_id: dict[str, MetadataID] = field(default_factory=dict)
|
||||
|
||||
def to_kyoo(self):
|
||||
return {
|
||||
|
@ -31,6 +31,7 @@ async def main():
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "-vv":
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logging.getLogger("watchfiles").setLevel(logging.WARNING)
|
||||
logging.getLogger("rebulk").setLevel(logging.WARNING)
|
||||
|
||||
jsons.set_serializer(lambda x, **_: format_date(x), Optional[date | int]) # type: ignore
|
||||
async with ClientSession(
|
||||
|
@ -130,7 +130,7 @@ class Scanner:
|
||||
return ret
|
||||
|
||||
# The parameter is only used as a key for the cache.
|
||||
provider_id = episode.show.external_ids[self.provider.name].id
|
||||
provider_id = episode.show.external_id[self.provider.name].data_id
|
||||
return await create_show(provider_id)
|
||||
|
||||
@provider_cache("seasons")
|
||||
|
Loading…
x
Reference in New Issue
Block a user