26 lines
774 B
C#
26 lines
774 B
C#
using Aegis.API.Auth;
|
|
using Aegis.API.Dtos;
|
|
using Aegis.Application.DataStores.ListDataStores;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Aegis.API.Controllers;
|
|
|
|
public class DataStoreController(CurrentUserAccessor currentUser, ListDataStoresUseCase listDataStoresUseCase)
|
|
: ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<ActionResult<IReadOnlyList<DataStoreDto>>> List(CancellationToken ct)
|
|
{
|
|
var userId = currentUser.GetUserId(User);
|
|
var summaries = await listDataStoresUseCase.ExecuteAsync(userId, ct);
|
|
|
|
var dtos = summaries.Select(s => new DataStoreDto(
|
|
s.DataStoreId.Value,
|
|
s.Name,
|
|
s.Role.ToString().ToUpperInvariant(),
|
|
s.Locked
|
|
)).ToList();
|
|
|
|
return Ok(dtos);
|
|
}
|
|
} |