#2363 Added the ability to pass any username into the API using the ApiAlias header

This commit is contained in:
tidusjar 2019-01-16 21:33:15 +00:00
commit 3b91392323
18 changed files with 1455 additions and 116 deletions

View file

@ -83,7 +83,8 @@ namespace Ombi.Core.Engine
Approved = false,
RequestedUserId = userDetails.Id,
Background = movieInfo.BackdropPath,
LangCode = model.LanguageCode
LangCode = model.LanguageCode,
RequestedByAlias = model.RequestedByAlias
};
var usDates = movieInfo.ReleaseDates?.Results?.FirstOrDefault(x => x.IsoCode == "US");

View file

@ -83,7 +83,8 @@ namespace Ombi.Core.Engine
Title = album.title,
Disk = album.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url,
Cover = album.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url,
ForeignArtistId = album?.artist?.foreignArtistId ?? string.Empty
ForeignArtistId = album?.artist?.foreignArtistId ?? string.Empty,
RequestedByAlias = model.RequestedByAlias
};
if (requestModel.Cover.IsNullOrEmpty())
{

View file

@ -72,6 +72,7 @@ namespace Ombi.Core.Helpers
SeasonRequests = new List<SeasonRequests>(),
Title = ShowInfo.name,
ReleaseYear = FirstAir,
RequestedByAlias = model.RequestedByAlias,
SeriesType = ShowInfo.genres.Any( s => s.Equals("Anime", StringComparison.InvariantCultureIgnoreCase)) ? SeriesType.Anime : SeriesType.Standard
};

View file

@ -24,11 +24,20 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Newtonsoft.Json;
namespace Ombi.Core.Models.Requests
{
public class MovieRequestViewModel
{
public int TheMovieDbId { get; set; }
public string LanguageCode { get; set; } = "en";
/// <summary>
/// This is only set from a HTTP Header
/// </summary>
[JsonIgnore]
public string RequestedByAlias { get; set; }
}
}

View file

@ -3,5 +3,6 @@
public class MusicAlbumRequestViewModel
{
public string ForeignAlbumId { get; set; }
public string RequestedByAlias { get; set; }
}
}

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Ombi.Core.Models.Requests
{
@ -9,6 +10,8 @@ namespace Ombi.Core.Models.Requests
public bool FirstSeason { get; set; }
public int TvDbId { get; set; }
public List<SeasonsViewModel> Seasons { get; set; } = new List<SeasonsViewModel>();
[JsonIgnore]
public string RequestedByAlias { get; set; }
}
public class SeasonsViewModel