diff --git a/Ankh.Backend/Controllers/InfoController.cs b/Ankh.Backend/Controllers/InfoController.cs index ff31df0..11e7bbc 100644 --- a/Ankh.Backend/Controllers/InfoController.cs +++ b/Ankh.Backend/Controllers/InfoController.cs @@ -1,5 +1,4 @@ using Ankh.Handlers; -using Ankh.Models.Rest; using Ankh.Models.Rework; using Microsoft.AspNetCore.Mvc; @@ -16,12 +15,12 @@ public async ValueTask GetUserInformationAsync(string userId) { return BadRequest($"Missing {nameof(userId)} in request."); } - var user = await database.GetByIdAsync(userId); + var user = await database.GetByIdAsync(userId); if (!string.IsNullOrWhiteSpace(user.Username)) { return Ok(user); } - user = await userHandler.GetUserByIdAsync(int.Parse(userId)); + user = await userHandler.GetUserByIdAsync(userId); await database.SaveAsync(user); return Ok(user); } diff --git a/Ankh.Backend/Controllers/ProductsController.cs b/Ankh.Backend/Controllers/ProductsController.cs index 2625368..093c7da 100644 --- a/Ankh.Backend/Controllers/ProductsController.cs +++ b/Ankh.Backend/Controllers/ProductsController.cs @@ -1,6 +1,6 @@ using Ankh.Api.Models; using Ankh.Handlers; -using Ankh.Models.Rest; +using Ankh.Models.Rework; using Microsoft.AspNetCore.Mvc; namespace Ankh.Backend.Controllers; @@ -20,14 +20,14 @@ public async Task GetSceneProductsAsync(Response response) { } var sceneProducts = await productHandler.GetProductsInSceneAsync($"{response.Query}"); - var result = new Dictionary(); + var result = new Dictionary(); foreach (var (key, value) in sceneProducts) { - var user = await database.GetByIdAsync(key); + var user = await database.GetByIdAsync(key); var products = new List(); if (!string.IsNullOrWhiteSpace(user.Username)) { - user = await userHandler.GetUserByIdAsync(user.UserId); + user = await userHandler.GetUserByIdAsync(user.Id); await database.SaveAsync(user); } @@ -43,7 +43,7 @@ await Parallel.ForEachAsync(value, async (v, _) => { products.Add(product); }); - result.Add(user.UserId, new { + result.Add(user.Id, new { user, products });