mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Finished #337
This commit is contained in:
parent
a9237db313
commit
6aae347297
2 changed files with 172 additions and 122 deletions
|
@ -46,6 +46,8 @@ using NLog;
|
|||
|
||||
using MarkdownSharp;
|
||||
|
||||
using Nancy.Responses;
|
||||
|
||||
using PlexRequests.Api;
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Core;
|
||||
|
@ -204,6 +206,8 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
Get["/scheduledjobs", true] = async (x, ct) => await GetScheduledJobs();
|
||||
Post["/scheduledjobs", true] = async (x, ct) => await SaveScheduledJobs();
|
||||
|
||||
Post["/clearlogs", true] = async (x, ct) => await ClearLogs();
|
||||
}
|
||||
|
||||
private async Task<Negotiator> Authentication()
|
||||
|
@ -888,5 +892,23 @@ namespace PlexRequests.UI.Modules
|
|||
? new JsonResponseModel { Result = true }
|
||||
: new JsonResponseModel { Result = false, Message = "Could not save to Db Please check the logs" });
|
||||
}
|
||||
|
||||
private async Task<Response> ClearLogs()
|
||||
{
|
||||
try
|
||||
{
|
||||
var allLogs = await LogsRepo.GetAllAsync();
|
||||
foreach (var logEntity in allLogs)
|
||||
{
|
||||
await LogsRepo.DeleteAsync(logEntity);
|
||||
}
|
||||
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = e.Message });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue