Skip to content

Commit

Permalink
Refactor namespace and authentication in FilesController
Browse files Browse the repository at this point in the history
- Changed namespace from Argon.Api.Controllers to Argon.Controllers
- Updated authentication method to JwtBearerDefaults.AuthenticationScheme
  • Loading branch information
0xF6 committed Dec 3, 2024
1 parent 57cc270 commit 89ff18e
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/Argon.Api/Controllers/FilesController.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
namespace Argon.Api.Controllers;
namespace Argon.Controllers;

using ActualLab.Collections;
using Features.MediaStorage.Storages;
using Contracts;
using Extensions;
using Features.MediaStorage;
using Features.MediaStorage.Storages;
using Features.Pex;
using Grains.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Argon.Features;
using Contracts.Models.ArchetypeModel;

public class FilesController(
IOptions<CdnOptions> cdnOptions,
Expand Down Expand Up @@ -61,7 +53,7 @@ public async ValueTask<IActionResult> UploadServerAvatar([FromRoute] Guid server
await grainFactory.GetGrain<IServerGrain>(serverId)
.UpdateServer(new ServerInput(null, null, assetId.ToFileId()));

return Ok(await cdn.GenerateAssetUrl(ns, assetId));
return Ok(cdn.GenerateAssetUrl(ns, assetId));
}

[HttpPost("/files/user/@me/avatar"), Authorize(JwtBearerDefaults.AuthenticationScheme)]
Expand All @@ -78,6 +70,6 @@ public async ValueTask<IActionResult> UploadUserAvatar(IFormFile file)
await grainFactory.GetGrain<IUserGrain>(userId)
.UpdateUser(new UserEditInput(null, null, assetId.ToFileId()));

return Ok(await cdn.GenerateAssetUrl(ns, assetId));
return Ok(cdn.GenerateAssetUrl(ns, assetId));
}
}

0 comments on commit 89ff18e

Please sign in to comment.