Update doc and todo (#4)

* Updade doc

* Updade doc
This commit is contained in:
Oda
2024-07-20 21:33:50 +07:00
committed by GitHub
parent a43e560d3a
commit 743d04e6c5
12 changed files with 483 additions and 71 deletions

View File

@@ -5,6 +5,11 @@ using Microsoft.AspNetCore.Mvc;
namespace Managing.Api.Controllers;
/// <summary>
/// Controller for managing money management strategies.
/// Provides endpoints for creating, retrieving, updating, and deleting money management strategies.
/// Requires authorization for access and produces JSON responses.
/// </summary>
[ApiController]
[Authorize]
[Route("[controller]")]
@@ -12,17 +17,31 @@ namespace Managing.Api.Controllers;
public class MoneyManagementController : ControllerBase
{
private readonly IMoneyManagementService _moneyManagementService;
/// <summary>
/// Initializes a new instance of the <see cref="MoneyManagementController"/> class.
/// </summary>
/// <param name="moneyManagementService">The service for managing money management strategies.</param>
public MoneyManagementController(IMoneyManagementService moneyManagementService)
{
_moneyManagementService = moneyManagementService;
}
/// <summary>
/// Creates a new money management strategy or updates an existing one.
/// </summary>
/// <param name="moneyManagement">The money management strategy to create or update.</param>
/// <returns>The created or updated money management strategy.</returns>
[HttpPost]
public async Task<ActionResult<MoneyManagement>> PostMoneyManagement(MoneyManagement moneyManagement)
{
return Ok(await _moneyManagementService.CreateOrUpdateMoneyManagement(moneyManagement));
}
/// <summary>
/// Retrieves all money management strategies.
/// </summary>
/// <returns>A list of money management strategies.</returns>
[HttpGet]
[Route("moneymanagements")]
public ActionResult<IEnumerable<MoneyManagement>> GetMoneyManagements()
@@ -30,15 +49,25 @@ public class MoneyManagementController : ControllerBase
return Ok(_moneyManagementService.GetMoneyMangements());
}
/// <summary>
/// Retrieves a specific money management strategy by name.
/// </summary>
/// <param name="name">The name of the money management strategy to retrieve.</param>
/// <returns>The requested money management strategy if found.</returns>
[HttpGet]
public ActionResult<MoneyManagement> GetMoneyManagement(string name)
{
return Ok(_moneyManagementService.GetMoneyMangement(name));
}
/// <summary>
/// Deletes a specific money management strategy by name.
/// </summary>
/// <param name="name">The name of the money management strategy to delete.</param>
/// <returns>An ActionResult indicating the outcome of the operation.</returns>
[HttpDelete]
public ActionResult DeleteMoneyManagement(string name)
{
return Ok(_moneyManagementService.DeleteMoneyManagement(name));
}
}
}