api: fix error on user patch

This commit is contained in:
Abdullah Atta
2025-09-17 11:38:33 +05:00
parent 9b774d640c
commit 8f8c60e0b3
2 changed files with 12 additions and 18 deletions

View File

@@ -69,17 +69,11 @@ namespace Notesnook.API.Controllers
}
[HttpPatch]
public async Task<IActionResult> UpdateUser([FromBody] UserResponse user)
public async Task<IActionResult> UpdateUser([FromBody] UserKeys keys)
{
var userId = User.FindFirstValue("sub");
try
{
var keys = new UserKeys
{
AttachmentsKey = user.AttachmentsKey,
MonographPasswordsKey = user.MonographPasswordsKey,
InboxKeys = user.InboxKeys
};
await UserService.SetUserKeysAsync(userId, keys);
return Ok();
}

View File

@@ -19,16 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Notesnook.API.Models
{
public class UserKeys
{
public EncryptedData AttachmentsKey { get; set; }
public EncryptedData MonographPasswordsKey { get; set; }
public InboxKeys InboxKeys { get; set; }
}
public class UserKeys
{
public EncryptedData? AttachmentsKey { get; set; }
public EncryptedData? MonographPasswordsKey { get; set; }
public InboxKeys? InboxKeys { get; set; }
}
public class InboxKeys
{
public string Public { get; set; }
public EncryptedData Private { get; set; }
}
public class InboxKeys
{
public string? Public { get; set; }
public EncryptedData? Private { get; set; }
}
}