mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 11:38:32 -07:00
parent
748fe2ca2d
commit
7c41f448a8
14 changed files with 1066 additions and 79 deletions
|
@ -26,9 +26,7 @@
|
||||||
#endregion
|
#endregion
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
|
@ -45,7 +43,6 @@ using NUnit.Framework;
|
||||||
|
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
using PlexRequests.Helpers;
|
|
||||||
using PlexRequests.Store;
|
using PlexRequests.Store;
|
||||||
using PlexRequests.Store.Repository;
|
using PlexRequests.Store.Repository;
|
||||||
using PlexRequests.UI.Models;
|
using PlexRequests.UI.Models;
|
||||||
|
@ -71,6 +68,11 @@ namespace PlexRequests.UI.Tests
|
||||||
var userRepoMock = new Mock<IRepository<UsersModel>>();
|
var userRepoMock = new Mock<IRepository<UsersModel>>();
|
||||||
var mapperMock = new Mock<ICustomUserMapper>();
|
var mapperMock = new Mock<ICustomUserMapper>();
|
||||||
var authSettingsMock = new Mock<ISettingsService<AuthenticationSettings>>();
|
var authSettingsMock = new Mock<ISettingsService<AuthenticationSettings>>();
|
||||||
|
var plexSettingsMock = new Mock<ISettingsService<PlexSettings>>();
|
||||||
|
var cpMock = new Mock<ISettingsService<CouchPotatoSettings>>();
|
||||||
|
var sonarrMock = new Mock<ISettingsService<SonarrSettings>>();
|
||||||
|
var sickRageMock = new Mock<ISettingsService<SickRageSettings>>();
|
||||||
|
var headphonesMock = new Mock<ISettingsService<HeadphonesSettings>>();
|
||||||
|
|
||||||
var userModels = fixture.CreateMany<UsersModel>().ToList();
|
var userModels = fixture.CreateMany<UsersModel>().ToList();
|
||||||
userModels.Add(new UsersModel
|
userModels.Add(new UsersModel
|
||||||
|
@ -92,6 +94,21 @@ namespace PlexRequests.UI.Tests
|
||||||
|
|
||||||
authSettingsMock.Setup(x => x.SaveSettings(It.Is<AuthenticationSettings>(c => c.PlexAuthToken.Equals("abc")))).Returns(true);
|
authSettingsMock.Setup(x => x.SaveSettings(It.Is<AuthenticationSettings>(c => c.PlexAuthToken.Equals("abc")))).Returns(true);
|
||||||
|
|
||||||
|
plexSettingsMock.Setup(x => x.GetSettings()).Returns(fixture.Create<PlexSettings>());
|
||||||
|
plexSettingsMock.Setup(x => x.SaveSettings(It.Is<PlexSettings>(c => c.Ip.Equals("192")))).Returns(true);
|
||||||
|
|
||||||
|
cpMock.Setup(x => x.GetSettings()).Returns(fixture.Create<CouchPotatoSettings>());
|
||||||
|
cpMock.Setup(x => x.SaveSettings(It.Is<CouchPotatoSettings>(c => c.Ip.Equals("192")))).Returns(true);
|
||||||
|
|
||||||
|
sonarrMock.Setup(x => x.GetSettings()).Returns(fixture.Create<SonarrSettings>());
|
||||||
|
sonarrMock.Setup(x => x.SaveSettings(It.Is<SonarrSettings>(c => c.Ip.Equals("192")))).Returns(true);
|
||||||
|
|
||||||
|
sickRageMock.Setup(x => x.GetSettings()).Returns(fixture.Create<SickRageSettings>());
|
||||||
|
sickRageMock.Setup(x => x.SaveSettings(It.Is<SickRageSettings>(c => c.Ip.Equals("192")))).Returns(true);
|
||||||
|
|
||||||
|
headphonesMock.Setup(x => x.GetSettings()).Returns(fixture.Create<HeadphonesSettings>());
|
||||||
|
headphonesMock.Setup(x => x.SaveSettings(It.Is<HeadphonesSettings>(c => c.Ip.Equals("192")))).Returns(true);
|
||||||
|
|
||||||
Bootstrapper = new ConfigurableBootstrapper(with =>
|
Bootstrapper = new ConfigurableBootstrapper(with =>
|
||||||
{
|
{
|
||||||
with.Module<ApiRequestModule>();
|
with.Module<ApiRequestModule>();
|
||||||
|
@ -102,7 +119,12 @@ namespace PlexRequests.UI.Tests
|
||||||
with.Dependency(settingsMock.Object);
|
with.Dependency(settingsMock.Object);
|
||||||
with.Dependency(userRepoMock.Object);
|
with.Dependency(userRepoMock.Object);
|
||||||
with.Dependency(mapperMock.Object);
|
with.Dependency(mapperMock.Object);
|
||||||
|
with.Dependency(headphonesMock.Object);
|
||||||
with.Dependency(authSettingsMock.Object);
|
with.Dependency(authSettingsMock.Object);
|
||||||
|
with.Dependency(plexSettingsMock.Object);
|
||||||
|
with.Dependency(cpMock.Object);
|
||||||
|
with.Dependency(sonarrMock.Object);
|
||||||
|
with.Dependency(sickRageMock.Object);
|
||||||
|
|
||||||
|
|
||||||
with.RootPathProvider<TestRootPathProvider>();
|
with.RootPathProvider<TestRootPathProvider>();
|
||||||
|
@ -112,7 +134,7 @@ namespace PlexRequests.UI.Tests
|
||||||
{
|
{
|
||||||
new FluentValidationValidatorFactory(
|
new FluentValidationValidatorFactory(
|
||||||
new DefaultFluentAdapterFactory(new List<IFluentAdapter>()),
|
new DefaultFluentAdapterFactory(new List<IFluentAdapter>()),
|
||||||
new List<IValidator> { new RequestedModelValidator(), new UserViewModelValidator() })
|
new List<IValidator> { new RequestedModelValidator(), new UserViewModelValidator(), new PlexValidator() })
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -405,6 +427,338 @@ namespace PlexRequests.UI.Tests
|
||||||
Assert.That(body.ErrorMessage, Is.Null.Or.Empty);
|
Assert.That(body.ErrorMessage, Is.Null.Or.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetPlexSettings()
|
||||||
|
{
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Get("/api/settings/plex", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<PlexSettings>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.Not.Null);
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SavePlexSettings()
|
||||||
|
{
|
||||||
|
var model = new PlexSettings()
|
||||||
|
{
|
||||||
|
Port = 231,
|
||||||
|
Ip = "192",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/plex", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(true));
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void SaveBadPlexSettings()
|
||||||
|
{
|
||||||
|
var model = new PlexSettings
|
||||||
|
{
|
||||||
|
Ip = "q",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/plex", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(false));
|
||||||
|
Assert.That(body.Error, Is.True);
|
||||||
|
Assert.That(body.ErrorMessage, Is.EqualTo("Could not update the settings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetCpSettings()
|
||||||
|
{
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Get("/api/settings/couchpotato", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<CouchPotatoSettings>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.Not.Null);
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SaveCpSettings()
|
||||||
|
{
|
||||||
|
var model = new CouchPotatoSettings
|
||||||
|
{
|
||||||
|
Port = 231,
|
||||||
|
Ip = "192",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/couchpotato", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(true));
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void SaveBadCpSettings()
|
||||||
|
{
|
||||||
|
var model = new CouchPotatoSettings
|
||||||
|
{
|
||||||
|
Ip = "q",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/couchpotato", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(false));
|
||||||
|
Assert.That(body.Error, Is.True);
|
||||||
|
Assert.That(body.ErrorMessage, Is.EqualTo("Could not update the settings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetSonarrSettings()
|
||||||
|
{
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Get("/api/settings/sonarr", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<SonarrSettings>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.Not.Null);
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SaveSonarrSettings()
|
||||||
|
{
|
||||||
|
var model = new SonarrSettings
|
||||||
|
{
|
||||||
|
Port = 231,
|
||||||
|
Ip = "192",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/sonarr", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(true));
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void SaveBadSonarrSettings()
|
||||||
|
{
|
||||||
|
var model = new SonarrSettings
|
||||||
|
{
|
||||||
|
Ip = "q",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/sonarr", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(false));
|
||||||
|
Assert.That(body.Error, Is.True);
|
||||||
|
Assert.That(body.ErrorMessage, Is.EqualTo("Could not update the settings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetSickRageSettings()
|
||||||
|
{
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Get("/api/settings/sickrage", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<SickRageSettings>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.Not.Null);
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SaveSickRageSettings()
|
||||||
|
{
|
||||||
|
var model = new SickRageSettings
|
||||||
|
{
|
||||||
|
Port = 231,
|
||||||
|
Ip = "192",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/sickrage", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(true));
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void SaveBadSickRageSettings()
|
||||||
|
{
|
||||||
|
var model = new SickRageSettings
|
||||||
|
{
|
||||||
|
Ip = "q",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/sickrage", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(false));
|
||||||
|
Assert.That(body.Error, Is.True);
|
||||||
|
Assert.That(body.ErrorMessage, Is.EqualTo("Could not update the settings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetHeadphonesSettings()
|
||||||
|
{
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Get("/api/settings/headphones", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<HeadphonesSettings>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.Not.Null);
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SaveHeadphonesSettings()
|
||||||
|
{
|
||||||
|
var model = new HeadphonesSettings
|
||||||
|
{
|
||||||
|
Port = 231,
|
||||||
|
Ip = "192",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/headphones", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(true));
|
||||||
|
Assert.That(body.Error, Is.False);
|
||||||
|
Assert.That(body.ErrorMessage, Is.Null);
|
||||||
|
}
|
||||||
|
[Test]
|
||||||
|
public void SaveBadHeadphonesSettings()
|
||||||
|
{
|
||||||
|
var model = new HeadphonesSettings
|
||||||
|
{
|
||||||
|
Ip = "q",
|
||||||
|
Ssl = true,
|
||||||
|
};
|
||||||
|
var browser = new Browser(Bootstrapper);
|
||||||
|
var result = browser.Post("/api/settings/headphones", with =>
|
||||||
|
{
|
||||||
|
with.HttpRequest();
|
||||||
|
with.Header("Accept", "application/json");
|
||||||
|
with.Query("apikey", "api");
|
||||||
|
with.JsonBody(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
var body = JsonConvert.DeserializeObject<ApiModel<bool>>(result.Body.AsString());
|
||||||
|
|
||||||
|
Assert.That(body.Data, Is.EqualTo(false));
|
||||||
|
Assert.That(body.Error, Is.True);
|
||||||
|
Assert.That(body.ErrorMessage, Is.EqualTo("Could not update the settings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[TestCaseSource(nameof(AuthSettingsData))]
|
[TestCaseSource(nameof(AuthSettingsData))]
|
||||||
public object SaveNewAuthSettings(object model)
|
public object SaveNewAuthSettings(object model)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: AuthSettingsDataProvider.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 Nancy.Swagger;
|
||||||
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
|
{
|
||||||
|
public class AuthSettingsDataProvider : ISwaggerModelDataProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model data for the api documentation.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SwaggerModelData GetModelData()
|
||||||
|
{
|
||||||
|
return SwaggerModelData.ForType<AuthenticationSettings>(
|
||||||
|
with =>
|
||||||
|
{
|
||||||
|
with.Property(x => x.DeniedUserList)
|
||||||
|
.Description("The blacklisted users, this is for internal use by the application, do not modify this list.")
|
||||||
|
.Required(false);
|
||||||
|
with.Property(x => x.DeniedUsers).Description("The blacklisted users, comma separated.").Required(false);
|
||||||
|
with.Property(x => x.PlexAuthToken).Description("The Plex authentication token").Required(false);
|
||||||
|
with.Property(x => x.UsePassword)
|
||||||
|
.Description("Require users to use a password to login when authentication is enabled")
|
||||||
|
.Required(false)
|
||||||
|
.Default(false);
|
||||||
|
with.Property(x => x.UserAuthentication)
|
||||||
|
.Description("Require users to enter their username in, this will check against Plex")
|
||||||
|
.Required(false)
|
||||||
|
.Default(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: CouchPotatoDataProvider.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 Nancy.Swagger;
|
||||||
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
|
{
|
||||||
|
public class CouchPotatoDataProvider : ISwaggerModelDataProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model data for the api documentation.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SwaggerModelData GetModelData()
|
||||||
|
{
|
||||||
|
return SwaggerModelData.ForType<CouchPotatoSettings>(
|
||||||
|
with =>
|
||||||
|
{
|
||||||
|
with.Property(x => x.Ip).Description("The IP address of CouchPotato").Required(true);
|
||||||
|
with.Property(x => x.Port).Description("The Port address of CouchPotato").Required(true).Default(5050);
|
||||||
|
with.Property(x => x.Ssl).Description("Enable SSL").Required(false).Default(false);
|
||||||
|
with.Property(x => x.FullUri).Description("Internal Property, do not use").Required(false).Default(null);
|
||||||
|
with.Property(x => x.SubDir).Description("Subdir/BaseUrl of CouchPotato").Required(false);
|
||||||
|
with.Property(x => x.ApiKey).Description("CouchPotato's API key").Required(true);
|
||||||
|
with.Property(x => x.ProfileId).Description("CouchPotato's profileId").Required(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
PlexRequests.UI/ModelDataProviders/HeadphonesDataProvider.cs
Normal file
54
PlexRequests.UI/ModelDataProviders/HeadphonesDataProvider.cs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: HeadphonesDataProvider.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 Nancy.Swagger;
|
||||||
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
|
{
|
||||||
|
public class HeadphonesDataProvider : ISwaggerModelDataProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model data for the api documentation.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SwaggerModelData GetModelData()
|
||||||
|
{
|
||||||
|
return SwaggerModelData.ForType<HeadphonesSettings>(
|
||||||
|
with =>
|
||||||
|
{
|
||||||
|
with.Property(x => x.Ip).Description("The IP address of Headphones").Required(true);
|
||||||
|
with.Property(x => x.Port).Description("The Port address of Headphones").Required(true).Default(5050);
|
||||||
|
with.Property(x => x.Ssl).Description("Enable SSL").Required(false).Default(false);
|
||||||
|
with.Property(x => x.FullUri).Description("Internal Property, do not use").Required(false).Default(null);
|
||||||
|
with.Property(x => x.SubDir).Description("Subdir/BaseUrl of Headphones").Required(false);
|
||||||
|
with.Property(x => x.ApiKey).Description("Headphones's API key").Required(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: PlexSettingsDataProvider.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 Nancy.Swagger;
|
||||||
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
|
{
|
||||||
|
public class PlexSettingsDataProvider : ISwaggerModelDataProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model data for the api documentation.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SwaggerModelData GetModelData()
|
||||||
|
{
|
||||||
|
return SwaggerModelData.ForType<PlexSettings>(
|
||||||
|
with =>
|
||||||
|
{
|
||||||
|
with.Property(x => x.Ip).Description("The IP address of the Plex Server").Required(true);
|
||||||
|
with.Property(x => x.Port).Description("The Port address of the Plex Server").Required(true).Default(32400);
|
||||||
|
with.Property(x => x.Ssl).Description("Enable SSL").Required(false).Default(false);
|
||||||
|
with.Property(x => x.FullUri).Description("Internal Property").Required(false);
|
||||||
|
|
||||||
|
with.Property(x => x.SubDir).Description("Subdir/BaseUrl of Plex").Required(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,6 @@
|
||||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
using System;
|
|
||||||
using Nancy.Swagger;
|
using Nancy.Swagger;
|
||||||
using Nancy.Swagger.Services;
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
@ -40,11 +39,10 @@ namespace PlexRequests.UI.ModelDataProviders
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public SwaggerModelData GetModelData()
|
public SwaggerModelData GetModelData()
|
||||||
{
|
{
|
||||||
return SwaggerModelData.ForType<RequestedModel>(with =>
|
return SwaggerModelData.ForType<RequestedModel>(
|
||||||
|
with =>
|
||||||
{
|
{
|
||||||
with.Property(x => x.Title)
|
with.Property(x => x.Title).Description("The requests title e.g. Star Wars Episode III").Required(true);
|
||||||
.Description("The requests title e.g. Star Wars Episode III")
|
|
||||||
.Required(true);
|
|
||||||
with.Property(x => x.AdminNote).Description("A note left by the administrator");
|
with.Property(x => x.AdminNote).Description("A note left by the administrator");
|
||||||
with.Property(x => x.Approved).Description("true or false if the request is approved").Required(true).Default(false);
|
with.Property(x => x.Approved).Description("true or false if the request is approved").Required(true).Default(false);
|
||||||
with.Property(x => x.ArtistId).Description("The artist ID (if this request is for Headphones then it is required)");
|
with.Property(x => x.ArtistId).Description("The artist ID (if this request is for Headphones then it is required)");
|
||||||
|
@ -59,11 +57,15 @@ namespace PlexRequests.UI.ModelDataProviders
|
||||||
with.Property(x => x.OtherMessage)
|
with.Property(x => x.OtherMessage)
|
||||||
.Description("The issue message left by the user. The Issues property needs to be set to Other (4) for this to work correctly");
|
.Description("The issue message left by the user. The Issues property needs to be set to Other (4) for this to work correctly");
|
||||||
with.Property(x => x.PosterPath).Description("The poster path for the request").Required(true);
|
with.Property(x => x.PosterPath).Description("The poster path for the request").Required(true);
|
||||||
with.Property(x => x.ProviderId).Description("The TVMaze/TheMovieDB Id for the request depending if it's a movie request or Tv request").Required(true);
|
with.Property(x => x.ProviderId)
|
||||||
|
.Description("The TVMaze/TheMovieDB Id for the request depending if it's a movie request or Tv request")
|
||||||
|
.Required(true);
|
||||||
with.Property(x => x.ReleaseDate).Description("The release date of the request").Required(true);
|
with.Property(x => x.ReleaseDate).Description("The release date of the request").Required(true);
|
||||||
with.Property(x => x.RequestedDate).Description("The date if the request, if this is not set, the request date will be set at the time of the Api call");
|
with.Property(x => x.RequestedDate)
|
||||||
|
.Description("The date if the request, if this is not set, the request date will be set at the time of the Api call");
|
||||||
with.Property(x => x.RequestedUsers).Description("A collection of the requested users").Required(true);
|
with.Property(x => x.RequestedUsers).Description("A collection of the requested users").Required(true);
|
||||||
with.Property(x => x.Type).Description("The type of request: Movie = 0, TvShow = 1, Album = 2").Required(true);
|
with.Property(x => x.Type).Description("The type of request: Movie = 0, TvShow = 1, Album = 2").Required(true);
|
||||||
|
with.Property(x => x.Id).Description("The request Id (Only use for deleting)");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
56
PlexRequests.UI/ModelDataProviders/SickRageDataProvider.cs
Normal file
56
PlexRequests.UI/ModelDataProviders/SickRageDataProvider.cs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: SickRageDataProvider.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 Nancy.Swagger;
|
||||||
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
|
{
|
||||||
|
public class SickRageDataProvider : ISwaggerModelDataProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model data for the api documentation.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SwaggerModelData GetModelData()
|
||||||
|
{
|
||||||
|
return SwaggerModelData.ForType<SickRageSettings>(
|
||||||
|
with =>
|
||||||
|
{
|
||||||
|
with.Property(x => x.Ip).Description("The IP address of SickRage").Required(true);
|
||||||
|
with.Property(x => x.Port).Description("The Port address of SickRage").Required(true).Default(5050);
|
||||||
|
with.Property(x => x.Ssl).Description("Enable SSL").Required(false).Default(false);
|
||||||
|
with.Property(x => x.FullUri).Description("Internal Property").Required(false);
|
||||||
|
|
||||||
|
with.Property(x => x.SubDir).Description("Subdir/BaseUrl of SickRage").Required(false);
|
||||||
|
with.Property(x => x.ApiKey).Description("SickRage's API key").Required(true);
|
||||||
|
with.Property(x => x.QualityProfile).Description("SickRage's quality profile").Required(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: SonarrSettingsDataProvider.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 Nancy.Swagger;
|
||||||
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
|
{
|
||||||
|
public class SonarrSettingsDataProvider : ISwaggerModelDataProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model data for the api documentation.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SwaggerModelData GetModelData()
|
||||||
|
{
|
||||||
|
return SwaggerModelData.ForType<SonarrSettings>(
|
||||||
|
with =>
|
||||||
|
{
|
||||||
|
with.Property(x => x.Ip).Description("The IP address of Sonarr").Required(true);
|
||||||
|
with.Property(x => x.Port).Description("The Port address of Sonarr").Required(true).Default(5050);
|
||||||
|
with.Property(x => x.Ssl).Description("Enable SSL").Required(false).Default(false);
|
||||||
|
with.Property(x => x.FullUri).Description("Internal Property").Required(false);
|
||||||
|
|
||||||
|
with.Property(x => x.SubDir).Description("Subdir/BaseUrl of Sonarr").Required(false);
|
||||||
|
with.Property(x => x.ApiKey).Description("Sonarr's API key").Required(true);
|
||||||
|
with.Property(x => x.QualityProfile).Description("Sonarr's quality profile").Required(true);
|
||||||
|
|
||||||
|
with.Property(x => x.SeasonFolders).Description("Sonarr's season folders").Required(false);
|
||||||
|
|
||||||
|
with.Property(x => x.RootPath).Description("Sonarr's root path").Required(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#region Copyright
|
#region Copyright
|
||||||
// /************************************************************************
|
// /************************************************************************
|
||||||
// Copyright (c) 2016 Jamie Rees
|
// Copyright (c) 2016 Jamie Rees
|
||||||
// File: RequestedModelDataProvider.cs
|
// File: UserUpdateViewModelDataProvider.cs
|
||||||
// Created By: Jamie Rees
|
// Created By: Jamie Rees
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
@ -24,15 +24,14 @@
|
||||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
using System;
|
|
||||||
using Nancy.Swagger;
|
using Nancy.Swagger;
|
||||||
using Nancy.Swagger.Services;
|
using Nancy.Swagger.Services;
|
||||||
|
|
||||||
using PlexRequests.Store;
|
using PlexRequests.UI.Models;
|
||||||
|
|
||||||
namespace PlexRequests.UI.ModelDataProviders
|
namespace PlexRequests.UI.ModelDataProviders
|
||||||
{
|
{
|
||||||
public class UserUpdateViewModel : ISwaggerModelDataProvider
|
public class UserUpdateViewModelDataProvider : ISwaggerModelDataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the model data for the api documentation.
|
/// Gets the model data for the api documentation.
|
||||||
|
@ -40,15 +39,12 @@ namespace PlexRequests.UI.ModelDataProviders
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public SwaggerModelData GetModelData()
|
public SwaggerModelData GetModelData()
|
||||||
{
|
{
|
||||||
return SwaggerModelData.ForType<Models.UserUpdateViewModel>(with =>
|
return SwaggerModelData.ForType<UserUpdateViewModel>(
|
||||||
|
with =>
|
||||||
{
|
{
|
||||||
with.Property(x => x.CurrentPassword)
|
with.Property(x => x.CurrentPassword).Description("The users current password").Required(true);
|
||||||
.Description("The users current password")
|
|
||||||
.Required(true);
|
|
||||||
|
|
||||||
with.Property(x => x.NewPassword)
|
with.Property(x => x.NewPassword).Description("The users new password that we will change it to").Required(true);
|
||||||
.Description("The users new password that we will change it to")
|
|
||||||
.Required(true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -55,6 +55,101 @@ namespace PlexRequests.UI.Modules
|
||||||
with.Notes("Saves the authentication settings saved in the application");
|
with.Notes("Saves the authentication settings saved in the application");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Describe["GetPlexSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/plex");
|
||||||
|
with.Summary("Gets the Plex settings saved in the application");
|
||||||
|
with.Model<ApiModel<PlexSettings>>();
|
||||||
|
with.Notes("Gets the Plex settings saved in the application");
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["PostPlexSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/plex");
|
||||||
|
with.Summary("Saves the Plex settings saved in the application");
|
||||||
|
with.Model<ApiModel<bool>>();
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
with.BodyParam<PlexSettings>("Plex settings", true);
|
||||||
|
with.Notes("Saves the Plex settings saved in the application");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Describe["GetCouchPotatoSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/couchpotato");
|
||||||
|
with.Summary("Gets the CouchPotato settings saved in the application");
|
||||||
|
with.Model<ApiModel<CouchPotatoSettings>>();
|
||||||
|
with.Notes("Gets the CouchPotato settings saved in the application");
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["PostCouchPotatoSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/couchpotato");
|
||||||
|
with.Summary("Saves the CouchPotato settings saved in the application");
|
||||||
|
with.Model<ApiModel<bool>>();
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
with.BodyParam<CouchPotatoSettings>("CouchPotato settings", true);
|
||||||
|
with.Notes("Saves the CouchPotato settings saved in the application");
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["GetSonarrSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/sonarr");
|
||||||
|
with.Summary("Gets the sonarr settings saved in the application");
|
||||||
|
with.Model<ApiModel<SonarrSettings>>();
|
||||||
|
with.Notes("Gets the sonarr settings saved in the application");
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["PostSonarrSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/sonarr");
|
||||||
|
with.Summary("Saves the sonarr settings saved in the application");
|
||||||
|
with.Model<ApiModel<bool>>();
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
with.BodyParam<SonarrSettings>("sonarr settings", true);
|
||||||
|
with.Notes("Saves the sonarr settings saved in the application");
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["GetSickRageSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/sickrage");
|
||||||
|
with.Summary("Gets the SickRage settings saved in the application");
|
||||||
|
with.Model<ApiModel<SickRageSettings>>();
|
||||||
|
with.Notes("Gets the SickRage settings saved in the application");
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["PostSickRageSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/sickrage");
|
||||||
|
with.Summary("Saves the SickRage settings saved in the application");
|
||||||
|
with.Model<ApiModel<bool>>();
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
with.BodyParam<SickRageSettings>("SickRage settings", true);
|
||||||
|
with.Notes("Saves the sickrage settings saved in the application");
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["GetHeadphonesSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/headphones");
|
||||||
|
with.Summary("Gets the headphones settings saved in the application");
|
||||||
|
with.Model<ApiModel<HeadphonesSettings>>();
|
||||||
|
with.Notes("Gets the headphones settings saved in the application");
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
});
|
||||||
|
|
||||||
|
Describe["PostHeadphonesSettings"] = description => description.AsSwagger(with =>
|
||||||
|
{
|
||||||
|
with.ResourcePath("/settings/sickrage");
|
||||||
|
with.Summary("Saves the headphones settings saved in the application");
|
||||||
|
with.Model<ApiModel<bool>>();
|
||||||
|
with.QueryParam<string>("apikey", "The Api Key found in the settings", true);
|
||||||
|
with.BodyParam<HeadphonesSettings>("headphones settings", true);
|
||||||
|
with.Notes("Saves the headphones settings saved in the application");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,6 +24,8 @@
|
||||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
|
using System.Web.UI.WebControls;
|
||||||
|
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using Nancy.ModelBinding;
|
using Nancy.ModelBinding;
|
||||||
|
|
||||||
|
@ -34,19 +36,46 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class ApiSettingsModule : BaseApiModule
|
public class ApiSettingsModule : BaseApiModule
|
||||||
{
|
{
|
||||||
public ApiSettingsModule(ISettingsService<PlexRequestSettings> pr, ISettingsService<AuthenticationSettings> auth) : base("api", pr)
|
public ApiSettingsModule(ISettingsService<PlexRequestSettings> pr, ISettingsService<AuthenticationSettings> auth,
|
||||||
|
ISettingsService<PlexSettings> plexSettings, ISettingsService<CouchPotatoSettings> cp,
|
||||||
|
ISettingsService<SonarrSettings> sonarr, ISettingsService<SickRageSettings> sr, ISettingsService<HeadphonesSettings> hp) : base("api", pr)
|
||||||
{
|
{
|
||||||
Get["GetAuthSettings","/settings/authentication"] = x => GetAuthSettings();
|
Get["GetAuthSettings","/settings/authentication"] = x => GetAuthSettings();
|
||||||
Post["PostAuthSettings","/settings/authentication"] = x => PostAuthSettings();
|
Post["PostAuthSettings","/settings/authentication"] = x => PostAuthSettings();
|
||||||
|
|
||||||
|
Get["GetPlexSettings", "/settings/plex"] = x => GetPlexSettings();
|
||||||
|
Post["PostPlexSettings", "/settings/plex"] = x => PostPlexSettings();
|
||||||
|
|
||||||
|
Get["GetCouchPotatoSettings", "/settings/couchpotato"] = x => GetCpSettings();
|
||||||
|
Post["PostCouchPotatoSettings", "/settings/couchpotato"] = x => PostCpSettings();
|
||||||
|
|
||||||
|
Get["GetSonarrSettings", "/settings/sonarr"] = x => GetSonarrSettings();
|
||||||
|
Post["PostSonarrSettings", "/settings/sonarr"] = x => PostSonarrSettings();
|
||||||
|
|
||||||
|
Get["GetSickRageSettings", "/settings/sickrage"] = x => GetSickRageSettings();
|
||||||
|
Post["PostSickRageSettings", "/settings/sickrage"] = x => PostSickRageSettings();
|
||||||
|
|
||||||
|
Get["GetHeadphonesSettings", "/settings/headphones"] = x => GetHeadphonesSettings();
|
||||||
|
Post["PostHeadphonesSettings", "/settings/headphones"] = x => PostHeadphonesSettings();
|
||||||
|
|
||||||
SettingsService = pr;
|
SettingsService = pr;
|
||||||
AuthSettings = auth;
|
AuthSettings = auth;
|
||||||
|
PlexSettings = plexSettings;
|
||||||
|
CpSettings = cp;
|
||||||
|
SonarrSettings = sonarr;
|
||||||
|
SickRageSettings = sr;
|
||||||
|
HeadphonesSettings = hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISettingsService<PlexRequestSettings> SettingsService { get; }
|
private ISettingsService<PlexRequestSettings> SettingsService { get; }
|
||||||
private ISettingsService<AuthenticationSettings> AuthSettings { get; }
|
private ISettingsService<AuthenticationSettings> AuthSettings { get; }
|
||||||
|
private ISettingsService<PlexSettings> PlexSettings { get; }
|
||||||
|
private ISettingsService<CouchPotatoSettings> CpSettings { get; }
|
||||||
|
private ISettingsService<SonarrSettings> SonarrSettings { get; }
|
||||||
|
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
||||||
|
private ISettingsService<HeadphonesSettings> HeadphonesSettings { get; }
|
||||||
|
|
||||||
public Response GetAuthSettings()
|
private Response GetAuthSettings()
|
||||||
{
|
{
|
||||||
var model = new ApiModel<AuthenticationSettings>();
|
var model = new ApiModel<AuthenticationSettings>();
|
||||||
var settings = AuthSettings.GetSettings();
|
var settings = AuthSettings.GetSettings();
|
||||||
|
@ -54,7 +83,7 @@ namespace PlexRequests.UI.Modules
|
||||||
return ReturnReponse(model);
|
return ReturnReponse(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Response PostAuthSettings()
|
private Response PostAuthSettings()
|
||||||
{
|
{
|
||||||
var newSettings = this.BindAndValidate<AuthenticationSettings>();
|
var newSettings = this.BindAndValidate<AuthenticationSettings>();
|
||||||
if (!ModelValidationResult.IsValid)
|
if (!ModelValidationResult.IsValid)
|
||||||
|
@ -75,5 +104,148 @@ namespace PlexRequests.UI.Modules
|
||||||
return ReturnReponse(model);
|
return ReturnReponse(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Response GetPlexSettings()
|
||||||
|
{
|
||||||
|
var model = new ApiModel<PlexSettings>();
|
||||||
|
var settings = PlexSettings.GetSettings();
|
||||||
|
model.Data = settings;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response PostPlexSettings()
|
||||||
|
{
|
||||||
|
var newSettings = this.BindAndValidate<PlexSettings>();
|
||||||
|
if (!ModelValidationResult.IsValid)
|
||||||
|
{
|
||||||
|
return ReturnValidationReponse(ModelValidationResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
var model = new ApiModel<bool>();
|
||||||
|
var settings = PlexSettings.SaveSettings(newSettings);
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
model.Data = true;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Error = true;
|
||||||
|
model.ErrorMessage = "Could not update the settings";
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response GetCpSettings()
|
||||||
|
{
|
||||||
|
var model = new ApiModel<CouchPotatoSettings>();
|
||||||
|
var settings = CpSettings.GetSettings();
|
||||||
|
model.Data = settings;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response PostCpSettings()
|
||||||
|
{
|
||||||
|
var newSettings = this.BindAndValidate<CouchPotatoSettings>();
|
||||||
|
if (!ModelValidationResult.IsValid)
|
||||||
|
{
|
||||||
|
return ReturnValidationReponse(ModelValidationResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
var model = new ApiModel<bool>();
|
||||||
|
var settings = CpSettings.SaveSettings(newSettings);
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
model.Data = true;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Error = true;
|
||||||
|
model.ErrorMessage = "Could not update the settings";
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response GetSonarrSettings()
|
||||||
|
{
|
||||||
|
var model = new ApiModel<SonarrSettings>();
|
||||||
|
var settings = SonarrSettings.GetSettings();
|
||||||
|
model.Data = settings;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response PostSonarrSettings()
|
||||||
|
{
|
||||||
|
var newSettings = this.BindAndValidate<SonarrSettings>();
|
||||||
|
if (!ModelValidationResult.IsValid)
|
||||||
|
{
|
||||||
|
return ReturnValidationReponse(ModelValidationResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
var model = new ApiModel<bool>();
|
||||||
|
var settings = SonarrSettings.SaveSettings(newSettings);
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
model.Data = true;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Error = true;
|
||||||
|
model.ErrorMessage = "Could not update the settings";
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response GetSickRageSettings()
|
||||||
|
{
|
||||||
|
var model = new ApiModel<SickRageSettings>();
|
||||||
|
var settings = SickRageSettings.GetSettings();
|
||||||
|
model.Data = settings;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response PostSickRageSettings()
|
||||||
|
{
|
||||||
|
var newSettings = this.BindAndValidate<SickRageSettings>();
|
||||||
|
if (!ModelValidationResult.IsValid)
|
||||||
|
{
|
||||||
|
return ReturnValidationReponse(ModelValidationResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
var model = new ApiModel<bool>();
|
||||||
|
var settings = SickRageSettings.SaveSettings(newSettings);
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
model.Data = true;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Error = true;
|
||||||
|
model.ErrorMessage = "Could not update the settings";
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
private Response GetHeadphonesSettings()
|
||||||
|
{
|
||||||
|
var model = new ApiModel<HeadphonesSettings>();
|
||||||
|
var settings = HeadphonesSettings.GetSettings();
|
||||||
|
model.Data = settings;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response PostHeadphonesSettings()
|
||||||
|
{
|
||||||
|
var newSettings = this.BindAndValidate<HeadphonesSettings>();
|
||||||
|
if (!ModelValidationResult.IsValid)
|
||||||
|
{
|
||||||
|
return ReturnValidationReponse(ModelValidationResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
var model = new ApiModel<bool>();
|
||||||
|
var settings = HeadphonesSettings.SaveSettings(newSettings);
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
model.Data = true;
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Error = true;
|
||||||
|
model.ErrorMessage = "Could not update the settings";
|
||||||
|
return ReturnReponse(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -165,7 +165,13 @@
|
||||||
<Compile Include="Helpers\ValidationHelper.cs" />
|
<Compile Include="Helpers\ValidationHelper.cs" />
|
||||||
<Compile Include="Jobs\CustomJobFactory.cs" />
|
<Compile Include="Jobs\CustomJobFactory.cs" />
|
||||||
<Compile Include="Jobs\Scheduler.cs" />
|
<Compile Include="Jobs\Scheduler.cs" />
|
||||||
<Compile Include="ModelDataProviders\UserUpdateViewModel.cs" />
|
<Compile Include="ModelDataProviders\HeadphonesDataProvider.cs" />
|
||||||
|
<Compile Include="ModelDataProviders\SickRageDataProvider.cs" />
|
||||||
|
<Compile Include="ModelDataProviders\SonarrSettingsDataProvider.cs" />
|
||||||
|
<Compile Include="ModelDataProviders\CouchPotatoDataProvider.cs" />
|
||||||
|
<Compile Include="ModelDataProviders\PlexSettingsDataProvider.cs" />
|
||||||
|
<Compile Include="ModelDataProviders\AuthSettingsDataProvider.cs" />
|
||||||
|
<Compile Include="ModelDataProviders\UserUpdateViewModelDataProvider.cs" />
|
||||||
<Compile Include="ModelDataProviders\RequestedModelDataProvider.cs" />
|
<Compile Include="ModelDataProviders\RequestedModelDataProvider.cs" />
|
||||||
<Compile Include="Models\DatatablesModel.cs" />
|
<Compile Include="Models\DatatablesModel.cs" />
|
||||||
<Compile Include="Models\JsonUpdateAvailableModel.cs" />
|
<Compile Include="Models\JsonUpdateAvailableModel.cs" />
|
||||||
|
|
|
@ -1,8 +1,34 @@
|
||||||
using System;
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: PlexRequestsValidator.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 FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
|
|
||||||
namespace PlexRequests.UI
|
namespace PlexRequests.UI.Validators
|
||||||
{
|
{
|
||||||
public class PlexRequestsValidator : AbstractValidator<PlexRequestSettings>
|
public class PlexRequestsValidator : AbstractValidator<PlexRequestSettings>
|
||||||
{
|
{
|
||||||
|
@ -19,10 +45,6 @@ namespace PlexRequests.UI
|
||||||
RuleFor(x => x.BaseUrl).NotEqual("updatechecker").WithMessage("You cannot use 'updatechecker' as this is reserved by the application.");
|
RuleFor(x => x.BaseUrl).NotEqual("updatechecker").WithMessage("You cannot use 'updatechecker' as this is reserved by the application.");
|
||||||
RuleFor(x => x.BaseUrl).NotEqual("usermanagement").WithMessage("You cannot use 'usermanagement' as this is reserved by the application.");
|
RuleFor(x => x.BaseUrl).NotEqual("usermanagement").WithMessage("You cannot use 'usermanagement' as this is reserved by the application.");
|
||||||
RuleFor(x => x.BaseUrl).NotEqual("api").WithMessage("You cannot use 'api' as this is reserved by the application.");
|
RuleFor(x => x.BaseUrl).NotEqual("api").WithMessage("You cannot use 'api' as this is reserved by the application.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace PlexRequests.UI.Validators
|
||||||
{
|
{
|
||||||
public PlexValidator()
|
public PlexValidator()
|
||||||
{
|
{
|
||||||
RuleFor(request => request.Ip).NotEmpty().WithMessage("You must specify a IP/Host name.");
|
RuleFor(request => request.Ip).NotNull().WithMessage("You must specify a IP/Host name.");
|
||||||
RuleFor(request => request.Port).NotEmpty().WithMessage("You must specify a Port.");
|
RuleFor(request => request.Port).NotNull().WithMessage("You must specify a Port.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue