feat(dashboard): add tos/privacy/about pages, add delete all data page + endpoint

This commit is contained in:
sam 2024-10-24 15:53:27 +02:00
parent ac54b78a13
commit 31b6ac2cac
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
21 changed files with 527 additions and 28 deletions

View file

@ -20,13 +20,25 @@ using Microsoft.AspNetCore.Mvc;
namespace Catalogger.Backend.Api;
[Route("/api")]
public class MetaController(GuildCache guildCache, DiscordRequestService discordRequestService)
: ApiControllerBase
public class MetaController(
Config config,
GuildCache guildCache,
DiscordRequestService discordRequestService
) : ApiControllerBase
{
[HttpGet("meta")]
public IActionResult GetMeta()
{
return Ok(new MetaResponse(Guilds: (int)CataloggerMetrics.GuildsCached.Value));
var inviteUrl =
$"https://discord.com/oauth2/authorize?client_id={config.Discord.ApplicationId}"
+ "&permissions=537250993&scope=bot+applications.commands";
return Ok(
new MetaResponse(
Guilds: (int)CataloggerMetrics.GuildsCached.Value,
InviteUrl: inviteUrl
)
);
}
[HttpGet("current-user")]
@ -48,7 +60,7 @@ public class MetaController(GuildCache guildCache, DiscordRequestService discord
);
}
private record MetaResponse(int Guilds);
private record MetaResponse(int Guilds, string InviteUrl);
private record CurrentUserResponse(ApiUser User, IEnumerable<ApiGuild> Guilds);
}