feat: ship agent-first mission control v0.2.57
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Nexus.Api.Models;
|
||||
using Nexus.Api.Repositories;
|
||||
|
||||
namespace Nexus.Api.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/v1/activity")]
|
||||
public class ActivityController(IActivityRepository activityRepo) : ControllerBase
|
||||
public sealed class ActivityController(IActivityRepository activityRepo) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IResult> Get(
|
||||
[ProducesResponseType(typeof(ActivityPageDto), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)]
|
||||
public async Task<ActionResult<ActivityPageDto>> Get(
|
||||
[FromQuery] string? type,
|
||||
[FromQuery] string? sort,
|
||||
[FromQuery] int? page,
|
||||
@@ -20,13 +25,18 @@ public class ActivityController(IActivityRepository activityRepo) : ControllerBa
|
||||
|
||||
var (items, totalCount) = await activityRepo.GetPagedAsync(type, sort, pageNum, take, ct);
|
||||
|
||||
return Results.Ok(new
|
||||
{
|
||||
items = items.Select(x => new { x.Id, x.Type, x.Message, at = x.CreatedAt }),
|
||||
return Ok(new ActivityPageDto(
|
||||
items.Select(item => new ActivityItemDto(
|
||||
item.Id,
|
||||
item.Type,
|
||||
item.Message,
|
||||
item.CreatedAt,
|
||||
item.TaskId is Guid taskId
|
||||
? new EntityRefDto("task", taskId.ToString(), null)
|
||||
: null)).ToArray(),
|
||||
totalCount,
|
||||
page = pageNum,
|
||||
pageSize = take,
|
||||
totalPages = (int)Math.Ceiling((double)totalCount / take)
|
||||
});
|
||||
pageNum,
|
||||
take,
|
||||
(int)Math.Ceiling((double)totalCount / take)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user