persistence/Persistence.API/Controllers/ChangeLogController.cs

81 lines
2.3 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Database.Model;
using Persistence.Models;
using Persistence.Repositories;
namespace Persistence.API.Controllers;
[ApiController]
[Authorize]
[Route("api/[controller]")]
public class ChangeLogController : ControllerBase, IChangeLogApi
{
private IChangeLogRepository repository;
public ChangeLogController(IChangeLogRepository repository)
{
this.repository = repository;
}
[HttpPost]
public async Task<ActionResult<int>> Add(
[FromRoute] Guid idDiscriminator,
ChangeLogDto dto,
CancellationToken token)
{
var userId = User.GetUserId<Guid>();
var result = await repository.InsertRange(userId, idDiscriminator, [dto], token);
return Ok(result);
}
[HttpPost("range")]
public Task<ActionResult<int>> AddRange(IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
[HttpDelete]
public Task<ActionResult<int>> Delete(int id, CancellationToken token)
{
throw new NotImplementedException();
}
[HttpDelete("range")]
public Task<ActionResult<int>> DeleteRange(IEnumerable<int> ids, CancellationToken token)
{
throw new NotImplementedException();
}
[HttpGet]
public Task<ActionResult<IEnumerable<IDictionary<string, object>>>> GetChangeLogCurrent(CancellationToken token)
{
throw new NotImplementedException();
}
[HttpGet("history")]
public Task<ActionResult<IEnumerable<ChangeLogDto>>> GetChangeLogForDate(DateTimeOffset historyMoment, CancellationToken token)
{
throw new NotImplementedException();
}
//[HttpGet("history")]
//public Task<ActionResult<IEnumerable<ChangeLogDto<IDictionary<string, object>>>>> GetChangeLogForDate(DateTimeOffset historyMoment, CancellationToken token)
//{
// throw new NotImplementedException();
//}
[HttpPut]
public Task<ActionResult<int>> Update(IDictionary<string, object> dto, CancellationToken token)
{
throw new NotImplementedException();
}
[HttpPut("range")]
public Task<ActionResult<int>> UpdateRange(IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
}