aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Web/Controllers')
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs
index 471d2bb..7121ac8 100644
--- a/src/DevHive.Web/Controllers/UserController.cs
+++ b/src/DevHive.Web/Controllers/UserController.cs
@@ -6,14 +6,10 @@ using DevHive.Web.Models.Identity.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using DevHive.Common.Models.Identity;
-using DevHive.Common.Models.Misc;
-using DevHive.Web.Models.Language;
-using DevHive.Services.Models.Language;
-using DevHive.Web.Models.Technology;
-using DevHive.Services.Models.Technology;
using DevHive.Services.Interfaces;
-using DevHive.Data.Models;
using Microsoft.AspNetCore.JsonPatch;
+using DevHive.Common.Models.Misc;
+using System.Collections.Generic;
namespace DevHive.Web.Controllers
{
@@ -87,15 +83,12 @@ namespace DevHive.Web.Controllers
#region Update
[HttpPut]
- public async Task<IActionResult> Update(Guid id, [FromBody] UpdateUserWebModel updateModel, [FromHeader] string authorization)
+ public async Task<IActionResult> Update(Guid id, [FromBody] UpdateUserWebModel updateUserWebModel, [FromHeader] string authorization)
{
if (!await this._userService.ValidJWT(id, authorization))
return new UnauthorizedResult();
- // if (!ModelState.IsValid)
- // return BadRequest("Not a valid model!");
-
- UpdateUserServiceModel updateUserServiceModel = this._userMapper.Map<UpdateUserServiceModel>(updateModel);
+ UpdateUserServiceModel updateUserServiceModel = this._userMapper.Map<UpdateUserServiceModel>(updateUserWebModel);
updateUserServiceModel.Id = id;
UserServiceModel userServiceModel = await this._userService.UpdateUser(updateUserServiceModel);
@@ -105,12 +98,12 @@ namespace DevHive.Web.Controllers
}
[HttpPatch]
- public async Task<IActionResult> Patch(Guid id, [FromBody] JsonPatchDocument<User> jsonPatch, [FromHeader] string authorization)
+ public async Task<IActionResult> Patch(Guid id, [FromBody] List<Patch> patch, [FromHeader] string authorization)
{
if (!await this._userService.ValidJWT(id, authorization))
return new UnauthorizedResult();
- UserServiceModel userServiceModel = await this._userService.PatchUser(id, jsonPatch);
+ UserServiceModel userServiceModel = await this._userService.PatchUser(id, patch);
if (userServiceModel == null)
return new BadRequestObjectResult("Wrong patch properties");