fix: cheers, it builds now

This commit is contained in:
2025-09-30 19:17:10 +03:00
parent dcbdb393cf
commit 0021c352dc
11 changed files with 8 additions and 156 deletions

View File

@@ -1,34 +0,0 @@
using System.Security.Claims;
using LctMonolith.Services;
using LctMonolith.Services.Contracts;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace LctMonolith.Controllers;
/// <summary>
/// Endpoints exposing gamification progress information.
/// </summary>
[ApiController]
[Route("api/gamification")]
[Authorize]
public class GamificationController : ControllerBase
{
private readonly IGamificationService _gamificationService;
public GamificationController(IGamificationService gamificationService)
{
_gamificationService = gamificationService;
}
private Guid GetUserId() => Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)!);
/// <summary>Returns current user progress snapshot (rank, xp, outstanding requirements).</summary>
[HttpGet("progress")]
public async Task<IActionResult> GetProgress(CancellationToken ct)
{
var snapshot = await _gamificationService.GetProgressAsync(GetUserId(), ct);
return Ok(snapshot);
}
}

View File

@@ -1,41 +0,0 @@
using System.Security.Claims;
using LctMonolith.Services;
using LctMonolith.Services.Contracts;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace LctMonolith.Controllers;
/// <summary>
/// Inventory endpoints for viewing owned store items and artifacts.
/// </summary>
[ApiController]
[Route("api/inventory")]
[Authorize]
public class InventoryController : ControllerBase
{
private readonly IInventoryService _inventory;
public InventoryController(IInventoryService inventory)
{
_inventory = inventory;
}
private Guid GetUserId() => Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)!);
/// <summary>List owned store inventory entries.</summary>
[HttpGet("store-items")]
public async Task<IActionResult> GetStoreItems(CancellationToken ct)
{
var items = await _inventory.GetStoreInventoryAsync(GetUserId(), ct);
return Ok(items.Select(i => new { i.StoreItemId, i.Quantity, i.AcquiredAt, i.IsReturned, i.StoreItem?.Name }));
}
/// <summary>List owned artifacts.</summary>
[HttpGet("artifacts")]
public async Task<IActionResult> GetArtifacts(CancellationToken ct)
{
var artifacts = await _inventory.GetArtifactsAsync(GetUserId(), ct);
return Ok(artifacts.Select(a => new { a.ArtifactId, a.ObtainedAt, a.Artifact?.Name, a.Artifact?.Rarity }));
}
}

View File

@@ -1,53 +0,0 @@
using System.Security.Claims;
using LctMonolith.Models.Database;
using LctMonolith.Services;
using LctMonolith.Services.Contracts;
using LctMonolith.Services.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace LctMonolith.Controllers;
/// <summary>
/// Endpoints for listing and managing missions.
/// </summary>
[ApiController]
[Route("api/missions")]
[Authorize]
public class MissionsController : ControllerBase
{
private readonly IMissionService _missionService;
public MissionsController(IMissionService missionService)
{
_missionService = missionService;
}
private Guid GetUserId() => Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)!);
/// <summary>Returns missions currently available to the authenticated user.</summary>
[HttpGet]
public async Task<ActionResult<IEnumerable<Mission>>> GetAvailable(CancellationToken ct)
{
var userId = GetUserId();
var list = await _missionService.GetAvailableMissionsAsync(userId, ct);
return Ok(list);
}
/// <summary>Create a mission (HR functionality for now any authenticated user).</summary>
[HttpPost]
public async Task<ActionResult<Mission>> Create(CreateMissionModel model, CancellationToken ct)
{
var mission = await _missionService.CreateMissionAsync(model, ct);
return CreatedAtAction(nameof(GetAvailable), new { id = mission.Id }, mission);
}
/// <summary>Update mission status for current user (submit/complete/etc.).</summary>
[HttpPatch("{missionId:guid}/status")]
public async Task<ActionResult> UpdateStatus(Guid missionId, UpdateMissionStatusRequest req, CancellationToken ct)
{
var userId = GetUserId();
var result = await _missionService.UpdateStatusAsync(userId, missionId, req.Status, req.SubmissionData, ct);
return Ok(new { result.MissionId, result.Status, result.UpdatedAt });
}
}