Fix Profile Cosmetic Not Being Included In Some User Related Requests

This commit is contained in:
Alan Moon 2025-08-03 14:20:18 -07:00
parent d4aa8761d3
commit 57c6c010ff
3 changed files with 10 additions and 4 deletions

View File

@ -11,11 +11,9 @@ namespace qtc_api.Controllers
public class StoreController : ControllerBase
{
private readonly StoreService _storeService;
private readonly IUserService _userService;
public StoreController(StoreService storeService, IUserService userService)
public StoreController(StoreService storeService)
{
_storeService = storeService;
_userService = userService;
}
[HttpGet]
@ -89,6 +87,7 @@ namespace qtc_api.Controllers
if (userId != null)
{
var result = await _storeService.BuyStoreItem(userId, id);
return Ok(result);
}
else return Ok(new ServiceResponse<bool> { Success = false, Message = "No UserId In Auth Header" });

View File

@ -13,7 +13,12 @@ namespace qtc_api.Services.StoreService
_ctx = ctx;
_userService = userService;
StoreItem[]? storeItems = JsonSerializer.Deserialize<StoreItem[]>(File.ReadAllText("./Resources/store.json"));
string storeJsonLocation = "./Resources/store.json";
if (System.Diagnostics.Debugger.IsAttached)
storeJsonLocation = "./Resources/store.Development.json";
StoreItem[]? storeItems = JsonSerializer.Deserialize<StoreItem[]>(File.ReadAllText(storeJsonLocation));
if (storeItems != null && storeItems.Length > 0)
{
StoreItems = storeItems.ToList();

View File

@ -111,6 +111,7 @@ namespace qtc_api.Services.UserService
x.CurrencyAmount = user.CurrencyAmount;
x.Status = user.Status;
x.CreatedAt = user.CreatedAt;
x.ProfileCosmeticId = user.ActiveProfileCosmetic;
userInfoList.Add(x);
}
@ -141,6 +142,7 @@ namespace qtc_api.Services.UserService
x.CreatedAt = user.CreatedAt;
x.CurrencyAmount = user.CurrencyAmount;
x.CreatedAt = user.CreatedAt;
x.ProfileCosmeticId = user.ActiveProfileCosmetic;
onlineUsers.Add(x);
}