18 lines
574 B
C#
18 lines
574 B
C#
using System.Security.Claims;
|
|
using ApiGateway.Security;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ApiGateway.Controllers;
|
|
|
|
[ApiController]
|
|
[Authorize(Policy = "HealthcareProfessional")]
|
|
[Route("api/professionals/me/patients")]
|
|
public sealed class ProfessionalController(ProfessionalAssignments assignments) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public IActionResult GetAssignedPatients() =>
|
|
Ok(assignments.GetPatients(User.FindFirstValue(ClaimTypes.NameIdentifier)!)
|
|
.Select(patientId => new { patientId }));
|
|
}
|