persistence/Persistence.API/Controllers/ChangeLogController.cs

73 lines
2.0 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]")]
2024-11-26 10:32:44 +05:00
public class ChangeLogController<TDto> : ControllerBase, IChangeLogApi<TDto, ChangeLogDto<TDto>>
where TDto : class, IChangeLogDto, new()
{
2024-11-26 10:32:44 +05:00
private IChangeLogRepository<TDto, ChangeLogDto<TDto>> repository;
2024-11-26 10:32:44 +05:00
public ChangeLogController(IChangeLogRepository<TDto, ChangeLogDto<TDto>> repository)
{
this.repository = repository;
}
2024-11-26 10:32:44 +05:00
[HttpPost]
public async Task<ActionResult<int>> Add(TDto dto, CancellationToken token)
{
2024-11-26 10:32:44 +05:00
var userId = User.GetUserId<Guid>();
var result = await repository.InsertRange(userId, [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<TDto> 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<TDto>>> GetChangeLogCurrent(CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[HttpGet("history")]
public Task<ActionResult<IEnumerable<ChangeLogDto<TDto>>>> GetChangeLogForDate(DateTimeOffset historyMoment, CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[HttpPut]
public Task<ActionResult<int>> Update(TDto dto, CancellationToken token)
{
throw new NotImplementedException();
}
2024-11-26 10:32:44 +05:00
[HttpPut("range")]
public Task<ActionResult<int>> UpdateRange(IEnumerable<TDto> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
}