summary refs log tree commit diff
path: root/extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-01-11 16:31:22 +0100
committerRory& <root@rory.gay>2026-01-11 16:31:22 +0100
commit654fcc29b5d2284d301df3f63e9db35c21ec63cf (patch)
treec9191c9b62307c08056e3b62cdcd7d4bfbb3c715 /extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs
parentMerge pull request #1464 from CyberL1/fix/build-workflow (diff)
downloadserver-ts-654fcc29b5d2284d301df3f63e9db35c21ec63cf.tar.xz
CDN-CS stuff
Diffstat (limited to 'extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs')
-rw-r--r--extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs b/extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs
new file mode 100644

index 00000000..25070052 --- /dev/null +++ b/extra/admin-api/Spacebar.AdminApi/Controllers/Media/StickerController.cs
@@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Spacebar.AdminApi.Extensions; +using Spacebar.AdminApi.Models; +using Spacebar.AdminApi.Services; +using Spacebar.Db.Contexts; +using Spacebar.Db.Models; +using Spacebar.RabbitMqUtilities; + +namespace Spacebar.AdminApi.Controllers.Media; + +[ApiController] +[Route("/media/sticker")] +public class StickerController(ILogger<StickerController> logger, SpacebarDbContext db, RabbitMQService mq, AuthenticationService auth, IServiceProvider sp) : ControllerBase { + [HttpGet("")] + public async IAsyncEnumerable<StickerModel> GetStickers() { + (await auth.GetCurrentUser(Request)).GetRights().AssertHasAllRights(SpacebarRights.Rights.OPERATOR); + + // var db2 = sp.CreateScope().ServiceProvider.GetService<SpacebarDbContext>(); + var stickers = db.Stickers + .AsNoTracking() + .IgnoreAutoIncludes() + .AsAsyncEnumerable(); + await foreach (var sticker in stickers) { + yield return new() { + Id = sticker.Id, + Name = sticker.Name, + Description = sticker.Description, + Available = sticker.Available, + Tags = sticker.Tags, + PackId = sticker.PackId, + GuildId = sticker.GuildId, + UserId = sticker.UserId, + Type = sticker.Type, + FormatType = sticker.FormatType, + }; + } + } +} \ No newline at end of file