Add relationships feature and EF migration
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RecNet.Application.Common.Security;
|
||||
using RecNet.Application.Profiles;
|
||||
using RecNet.Application.Profiles.Avatar;
|
||||
using AvatarEntity = RecNet.Domain.Profiles.Avatar;
|
||||
|
||||
namespace API.Controllers.Avatar.V1;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using API.Contracts.Profiles.Responses;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RecNet.Application.Profiles;
|
||||
using RecNet.Application.Profiles.Login;
|
||||
using LoginRequest = API.Contracts.Profiles.Requests.LoginRequest;
|
||||
|
||||
namespace API.Controllers.Profiles.V1;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RecNet.Application.Common.Security;
|
||||
using RecNet.Application.Profiles;
|
||||
using RecNet.Application.Profiles.Relationships;
|
||||
|
||||
namespace API.Controllers.Relationships.V1;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]/v1")]
|
||||
public class RelationshipsController(IRelationshipService relationshipService) : ControllerBase
|
||||
{
|
||||
[HttpGet("get")]
|
||||
public async Task<IReadOnlyList<RelationshipDTO>> GetRelationships(CancellationToken ct)
|
||||
{
|
||||
var profileId = User.GetProfileId();
|
||||
|
||||
return await relationshipService.GetRelationshipsAsync(profileId, ct);
|
||||
}
|
||||
|
||||
[HttpPost("update")]
|
||||
public async Task<ActionResult<RelationshipDTO>> UpdateRelationship(
|
||||
[FromBody] RelationshipDTO request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var profileId = User.GetProfileId();
|
||||
|
||||
return Ok(
|
||||
await relationshipService.UpdateRelationshipAsync
|
||||
(
|
||||
profileId: profileId,
|
||||
command: new UpdateRelationshipCommand(request.ProfileId, request.Muted, request.Ignored),
|
||||
ct: ct
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RecNet.Application.Common.Security;
|
||||
using RecNet.Application.Profiles;
|
||||
using RecNet.Application.Profiles.Settings;
|
||||
|
||||
namespace API.Controllers.Settings.V1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user