mirror of
https://github.com/sphildreth/roadie
synced 2024-11-10 06:44:12 +00:00
merge work
This commit is contained in:
parent
5acad5d4b6
commit
014607515a
3 changed files with 25 additions and 5 deletions
|
@ -165,7 +165,7 @@ namespace Roadie.Library.Factories
|
||||||
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
||||||
sql = "UPDATE `image` set artistId = " + artistToMergeInto.Id + " WHERE artistId = " + ArtistToMerge.Id + ";";
|
sql = "UPDATE `image` set artistId = " + artistToMergeInto.Id + " WHERE artistId = " + ArtistToMerge.Id + ";";
|
||||||
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
||||||
sql = "UPDATE `userArtist` set artistId = " + artistToMergeInto.Id + " WHERE artistId = " + ArtistToMerge.Id + ";";
|
sql = "UPDATE `userartist` set artistId = " + artistToMergeInto.Id + " WHERE artistId = " + ArtistToMerge.Id + ";";
|
||||||
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
||||||
sql = "UPDATE `track` set artistId = " + artistToMergeInto.Id + " WHERE artistId = " + ArtistToMerge.Id + ";";
|
sql = "UPDATE `track` set artistId = " + artistToMergeInto.Id + " WHERE artistId = " + ArtistToMerge.Id + ";";
|
||||||
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
await this.DbContext.Database.ExecuteSqlCommandAsync(sql);
|
||||||
|
|
|
@ -550,13 +550,19 @@ namespace Roadie.Api.Services
|
||||||
sw.Start();
|
sw.Start();
|
||||||
|
|
||||||
var errors = new List<Exception>();
|
var errors = new List<Exception>();
|
||||||
var artistToMerge = this.GetArtist(artistToMergeId);
|
var artistToMerge = this.DbContext.Artists
|
||||||
|
.Include(x => x.Genres)
|
||||||
|
.Include("Genres.Genre")
|
||||||
|
.FirstOrDefault(x => x.RoadieId == artistToMergeId);
|
||||||
if (artistToMerge == null)
|
if (artistToMerge == null)
|
||||||
{
|
{
|
||||||
this.Logger.LogWarning("MergeArtists Unknown Artist [{0}]", artistToMergeId);
|
this.Logger.LogWarning("MergeArtists Unknown Artist [{0}]", artistToMergeId);
|
||||||
return new OperationResult<bool>(true, string.Format("Artist Not Found [{0}]", artistToMergeId));
|
return new OperationResult<bool>(true, string.Format("Artist Not Found [{0}]", artistToMergeId));
|
||||||
}
|
}
|
||||||
var mergeIntoArtist = this.GetArtist(artistToMergeIntoId);
|
var mergeIntoArtist = this.DbContext.Artists
|
||||||
|
.Include(x => x.Genres)
|
||||||
|
.Include("Genres.Genre")
|
||||||
|
.FirstOrDefault(x => x.RoadieId == artistToMergeIntoId);
|
||||||
if (mergeIntoArtist == null)
|
if (mergeIntoArtist == null)
|
||||||
{
|
{
|
||||||
this.Logger.LogWarning("MergeArtists Unknown Artist [{0}]", artistToMergeIntoId);
|
this.Logger.LogWarning("MergeArtists Unknown Artist [{0}]", artistToMergeIntoId);
|
||||||
|
|
|
@ -684,13 +684,27 @@ namespace Roadie.Api.Services
|
||||||
sw.Start();
|
sw.Start();
|
||||||
|
|
||||||
var errors = new List<Exception>();
|
var errors = new List<Exception>();
|
||||||
var releaseToMerge = this.GetRelease(releaseToMergeId);
|
var releaseToMerge = this.DbContext.Releases
|
||||||
|
.Include(x => x.Artist)
|
||||||
|
.Include(x => x.Genres)
|
||||||
|
.Include("Genres.Genre")
|
||||||
|
.Include(x => x.Medias)
|
||||||
|
.Include("Medias.Tracks")
|
||||||
|
.Include("Medias.Tracks.TrackArtist")
|
||||||
|
.FirstOrDefault(x => x.RoadieId == releaseToMergeId);
|
||||||
if (releaseToMerge == null)
|
if (releaseToMerge == null)
|
||||||
{
|
{
|
||||||
this.Logger.LogWarning("MergeReleases Unknown Release [{0}]", releaseToMergeId);
|
this.Logger.LogWarning("MergeReleases Unknown Release [{0}]", releaseToMergeId);
|
||||||
return new OperationResult<bool>(true, string.Format("Release Not Found [{0}]", releaseToMergeId));
|
return new OperationResult<bool>(true, string.Format("Release Not Found [{0}]", releaseToMergeId));
|
||||||
}
|
}
|
||||||
var releaseToMergeInfo = this.GetRelease(releaseToMergeIntoId);
|
var releaseToMergeInfo = this.DbContext.Releases
|
||||||
|
.Include(x => x.Artist)
|
||||||
|
.Include(x => x.Genres)
|
||||||
|
.Include("Genres.Genre")
|
||||||
|
.Include(x => x.Medias)
|
||||||
|
.Include("Medias.Tracks")
|
||||||
|
.Include("Medias.Tracks.TrackArtist")
|
||||||
|
.FirstOrDefault(x => x.RoadieId == releaseToMergeIntoId);
|
||||||
if (releaseToMergeInfo == null)
|
if (releaseToMergeInfo == null)
|
||||||
{
|
{
|
||||||
this.Logger.LogWarning("MergeReleases Unknown Release [{0}]", releaseToMergeIntoId);
|
this.Logger.LogWarning("MergeReleases Unknown Release [{0}]", releaseToMergeIntoId);
|
||||||
|
|
Loading…
Reference in a new issue