This commit is contained in:
2026-05-28 16:16:44 +03:30
parent db03b59cc8
commit 6101d25a7b
3 changed files with 110 additions and 13 deletions
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -8,6 +9,7 @@ using Microsoft.Extensions.Logging;
using xCommons.Configurations;
using xCommons.Extensions;
using xCommons.Providers;
using xDataService.Models;
using xExceptions.Constants;
using xFileService.Interfaces;
using xFileService.Models.Dtos;
@@ -217,6 +219,54 @@ namespace xFileService.Controllers
return result;
}
}
/// <summary>
/// Retrieve References of Specified Itemfor providedFor ...
/// </summary>
/// <param name="id"></param>
/// <param name="providedFor"></param>
/// <param name="cancellationToken"></param>
/// <typeparam name="TReferenceKey"></typeparam>
/// <returns></returns>
[HttpGet("{id}/References")]
public virtual async Task<ActionResult<IEnumerable<XReference<string>>>> GetReferences(
[FromRoute] Guid id,
[FromQuery] string providedFor,
CancellationToken cancellationToken = default
)
{
//
try
{
//
// Validate ...
if (!ModelState.IsValid)
{
XException.InvalidArgs.Throw();
}
await ValidationProvider
.GroupValidationBuilder()
.AddNotNull(id)
.AddNotEmpty(providedFor)
.ValidateGroupAsync();
//
var result = await provider.GetReferences(
id: id,
providedFor: providedFor,
cancellationToken: cancellationToken
);
//
return Ok(result.ToDynamicObject());
}
catch (Exception ex)
{
//
var result = GetExceptionActionResult(ex);
return result;
}
}
#endregion
}
}