Setpoint API #1

Merged
on.nemtina merged 10 commits from Setpoint into master 2024-11-25 10:33:36 +05:00
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 4fa00de88e - Show all commits

View File

@ -49,7 +49,7 @@ namespace Persistence.IntegrationTests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content);
Assert.NotEmpty(response.Content);
Assert.Equal(response.Content.FirstOrDefault()?.Key, setpointKey);
Assert.Equal(setpointKey, response.Content.FirstOrDefault()?.Key);
}
[Fact]
@ -87,7 +87,7 @@ namespace Persistence.IntegrationTests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content);
Assert.NotEmpty(response.Content);
Assert.Equal(response.Content.FirstOrDefault()?.Key, setpointKey);
Assert.Equal(setpointKey, response.Content.FirstOrDefault()?.Key);
}
[Fact]
@ -122,7 +122,7 @@ namespace Persistence.IntegrationTests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content);
Assert.NotEmpty(response.Content);
Assert.Equal(response.Content.FirstOrDefault().Value.FirstOrDefault()?.Key, setpointKey);
Assert.Equal(setpointKey, response.Content.FirstOrDefault()?.Key);
}
[Fact]

View File

@ -35,6 +35,7 @@ namespace Persistence.Repository.Repositories
.ToArrayAsync(token);
var filteredEntities = entities
.GroupBy(e => e.Key)
.Select(e => e.OrderBy(o => o.Created))
.Select(e => e.Where(e => e.Created <= historyMoment).Last());
var dtos = filteredEntities
.Select(e => e.Adapt<SetpointValueDto>());