mirror of
https://github.com/sphildreth/roadie
synced 2024-11-10 06:44:12 +00:00
Formatting cleanup.
This commit is contained in:
parent
e0c2de4480
commit
6d4f918dba
4 changed files with 125 additions and 51 deletions
|
@ -499,8 +499,7 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<OperationResult<bool>> ToggleArtistFavorite(Guid artistId, ApplicationUser user,
|
protected async Task<OperationResult<bool>> ToggleArtistFavorite(Guid artistId, ApplicationUser user, bool isFavorite)
|
||||||
bool isFavorite)
|
|
||||||
{
|
{
|
||||||
var artist = DbContext.Artists
|
var artist = DbContext.Artists
|
||||||
.Include(x => x.Genres)
|
.Include(x => x.Genres)
|
||||||
|
@ -536,8 +535,7 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<OperationResult<bool>> ToggleReleaseDisliked(Guid releaseId, ApplicationUser user,
|
protected async Task<OperationResult<bool>> ToggleReleaseDisliked(Guid releaseId, ApplicationUser user, bool isDisliked)
|
||||||
bool isDisliked)
|
|
||||||
{
|
{
|
||||||
var release = DbContext.Releases
|
var release = DbContext.Releases
|
||||||
.Include(x => x.Artist)
|
.Include(x => x.Artist)
|
||||||
|
@ -547,9 +545,11 @@ namespace Roadie.Api.Services
|
||||||
.Include("Medias.Tracks")
|
.Include("Medias.Tracks")
|
||||||
.Include("Medias.Tracks.TrackArtist")
|
.Include("Medias.Tracks.TrackArtist")
|
||||||
.FirstOrDefault(x => x.RoadieId == releaseId);
|
.FirstOrDefault(x => x.RoadieId == releaseId);
|
||||||
if (release == null) return new OperationResult<bool>(true, $"Invalid Release Id [{releaseId}]");
|
if (release == null)
|
||||||
var userRelease =
|
{
|
||||||
DbContext.UserReleases.FirstOrDefault(x => x.ReleaseId == release.Id && x.UserId == user.Id);
|
return new OperationResult<bool>(true, $"Invalid Release Id [{releaseId}]");
|
||||||
|
}
|
||||||
|
var userRelease = DbContext.UserReleases.FirstOrDefault(x => x.ReleaseId == release.Id && x.UserId == user.Id);
|
||||||
if (userRelease == null)
|
if (userRelease == null)
|
||||||
{
|
{
|
||||||
userRelease = new data.UserRelease
|
userRelease = new data.UserRelease
|
||||||
|
@ -590,9 +590,11 @@ namespace Roadie.Api.Services
|
||||||
.Include("Medias.Tracks")
|
.Include("Medias.Tracks")
|
||||||
.Include("Medias.Tracks.TrackArtist")
|
.Include("Medias.Tracks.TrackArtist")
|
||||||
.FirstOrDefault(x => x.RoadieId == releaseId);
|
.FirstOrDefault(x => x.RoadieId == releaseId);
|
||||||
if (release == null) return new OperationResult<bool>(true, $"Invalid Release Id [{releaseId}]");
|
if (release == null)
|
||||||
var userRelease =
|
{
|
||||||
DbContext.UserReleases.FirstOrDefault(x => x.ReleaseId == release.Id && x.UserId == user.Id);
|
return new OperationResult<bool>(true, $"Invalid Release Id [{releaseId}]");
|
||||||
|
}
|
||||||
|
var userRelease = DbContext.UserReleases.FirstOrDefault(x => x.ReleaseId == release.Id && x.UserId == user.Id);
|
||||||
if (userRelease == null)
|
if (userRelease == null)
|
||||||
{
|
{
|
||||||
userRelease = new data.UserRelease
|
userRelease = new data.UserRelease
|
||||||
|
@ -622,8 +624,7 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<OperationResult<bool>> ToggleTrackDisliked(Guid trackId, ApplicationUser user,
|
protected async Task<OperationResult<bool>> ToggleTrackDisliked(Guid trackId, ApplicationUser user, bool isDisliked)
|
||||||
bool isDisliked)
|
|
||||||
{
|
{
|
||||||
var track = DbContext.Tracks
|
var track = DbContext.Tracks
|
||||||
.Include(x => x.ReleaseMedia)
|
.Include(x => x.ReleaseMedia)
|
||||||
|
@ -631,7 +632,10 @@ namespace Roadie.Api.Services
|
||||||
.Include(x => x.ReleaseMedia.Release.Artist)
|
.Include(x => x.ReleaseMedia.Release.Artist)
|
||||||
.Include(x => x.TrackArtist)
|
.Include(x => x.TrackArtist)
|
||||||
.FirstOrDefault(x => x.RoadieId == trackId);
|
.FirstOrDefault(x => x.RoadieId == trackId);
|
||||||
if (track == null) return new OperationResult<bool>(true, $"Invalid Track Id [{trackId}]");
|
if (track == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Track Id [{trackId}]");
|
||||||
|
}
|
||||||
var userTrack = DbContext.UserTracks.FirstOrDefault(x => x.TrackId == track.Id && x.UserId == user.Id);
|
var userTrack = DbContext.UserTracks.FirstOrDefault(x => x.TrackId == track.Id && x.UserId == user.Id);
|
||||||
if (userTrack == null)
|
if (userTrack == null)
|
||||||
{
|
{
|
||||||
|
@ -663,8 +667,7 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<OperationResult<bool>> ToggleTrackFavorite(Guid trackId, ApplicationUser user,
|
protected async Task<OperationResult<bool>> ToggleTrackFavorite(Guid trackId, ApplicationUser user, bool isFavorite)
|
||||||
bool isFavorite)
|
|
||||||
{
|
{
|
||||||
var track = DbContext.Tracks
|
var track = DbContext.Tracks
|
||||||
.Include(x => x.ReleaseMedia)
|
.Include(x => x.ReleaseMedia)
|
||||||
|
@ -672,7 +675,10 @@ namespace Roadie.Api.Services
|
||||||
.Include(x => x.ReleaseMedia.Release.Artist)
|
.Include(x => x.ReleaseMedia.Release.Artist)
|
||||||
.Include(x => x.TrackArtist)
|
.Include(x => x.TrackArtist)
|
||||||
.FirstOrDefault(x => x.RoadieId == trackId);
|
.FirstOrDefault(x => x.RoadieId == trackId);
|
||||||
if (track == null) return new OperationResult<bool>(true, $"Invalid Track Id [{trackId}]");
|
if (track == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Track Id [{trackId}]");
|
||||||
|
}
|
||||||
var userTrack = DbContext.UserTracks.FirstOrDefault(x => x.TrackId == track.Id && x.UserId == user.Id);
|
var userTrack = DbContext.UserTracks.FirstOrDefault(x => x.TrackId == track.Id && x.UserId == user.Id);
|
||||||
if (userTrack == null)
|
if (userTrack == null)
|
||||||
{
|
{
|
||||||
|
@ -697,6 +703,8 @@ namespace Roadie.Api.Services
|
||||||
CacheManager.ClearRegion(track.ReleaseMedia.Release.CacheRegion);
|
CacheManager.ClearRegion(track.ReleaseMedia.Release.CacheRegion);
|
||||||
CacheManager.ClearRegion(track.ReleaseMedia.Release.Artist.CacheRegion);
|
CacheManager.ClearRegion(track.ReleaseMedia.Release.Artist.CacheRegion);
|
||||||
|
|
||||||
|
Logger.LogDebug($"ToggleTrackFavorite: User `{ user }`, Track `{ track }`, isFavorite: [{ isFavorite }]");
|
||||||
|
|
||||||
return new OperationResult<bool>
|
return new OperationResult<bool>
|
||||||
{
|
{
|
||||||
IsSuccess = true,
|
IsSuccess = true,
|
||||||
|
|
|
@ -2340,13 +2340,13 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<subsonic.SubsonicOperationResult<bool>> ToggleArtistStar(Guid artistId, ApplicationUser user,
|
private async Task<subsonic.SubsonicOperationResult<bool>> ToggleArtistStar(Guid artistId, ApplicationUser user, bool starred)
|
||||||
bool starred)
|
|
||||||
{
|
{
|
||||||
var r = await ToggleArtistFavorite(artistId, user, starred);
|
var r = await ToggleArtistFavorite(artistId, user, starred);
|
||||||
if (r.IsNotFoundResult)
|
if (r.IsNotFoundResult)
|
||||||
return new subsonic.SubsonicOperationResult<bool>(subsonic.ErrorCodes.TheRequestedDataWasNotFound,
|
{
|
||||||
$"Invalid Artist Id [{artistId}]");
|
return new subsonic.SubsonicOperationResult<bool>(subsonic.ErrorCodes.TheRequestedDataWasNotFound, $"Invalid Artist Id [{artistId}]");
|
||||||
|
}
|
||||||
return new subsonic.SubsonicOperationResult<bool>
|
return new subsonic.SubsonicOperationResult<bool>
|
||||||
{
|
{
|
||||||
IsSuccess = r.IsSuccess,
|
IsSuccess = r.IsSuccess,
|
||||||
|
@ -2354,13 +2354,13 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<subsonic.SubsonicOperationResult<bool>> ToggleReleaseStar(Guid releaseId,
|
private async Task<subsonic.SubsonicOperationResult<bool>> ToggleReleaseStar(Guid releaseId, ApplicationUser user, bool starred)
|
||||||
ApplicationUser user, bool starred)
|
|
||||||
{
|
{
|
||||||
var r = await ToggleReleaseFavorite(releaseId, user, starred);
|
var r = await ToggleReleaseFavorite(releaseId, user, starred);
|
||||||
if (r.IsNotFoundResult)
|
if (r.IsNotFoundResult)
|
||||||
return new subsonic.SubsonicOperationResult<bool>(subsonic.ErrorCodes.TheRequestedDataWasNotFound,
|
{
|
||||||
$"Invalid Release Id [{releaseId}]");
|
return new subsonic.SubsonicOperationResult<bool>(subsonic.ErrorCodes.TheRequestedDataWasNotFound, $"Invalid Release Id [{releaseId}]");
|
||||||
|
}
|
||||||
return new subsonic.SubsonicOperationResult<bool>
|
return new subsonic.SubsonicOperationResult<bool>
|
||||||
{
|
{
|
||||||
IsSuccess = r.IsSuccess,
|
IsSuccess = r.IsSuccess,
|
||||||
|
@ -2368,13 +2368,13 @@ namespace Roadie.Api.Services
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<subsonic.SubsonicOperationResult<bool>> ToggleTrackStar(Guid trackId, ApplicationUser user,
|
private async Task<subsonic.SubsonicOperationResult<bool>> ToggleTrackStar(Guid trackId, ApplicationUser user, bool starred)
|
||||||
bool starred)
|
|
||||||
{
|
{
|
||||||
var r = await ToggleTrackFavorite(trackId, user, starred);
|
var r = await ToggleTrackFavorite(trackId, user, starred);
|
||||||
if (r.IsNotFoundResult)
|
if (r.IsNotFoundResult)
|
||||||
return new subsonic.SubsonicOperationResult<bool>(subsonic.ErrorCodes.TheRequestedDataWasNotFound,
|
{
|
||||||
$"Invalid Track Id [{trackId}]");
|
return new subsonic.SubsonicOperationResult<bool>(subsonic.ErrorCodes.TheRequestedDataWasNotFound, $"Invalid Track Id [{trackId}]");
|
||||||
|
}
|
||||||
return new subsonic.SubsonicOperationResult<bool>
|
return new subsonic.SubsonicOperationResult<bool>
|
||||||
{
|
{
|
||||||
IsSuccess = r.IsSuccess,
|
IsSuccess = r.IsSuccess,
|
||||||
|
|
|
@ -172,9 +172,15 @@ namespace Roadie.Api.Services
|
||||||
public async Task<OperationResult<bool>> SetArtistBookmark(Guid artistId, User roadieUser, bool isBookmarked)
|
public async Task<OperationResult<bool>> SetArtistBookmark(Guid artistId, User roadieUser, bool isBookmarked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
var artist = GetArtist(artistId);
|
var artist = GetArtist(artistId);
|
||||||
if (artist == null) return new OperationResult<bool>(true, $"Invalid Artist [{artistId}]");
|
if (artist == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Artist [{artistId}]");
|
||||||
|
}
|
||||||
var result = await SetBookmark(user, BookmarkType.Artist, artist.Id, isBookmarked);
|
var result = await SetBookmark(user, BookmarkType.Artist, artist.Id, isBookmarked);
|
||||||
|
|
||||||
CacheManager.ClearRegion(artist.CacheRegion);
|
CacheManager.ClearRegion(artist.CacheRegion);
|
||||||
|
@ -189,21 +195,30 @@ namespace Roadie.Api.Services
|
||||||
public async Task<OperationResult<bool>> SetArtistDisliked(Guid artistId, User roadieUser, bool isDisliked)
|
public async Task<OperationResult<bool>> SetArtistDisliked(Guid artistId, User roadieUser, bool isDisliked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await ToggleArtistDisliked(artistId, user, isDisliked);
|
return await ToggleArtistDisliked(artistId, user, isDisliked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<bool>> SetArtistFavorite(Guid artistId, User roadieUser, bool isFavorite)
|
public async Task<OperationResult<bool>> SetArtistFavorite(Guid artistId, User roadieUser, bool isFavorite)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await ToggleArtistFavorite(artistId, user, isFavorite);
|
return await ToggleArtistFavorite(artistId, user, isFavorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<short>> SetArtistRating(Guid artistId, User roadieUser, short rating)
|
public async Task<OperationResult<short>> SetArtistRating(Guid artistId, User roadieUser, short rating)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<short>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<short>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await base.SetArtistRating(artistId, user, rating);
|
return await base.SetArtistRating(artistId, user, rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +226,15 @@ namespace Roadie.Api.Services
|
||||||
bool isBookmarked)
|
bool isBookmarked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
var collection = GetCollection(collectionId);
|
var collection = GetCollection(collectionId);
|
||||||
if (collection == null) return new OperationResult<bool>(true, $"Invalid Collection [{collectionId}]");
|
if (collection == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Collection [{collectionId}]");
|
||||||
|
}
|
||||||
var result = await SetBookmark(user, BookmarkType.Collection, collection.Id, isBookmarked);
|
var result = await SetBookmark(user, BookmarkType.Collection, collection.Id, isBookmarked);
|
||||||
|
|
||||||
CacheManager.ClearRegion(collection.CacheRegion);
|
CacheManager.ClearRegion(collection.CacheRegion);
|
||||||
|
@ -228,9 +249,15 @@ namespace Roadie.Api.Services
|
||||||
public async Task<OperationResult<bool>> SetLabelBookmark(Guid labelId, User roadieUser, bool isBookmarked)
|
public async Task<OperationResult<bool>> SetLabelBookmark(Guid labelId, User roadieUser, bool isBookmarked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
var label = GetLabel(labelId);
|
var label = GetLabel(labelId);
|
||||||
if (label == null) return new OperationResult<bool>(true, $"Invalid Label [{labelId}]");
|
if (label == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Label [{labelId}]");
|
||||||
|
}
|
||||||
var result = await SetBookmark(user, BookmarkType.Label, label.Id, isBookmarked);
|
var result = await SetBookmark(user, BookmarkType.Label, label.Id, isBookmarked);
|
||||||
|
|
||||||
CacheManager.ClearRegion(label.CacheRegion);
|
CacheManager.ClearRegion(label.CacheRegion);
|
||||||
|
@ -246,9 +273,15 @@ namespace Roadie.Api.Services
|
||||||
bool isBookmarked)
|
bool isBookmarked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
var playlist = GetPlaylist(playlistId);
|
var playlist = GetPlaylist(playlistId);
|
||||||
if (playlist == null) return new OperationResult<bool>(true, $"Invalid Playlist [{playlistId}]");
|
if (playlist == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Playlist [{playlistId}]");
|
||||||
|
}
|
||||||
var result = await SetBookmark(user, BookmarkType.Playlist, playlist.Id, isBookmarked);
|
var result = await SetBookmark(user, BookmarkType.Playlist, playlist.Id, isBookmarked);
|
||||||
|
|
||||||
CacheManager.ClearRegion(playlist.CacheRegion);
|
CacheManager.ClearRegion(playlist.CacheRegion);
|
||||||
|
@ -263,9 +296,15 @@ namespace Roadie.Api.Services
|
||||||
public async Task<OperationResult<bool>> SetReleaseBookmark(Guid releaseid, User roadieUser, bool isBookmarked)
|
public async Task<OperationResult<bool>> SetReleaseBookmark(Guid releaseid, User roadieUser, bool isBookmarked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
var release = GetRelease(releaseid);
|
var release = GetRelease(releaseid);
|
||||||
if (release == null) return new OperationResult<bool>(true, $"Invalid Release [{releaseid}]");
|
if (release == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Release [{releaseid}]");
|
||||||
|
}
|
||||||
var result = await SetBookmark(user, BookmarkType.Release, release.Id, isBookmarked);
|
var result = await SetBookmark(user, BookmarkType.Release, release.Id, isBookmarked);
|
||||||
|
|
||||||
CacheManager.ClearRegion(release.CacheRegion);
|
CacheManager.ClearRegion(release.CacheRegion);
|
||||||
|
@ -280,30 +319,45 @@ namespace Roadie.Api.Services
|
||||||
public async Task<OperationResult<bool>> SetReleaseDisliked(Guid releaseId, User roadieUser, bool isDisliked)
|
public async Task<OperationResult<bool>> SetReleaseDisliked(Guid releaseId, User roadieUser, bool isDisliked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await ToggleReleaseDisliked(releaseId, user, isDisliked);
|
return await ToggleReleaseDisliked(releaseId, user, isDisliked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<bool>> SetReleaseFavorite(Guid releaseId, User roadieUser, bool isFavorite)
|
public async Task<OperationResult<bool>> SetReleaseFavorite(Guid releaseId, User roadieUser, bool isFavorite)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await ToggleReleaseFavorite(releaseId, user, isFavorite);
|
return await ToggleReleaseFavorite(releaseId, user, isFavorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<short>> SetReleaseRating(Guid releaseId, User roadieUser, short rating)
|
public async Task<OperationResult<short>> SetReleaseRating(Guid releaseId, User roadieUser, short rating)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<short>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<short>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await base.SetReleaseRating(releaseId, user, rating);
|
return await base.SetReleaseRating(releaseId, user, rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<bool>> SetTrackBookmark(Guid trackId, User roadieUser, bool isBookmarked)
|
public async Task<OperationResult<bool>> SetTrackBookmark(Guid trackId, User roadieUser, bool isBookmarked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
var track = GetTrack(trackId);
|
var track = GetTrack(trackId);
|
||||||
if (track == null) return new OperationResult<bool>(true, $"Invalid Track [{trackId}]");
|
if (track == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid Track [{trackId}]");
|
||||||
|
}
|
||||||
var result = await SetBookmark(user, BookmarkType.Track, track.Id, isBookmarked);
|
var result = await SetBookmark(user, BookmarkType.Track, track.Id, isBookmarked);
|
||||||
|
|
||||||
CacheManager.ClearRegion(track.CacheRegion);
|
CacheManager.ClearRegion(track.CacheRegion);
|
||||||
|
@ -318,14 +372,20 @@ namespace Roadie.Api.Services
|
||||||
public async Task<OperationResult<bool>> SetTrackDisliked(Guid trackId, User roadieUser, bool isDisliked)
|
public async Task<OperationResult<bool>> SetTrackDisliked(Guid trackId, User roadieUser, bool isDisliked)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await ToggleTrackDisliked(trackId, user, isDisliked);
|
return await ToggleTrackDisliked(trackId, user, isDisliked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<OperationResult<bool>> SetTrackFavorite(Guid trackId, User roadieUser, bool isFavorite)
|
public async Task<OperationResult<bool>> SetTrackFavorite(Guid trackId, User roadieUser, bool isFavorite)
|
||||||
{
|
{
|
||||||
var user = GetUser(roadieUser.UserId);
|
var user = GetUser(roadieUser.UserId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
return await ToggleTrackFavorite(trackId, user, isFavorite);
|
return await ToggleTrackFavorite(trackId, user, isFavorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +397,10 @@ namespace Roadie.Api.Services
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
timings.Add("GetUser", sw.ElapsedMilliseconds);
|
timings.Add("GetUser", sw.ElapsedMilliseconds);
|
||||||
|
|
||||||
if (user == null) return new OperationResult<short>(true, $"Invalid User [{roadieUser}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<short>(true, $"Invalid User [{roadieUser}]");
|
||||||
|
}
|
||||||
sw.Start();
|
sw.Start();
|
||||||
var result = await base.SetTrackRating(trackId, user, rating);
|
var result = await base.SetTrackRating(trackId, user, rating);
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
|
@ -353,7 +416,10 @@ namespace Roadie.Api.Services
|
||||||
string token)
|
string token)
|
||||||
{
|
{
|
||||||
var user = DbContext.Users.FirstOrDefault(x => x.RoadieId == userId);
|
var user = DbContext.Users.FirstOrDefault(x => x.RoadieId == userId);
|
||||||
if (user == null) return new OperationResult<bool>(true, $"User Not Found [{userId}]");
|
if (user == null)
|
||||||
|
{
|
||||||
|
return new OperationResult<bool>(true, $"User Not Found [{userId}]");
|
||||||
|
}
|
||||||
if (integrationName == "lastfm") return await UpdateLastFMSessionKey(user, token);
|
if (integrationName == "lastfm") return await UpdateLastFMSessionKey(user, token);
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"Name": "Console",
|
"Name": "Console",
|
||||||
"Args": {
|
"Args": {
|
||||||
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
|
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
|
||||||
"restrictedToMinimumLevel": "Information"
|
"restrictedToMinimumLevel": "Verbose"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue