aboutsummaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
Diffstat (limited to 'Backend')
-rw-r--r--Backend/Api/Api/Controllers/UserController.cs6
-rw-r--r--Backend/Api/Api/Services/UserService.cs4
2 files changed, 4 insertions, 6 deletions
diff --git a/Backend/Api/Api/Controllers/UserController.cs b/Backend/Api/Api/Controllers/UserController.cs
index 4e0f0a3..965ad6b 100644
--- a/Backend/Api/Api/Controllers/UserController.cs
+++ b/Backend/Api/Api/Controllers/UserController.cs
@@ -17,13 +17,9 @@ namespace Api.Controllers
}
[HttpPost("profile/pfp")]
[Authorize(Roles = "User")]
- public async Task<ActionResult<User>> setPfp([FromBody] IFormFile image)
+ public async Task<ActionResult<User>> setPfp(IFormFile image)
{
- if (image == null)
- return BadRequest();
var id = await _userService.UserIdFromJwt();
- if (id == null)
- return Unauthorized();
if(await _userService.AddOrChangePfp(id,image))
return Ok();
return BadRequest();
diff --git a/Backend/Api/Api/Services/UserService.cs b/Backend/Api/Api/Services/UserService.cs
index d8361cd..8e7cd42 100644
--- a/Backend/Api/Api/Services/UserService.cs
+++ b/Backend/Api/Api/Services/UserService.cs
@@ -324,7 +324,7 @@ namespace Api.Services
Directory.CreateDirectory(folderPath);
var filename = image.FileName;
var ext = Path.GetExtension(filename).ToLowerInvariant();
- var name ="PFP - " + user._id;
+ var name =user._id;
var fullPath = Path.Combine(folderPath, name+ext);
if (System.IO.File.Exists(fullPath))
System.IO.File.Delete(fullPath);
@@ -347,6 +347,7 @@ namespace Api.Services
if(user == null)
return null;
var tosend = new UserSend();
+ tosend.name = user.name;
tosend.pfp = user.pfp;
tosend.username = user.username;
tosend._id= user._id;
@@ -360,6 +361,7 @@ namespace Api.Services
if (user == null)
return null;
var tosend = new UserSend();
+ tosend.name = user.name;
tosend.pfp = user.pfp;
tosend.username = user.username;
tosend._id = user._id;