32 lines
966 B
C#
32 lines
966 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using public_valetax.DTOs;
|
|
using public_valetax.Repositories;
|
|
|
|
namespace public_valetax.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("api.[controller]")]
|
|
public class TreeController(ITreeRepository _treeRepository) : ControllerBase
|
|
{
|
|
[HttpPost("get")]
|
|
public async Task<ActionResult<MNode>> Get([FromQuery] string treeName)
|
|
{
|
|
var tree = await _treeRepository.GetTreeStructureAsync(treeName);
|
|
|
|
// If tree doesn't exist, create it
|
|
if (tree == null)
|
|
{
|
|
// Create the tree (implementation would depend on your requirements)
|
|
// For now, we'll just return an empty structure
|
|
tree = new MNode
|
|
{
|
|
Id = 0,
|
|
Name = treeName,
|
|
Children = []
|
|
};
|
|
}
|
|
|
|
return Ok(tree);
|
|
}
|
|
}
|
|
} |