Files
IM_NEW/ContactService.WebApi/Controllers/ManagementController.cs

12 lines
497 B
C#

using ContactService.Infrastructure;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ContactService.WebApi.Controllers;
[ApiController, Route("internal/management")]
public sealed class ManagementController(ContactDbContext db) : ControllerBase
{
[HttpGet("relation/{owner:guid}/{target:guid}")]
public async Task<object> Relation(Guid owner, Guid target) => new { related = await db.Friends.AnyAsync(x => x.Owner.Id == owner && x.Target.Id == target) };
}