[backend/api] Allow naming single emojis during upload (ISH-602)

This commit is contained in:
Laura Hausmann 2025-01-08 14:42:26 +01:00
parent a8e8b67e0b
commit 553c0cf7ab
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -68,9 +68,10 @@ public class EmojiController(
[Authorize("role:moderator")] [Authorize("role:moderator")]
[ProducesResults(HttpStatusCode.OK)] [ProducesResults(HttpStatusCode.OK)]
[ProducesErrors(HttpStatusCode.Conflict)] [ProducesErrors(HttpStatusCode.Conflict)]
public async Task<EmojiResponse> UploadEmoji(IFormFile file) public async Task<EmojiResponse> UploadEmoji(IFormFile file, [FromQuery] string name)
{ {
var emoji = await emojiSvc.CreateEmojiFromStreamAsync(file.OpenReadStream(), file.FileName, file.ContentType); var ext = Path.HasExtension(file.FileName) ? Path.GetExtension(file.FileName) : "";
var emoji = await emojiSvc.CreateEmojiFromStreamAsync(file.OpenReadStream(), name + ext, file.ContentType);
return new EmojiResponse return new EmojiResponse
{ {