Adding a provider api

This commit is contained in:
Zoe Roux 2020-05-03 03:26:20 +02:00
parent 976ffbaa41
commit b7618c9c54
3 changed files with 30 additions and 3 deletions

View File

@ -52,8 +52,8 @@ namespace Kyoo
services.AddDbContext<DatabaseContext>(options =>
{
options.UseLazyLoadingProxies()
.UseSqlite(_configuration.GetConnectionString("Database"))
.EnableSensitiveDataLogging();
.UseSqlite(_configuration.GetConnectionString("Database"));
//.EnableSensitiveDataLogging();
//.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
});

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
using Kyoo.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Kyoo.API
{
[Route("api/provider")]
[Route("api/providers")]
[ApiController]
public class ProviderAPI : ControllerBase
{
private readonly DatabaseContext _database;
public ProviderAPI(DatabaseContext database)
{
_database = database;
}
[HttpGet("")]
[Authorize(Policy="Read")]
public ActionResult<IEnumerable<ProviderID>> Index()
{
return _database.Providers;
}
}
}

@ -1 +1 @@
Subproject commit 4ec71d48a9d48a054ea68594d3b8b4e2a09b33de
Subproject commit e4cd29a489d5f20de42bb89f7db2c8299b7c5171