-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdminController.cs
49 lines (43 loc) · 1.49 KB
/
AdminController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace rubberduckvba.Server.Api.Admin;
[ApiController]
public class AdminController(ConfigurationOptions options, HangfireLauncherService hangfire) : ControllerBase
{
/// <summary>
/// Enqueues a job that updates xmldoc content from the latest release/pre-release tags.
/// </summary>
/// <returns>The unique identifier of the enqueued job.</returns>
[Authorize("github", AuthenticationSchemes = "github")]
[HttpPost("admin/update/xmldoc")]
public IActionResult UpdateXmldocContent()
{
var jobId = hangfire.UpdateXmldocContent();
return Ok(jobId);
}
/// <summary>
/// Enqueues a job that gets the latest release/pre-release tags and their respective assets, and updates the installer download stats.
/// </summary>
/// <returns>The unique identifier of the enqueued job.</returns>
[Authorize("github", AuthenticationSchemes = "github")]
[HttpPost("admin/update/tags")]
public IActionResult UpdateTagMetadata()
{
var jobId = hangfire.UpdateTagMetadata();
return Ok(jobId);
}
#if DEBUG
[HttpGet("admin/config/current")]
public IActionResult Config()
{
return Ok(options);
}
#endif
}
public record class ConfigurationOptions(
IOptions<ConnectionSettings> ConnectionOptions,
IOptions<GitHubSettings> GitHubOptions,
IOptions<HangfireSettings> HangfireOptions)
{
}