changes
This commit is contained in:
32
Controllers/TreeController.cs
Normal file
32
Controllers/TreeController.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user