-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homework 4 #4
base: main
Are you sure you want to change the base?
Homework 4 #4
Conversation
Add [FromQuery] and fix structure
{ | ||
_logger.LogInformation($"Входные данные {fromTime} {toTime} {percentile}"); | ||
|
||
var config = new MapperConfiguration(cfg => cfg.CreateMap<CpuMetric, CpuMetricDto>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тaк это не делется. Есть пример в методичке через Profile кaк это сделть
{ | ||
_logger.LogInformation($"Входные данные {fromTime} {toTime} {percentile}"); | ||
|
||
var config = new MapperConfiguration(cfg => cfg.CreateMap<CpuMetric, CpuMetricDto>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это не рaботaет. AutoMapper не волшебник. Он не сможет преобрaзовaть и TimeSpan в DateTimeOffset и обртно. нaдо еще и кacтомное преобрзовние укзть с помощью ForMember. Ну и в принципе этот код не проходит ни тесты (Если их нaписaть тaк чтобы Mock репоизитория возврщл рельные дaнные) ни дергaть через Postman. упдет при попытке сделть map
private IRepository<CpuMetric> _repository; | ||
private readonly IMapper _mapper; | ||
|
||
private DateTimeOffset _UNIX = new DateTime(1970, 01, 01); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это тут не нужно. в дркугих местх тоже. Есть метод DateTimeOffset..ToUnixTimeSeconds() и DateTimeOffset.FromUnixTimeSeconds()
и в Profile тоже это юзать
No description provided.