persistence/Persistence.API/Controllers/ChangeLogController.cs

81 lines
2.3 KiB
C#
Raw Normal View History

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;
}
2024-11-26 10:32:44 +05:00
[HttpPost]
public async Task<ActionResult<int>> Add(
[FromRoute] Guid idDiscriminator,
ChangeLogDto dto,
CancellationToken token)
{
2024-11-26 10:32:44 +05:00
var userId = User.GetUserId<Guid>();
var result = await repository.InsertRange(userId, idDiscriminator, [dto], token);
2024-11-26 10:32:44 +05:00
return Ok(result);
}
2024-11-26 10:32:44 +05:00
[HttpPost("range")]
public Task<ActionResult<int>> AddRange(IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[HttpDelete]
public Task<ActionResult<int>> Delete(int id, CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[HttpDelete("range")]
public Task<ActionResult<int>> DeleteRange(IEnumerable<int> ids, CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[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();
//}
2024-11-26 10:32:44 +05:00
[HttpPut]
public Task<ActionResult<int>> Update(IDictionary<string, object> dto, CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[HttpPut("range")]
public Task<ActionResult<int>> UpdateRange(IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
}