45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Serilog;
|
|
using LCU.Library.Internal.FileOperationsModels.Models;
|
|
using LCU.Api.Internal.FileOperations.Services;
|
|
namespace LCU.Api.Internal.FileOperations.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class DynamicDirectoryController : ControllerBase
|
|
{
|
|
private readonly IDynamicDirectoryService _dynamicDirectoryService;
|
|
|
|
public DynamicDirectoryController(IDynamicDirectoryService dynamicDirectoryService)
|
|
{
|
|
_dynamicDirectoryService = dynamicDirectoryService;
|
|
}
|
|
|
|
[HttpPost("BuildDirectoryList")]
|
|
[ProducesResponseType(201)]
|
|
[ProducesResponseType(404)]
|
|
[ProducesResponseType(typeof(List<string>), 400)]
|
|
[ProducesResponseType(500)]
|
|
public IActionResult BuildDirectoryList([FromBody] DynamicDirectoryListRequest request)
|
|
{
|
|
try
|
|
{
|
|
var result = _dynamicDirectoryService.BuildDirectoryList(request);
|
|
if (result == null || !result.Any())
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, "Failure Build Dynamic Directory List");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
} |