Правки по результатам ревью
This commit is contained in:
parent
f647afcd53
commit
4ccbe4361a
@ -37,7 +37,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
public async Task<IActionResult> AddRange(
|
||||
[FromRoute] Guid idDiscriminator,
|
||||
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var userId = User.GetUserId<Guid>();
|
||||
var result = await repository.AddRange(userId, idDiscriminator, dtos, token);
|
||||
@ -47,7 +47,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
|
||||
[HttpDelete]
|
||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Delete(Guid id, CancellationToken token = default)
|
||||
public async Task<IActionResult> Delete(Guid id, CancellationToken token)
|
||||
{
|
||||
var userId = User.GetUserId<Guid>();
|
||||
var result = await repository.MarkAsDeleted(userId, [id], token);
|
||||
@ -57,7 +57,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
|
||||
[HttpDelete("range")]
|
||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteRange(IEnumerable<Guid> ids, CancellationToken token = default)
|
||||
public async Task<IActionResult> DeleteRange(IEnumerable<Guid> ids, CancellationToken token)
|
||||
{
|
||||
var userId = User.GetUserId<Guid>();
|
||||
var result = await repository.MarkAsDeleted(userId, ids, token);
|
||||
@ -70,7 +70,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
public async Task<IActionResult> ClearAndAddRange(
|
||||
[FromRoute] Guid idDiscriminator,
|
||||
[FromBody] IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var userId = User.GetUserId<Guid>();
|
||||
var result = await repository.ClearAndAddRange(userId, idDiscriminator, dtos, token);
|
||||
@ -81,7 +81,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Update(
|
||||
DataWithWellDepthAndSectionDto dto,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var userId = User.GetUserId<Guid>();
|
||||
var result = await repository.UpdateRange(userId, [dto], token);
|
||||
@ -93,7 +93,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
[ProducesResponseType(typeof(int), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateRange(
|
||||
IEnumerable<DataWithWellDepthAndSectionDto> dtos,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var userId = User.GetUserId<Guid>();
|
||||
var result = await repository.UpdateRange(userId, dtos, token);
|
||||
@ -107,7 +107,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
[FromRoute] Guid idDiscriminator,
|
||||
[FromQuery] SectionPartRequest filterRequest,
|
||||
[FromQuery] PaginationRequest paginationRequest,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var moment = new DateTimeOffset(3000, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
||||
var result = await repository.GetByDate(idDiscriminator, moment, filterRequest, paginationRequest, token);
|
||||
@ -122,7 +122,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
DateTimeOffset moment,
|
||||
[FromQuery] SectionPartRequest filterRequest,
|
||||
[FromQuery] PaginationRequest paginationRequest,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var result = await repository.GetByDate(idDiscriminator, moment, filterRequest, paginationRequest, token);
|
||||
|
||||
@ -131,11 +131,12 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
|
||||
[HttpGet("history/{idDiscriminator}")]
|
||||
[ProducesResponseType(typeof(IEnumerable<ChangeLogDto>), (int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||
public async Task<IActionResult> GetChangeLogForDate(
|
||||
[FromRoute] Guid idDiscriminator,
|
||||
DateTimeOffset dateBegin,
|
||||
DateTimeOffset dateEnd,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var result = await repository.GetChangeLogForInterval(idDiscriminator, dateBegin, dateEnd, token);
|
||||
|
||||
@ -144,7 +145,8 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
|
||||
[HttpGet("datesChange/{idDiscriminator}")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DateOnly>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDatesChange([FromRoute] Guid idDiscriminator, CancellationToken token = default)
|
||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||
public async Task<IActionResult> GetDatesChange([FromRoute] Guid idDiscriminator, CancellationToken token)
|
||||
{
|
||||
var result = await repository.GetDatesChange(idDiscriminator, token);
|
||||
|
||||
@ -153,6 +155,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
|
||||
[HttpGet("part/{idDiscriminator}")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DataWithWellDepthAndSectionDto>), (int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||
public async Task<IActionResult> GetPart([FromRoute] Guid idDiscriminator, DateTimeOffset dateBegin, int take = 86400, CancellationToken token = default)
|
||||
{
|
||||
var result = await repository.GetGtDate(idDiscriminator, dateBegin, token);
|
||||
@ -163,7 +166,7 @@ public class ChangeLogController : ControllerBase, IChangeLogApi
|
||||
[HttpGet("datesRange/{idDiscriminator}")]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||
public async Task<IActionResult> GetDatesRangeAsync([FromRoute] Guid idDiscriminator, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetDatesRangeAsync([FromRoute] Guid idDiscriminator, CancellationToken token)
|
||||
{
|
||||
var result = await repository.GetDatesRange(idDiscriminator, token);
|
||||
|
||||
|
@ -67,12 +67,14 @@ public static class QueryBuilders
|
||||
.Take(request.Take)
|
||||
.ToArrayAsync(token);
|
||||
|
||||
var count = await query.CountAsync(token);
|
||||
var items = entities.Select(Convert);
|
||||
var result = new PaginationContainer<TDto>
|
||||
{
|
||||
Skip = request.Skip,
|
||||
Take = request.Take,
|
||||
Items = entities.Select(Convert),
|
||||
Count = await query.CountAsync(token)
|
||||
Items = items,
|
||||
Count = count
|
||||
};
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user