-
Notifications
You must be signed in to change notification settings - Fork 76
Лаб. 4 6411 Рыжова Алена #247
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
Conversation
…на возващение правильных пациентов
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.
- В апи не используется ни один из созданных
DbContext, а такжеInfrastructureнет в солюшене - В апи нет регистрации сервисов/репозиториев для взаимодействия с базой
- Нет
ServiceDefaultsпроекта - Проекта с генератором нет в солюшене
- Почему-то используются и NATS и gRPC (по заданию нужен только NATS если что)
- В качестве контракта (то что генератор должен будет отправлять через NATS) должна быть запись на прием
Сейчас солюшен не билдится, запустить ничего нельзя и вряд ли он когда вообще запускался
Нужно это привести хотя бы к состоянию когда это запускается и соответствует заданию
Я может не очевидную вещь скажу, но в этом репозитории есть пулл реквесты других студентов, списывать строчка в строчку конечно не надо, но хотя бы посмотреть как это примерно должно выглядеть можно же, хотя бы понять сколько проектов и что в них должно быть
Или можно посмотреть код в репозитории, который написал ваш преподаватель в качестве примера всех лабораторных
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.
- Нет NATS Nui
- Нет комментариев в сваггере
- Генератор не может подключится к NATS
- Нет сидирования базы данных из дата сидера
Я уже не смотрю код, пусть оно просто будет работать как надо по заданию
Это последнее ревью, так что прежде чем отправлять запрос на ревью, проверьте что все работает
| IDoctorService doctorService) : ControllerBase | ||
| { | ||
| [HttpGet] | ||
| public async Task<ActionResult<List<AppointmentDto>>> GetAppointments() |
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.
Падает с:
System.InvalidOperationException: Unable to resolve service for type 'Domain.Interfaces.IAppointmentService' while attempting to activate 'WebApi.Controllers.AppointmentsController'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ThrowHelperUnableToResolveService(Type type, Type requiredBy)
at lambda_method23(Closure, IServiceProvider, Object[])
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
|
|
||
| [ApiController] | ||
| [Route("api/[controller]")] | ||
| public class ContractsController : ControllerBase |
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.
Зачем нужен этот контроллер?
| [Route("api/[controller]")] | ||
| [Produces("application/json")] | ||
| [Consumes("application/json")] | ||
| public class DoctorsController( |
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.
В этом контроллере не хватает метод на добавление, удаление, изменение и получения всех сущностей
| [Route("api/[controller]")] | ||
| [Produces("application/json")] | ||
| [Consumes("application/json")] | ||
| public class PatientsController( |
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.
Как и в этом
| public interface INatsService | ||
| { | ||
| Task ConnectAsync(CancellationToken cancellationToken); | ||
| Task<bool> PublishContractAsync(AppointmentCreated appointment, CancellationToken cancellationToken); // Изменено | ||
| Task DisconnectAsync(); | ||
| bool IsConnected { get; } | ||
| } | ||
|
|
||
| public class NatsConfig | ||
| { | ||
| public string Url { get; set; } = "nats://localhost:4222"; | ||
| public string Subject { get; set; } = "appointments.created"; | ||
| public int RetryCount { get; set; } = 3; | ||
| public int RetryDelayMs { get; set; } = 1000; | ||
| public int TimeoutSeconds { get; set; } = 5; | ||
| } | ||
|
|
||
| public class NatsService : INatsService, IAsyncDisposable |
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.
Один файл - один класс
src/AppHost/Program.cs
Outdated
| var nats = builder.AddContainer("nats", "nats") | ||
| .WithArgs("--jetstream"); |
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.
Нужно использовать builder.AddNats
src/AppHost/Program.cs
Outdated
| var sql = builder.AddSqlServer("sqlserver") | ||
| .WithEnvironment("ACCEPT_EULA", "Y") | ||
| .WithEnvironment("SA_PASSWORD", "YourStrong!Passw0rd") | ||
| .AddDatabase("clinicdb"); | ||
|
|
||
| var nats = builder.AddContainer("nats", "nats") | ||
| .WithArgs("--jetstream"); | ||
|
|
||
| var api = builder.AddProject<Projects.WebApi>("webapi") | ||
| .WithReference(sql) | ||
| .WithEnvironment("NATS__Url", "nats://nats:4222") | ||
| .WithEnvironment("NATS__Subject", "appointments.created"); | ||
|
|
||
| var generator = builder.AddProject<Projects.DataGenerator>("datagenerator") | ||
| .WithEnvironment("NATS__Url", "nats://nats:4222") | ||
| .WithEnvironment("NATS__Subject", "appointments.created"); |
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.
Тут точно никакие сервисы не должны подождать другие сервисы? думаю как минимум api должен дождаться поднятия базы
ФИО: Рыжова Алена
Номер группы: 6411
Номер лабораторной: 3,4
Номер варианта: 17
Краткое описание предметной области: Поликлиника
Краткое описание добавленных фич: Реализована объектно-реляционная модель. Выполнены подключение к базе данных и настройка оркестрации. Реализован сервис генерации данных и его интеграция с сервером