CodeLiturgy.Dashboard/BlueWest.Api/Controllers/FinanceController.cs

82 lines
2.4 KiB
C#

using System;
using BlueWest.Domain;
using BlueWest.Data;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace BlueWest.WebApi.Controllers;
/// <summary>
/// The controller responsible to fetch currency data
/// </summary>
[ApiController]
[Route("[controller]")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[Authorize(AuthenticationSchemes = CookieAuthenticationDefaults.AuthenticationScheme)]
//[Authorize(Roles = "Administrator")]
[EnableCors(Constants.CorsPolicyName)]
[ServiceFilter(typeof(SessionAuthorizationFilter))]
public class FinanceController : ControllerBase
{
private readonly FinanceDbContext _dbContext;
/// <summary>
/// Finance Controller Api Controller
/// </summary>
/// <param name="dbContext">The finance database context</param>
public FinanceController(FinanceDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Returns a transaction by the provided id
/// </summary>
/// <param name="userId"></param>
/// <param name="transactionId"></param>
/// <returns></returns>
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[HttpGet("{userId}/transactions/{transactionId}")]
public ActionResult GetTransactionsById(int userId, TimeSpan transactionId)
{
return new NotFoundResult();
}
/// <summary>
/// Posts a finance transaction
/// </summary>
/// <param name="userId"></param>
/// <param name="financeTransaction"></param>
/// <returns></returns>
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[HttpPost("{userId}/transactions")]
public ActionResult PostTransaction(int userId, FinanceOpCreate financeTransaction)
{
return new BadRequestResult();
}
/// <summary>
/// Get Transactions
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[HttpGet("{userId}/transactions")]
public ActionResult GetTransactions(int userId)
{
return Ok();
}
}