mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 07:22:35 -07:00
Some work on the requests page
This commit is contained in:
parent
8043cdd527
commit
48fd182e52
8 changed files with 209 additions and 37 deletions
|
@ -1,12 +1,39 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: RequestsModule.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Humanizer;
|
||||
|
||||
using Nancy;
|
||||
using Nancy.Responses.Negotiation;
|
||||
|
||||
using RequestPlex.Api;
|
||||
using RequestPlex.Core;
|
||||
using RequestPlex.Core.SettingModels;
|
||||
using RequestPlex.Store;
|
||||
using RequestPlex.UI.Models;
|
||||
|
||||
namespace RequestPlex.UI.Modules
|
||||
{
|
||||
|
@ -36,13 +63,47 @@ namespace RequestPlex.UI.Modules
|
|||
private Response GetMovies()
|
||||
{
|
||||
var dbMovies = Service.GetAll().Where(x => x.Type == RequestType.Movie);
|
||||
return Response.AsJson(dbMovies);
|
||||
var viewModel = dbMovies.Select(tv => new RequestViewModel
|
||||
{
|
||||
Tmdbid = tv.Tmdbid,
|
||||
Type = tv.Type,
|
||||
Status = tv.Status,
|
||||
ImdbId = tv.ImdbId,
|
||||
Id = tv.Id,
|
||||
PosterPath = tv.PosterPath,
|
||||
ReleaseDate = tv.ReleaseDate.Humanize(),
|
||||
RequestedDate = tv.RequestedDate.Humanize(),
|
||||
Approved = tv.Approved,
|
||||
Title = tv.Title,
|
||||
Overview = tv.Overview,
|
||||
RequestedBy = tv.RequestedBy,
|
||||
ReleaseYear = tv.ReleaseDate.Year.ToString()
|
||||
}).ToList();
|
||||
//TODO check if Available
|
||||
return Response.AsJson(viewModel);
|
||||
}
|
||||
|
||||
private Response GetTvShows()
|
||||
{
|
||||
var dbTv = Service.GetAll().Where(x => x.Type == RequestType.TvShow);
|
||||
return Response.AsJson(dbTv);
|
||||
var viewModel = dbTv.Select(tv => new RequestViewModel
|
||||
{
|
||||
Tmdbid = tv.Tmdbid,
|
||||
Type = tv.Type,
|
||||
Status = tv.Status,
|
||||
ImdbId = tv.ImdbId,
|
||||
Id = tv.Id,
|
||||
PosterPath = tv.PosterPath,
|
||||
ReleaseDate = tv.ReleaseDate.Humanize(),
|
||||
RequestedDate = tv.RequestedDate.Humanize(),
|
||||
Approved = tv.Approved,
|
||||
Title = tv.Title,
|
||||
Overview = tv.Overview,
|
||||
RequestedBy = tv.RequestedBy,
|
||||
ReleaseYear = tv.ReleaseDate.Year.ToString()
|
||||
}).ToList();
|
||||
//TODO check if Available
|
||||
return Response.AsJson(viewModel);
|
||||
}
|
||||
|
||||
private Response Delete(int tmdbId, RequestType type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue