mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fixing sonar code quality recommendations
This commit is contained in:
parent
4f93fef661
commit
2d066ea36c
@ -61,20 +61,7 @@ namespace API.Controllers
|
|||||||
{
|
{
|
||||||
return Ok(await _libraryRepository.GetLibrariesAsync());
|
return Ok(await _libraryRepository.GetLibrariesAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Do I need this method?
|
|
||||||
// [HttpGet("library/{username}")]
|
|
||||||
// public async Task<ActionResult<IEnumerable<LibraryDto>>> GetLibrariesForUser(string username)
|
|
||||||
// {
|
|
||||||
// _logger.LogDebug("Method hit");
|
|
||||||
// var user = await _userRepository.GetUserByUsernameAsync(User.GetUsername());
|
|
||||||
//
|
|
||||||
// if (user == null) return BadRequest("Could not validate user");
|
|
||||||
//
|
|
||||||
// return Ok(await _libraryRepository.GetLibrariesForUserAsync(user));
|
|
||||||
// }
|
|
||||||
|
|
||||||
[Authorize(Policy = "RequireAdminRole")]
|
[Authorize(Policy = "RequireAdminRole")]
|
||||||
[HttpPut("update-for")]
|
[HttpPut("update-for")]
|
||||||
public async Task<ActionResult<MemberDto>> UpdateLibrary(UpdateLibraryDto updateLibraryDto)
|
public async Task<ActionResult<MemberDto>> UpdateLibrary(UpdateLibraryDto updateLibraryDto)
|
||||||
|
@ -30,7 +30,6 @@ namespace API.Controllers
|
|||||||
{
|
{
|
||||||
// NOTE: I think we should move this into library controller because it gets added to all admins
|
// NOTE: I think we should move this into library controller because it gets added to all admins
|
||||||
|
|
||||||
//_logger.Log(LogLevel.Debug, "Creating a new " + createLibraryDto.Type + " library");
|
|
||||||
var user = await _userRepository.GetUserByUsernameAsync(User.GetUsername());
|
var user = await _userRepository.GetUserByUsernameAsync(User.GetUsername());
|
||||||
|
|
||||||
if (user == null) return BadRequest("Could not validate user");
|
if (user == null) return BadRequest("Could not validate user");
|
||||||
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Identity;
|
|||||||
|
|
||||||
namespace API.Data
|
namespace API.Data
|
||||||
{
|
{
|
||||||
public class Seed
|
public static class Seed
|
||||||
{
|
{
|
||||||
public static async Task SeedRoles(RoleManager<AppRole> roleManager)
|
public static async Task SeedRoles(RoleManager<AppRole> roleManager)
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,10 @@ namespace API
|
|||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
protected Program()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = CreateHostBuilder(args).Build();
|
var host = CreateHostBuilder(args).Build();
|
||||||
@ -37,7 +41,7 @@ namespace API
|
|||||||
await host.RunAsync();
|
await host.RunAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
Host.CreateDefaultBuilder(args)
|
Host.CreateDefaultBuilder(args)
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,6 @@ namespace API
|
|||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
//app.UseDeveloperExceptionPage();
|
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user