Skip to content

Conversation

@ryzalena
Copy link

@ryzalena ryzalena commented Dec 23, 2025

ФИО: Рыжова Алена
Номер группы: 6411
Номер лабораторной: 3,4
Номер варианта: 17
Краткое описание предметной области: Поликлиника
Краткое описание добавленных фич: Реализована объектно-реляционная модель. Выполнены подключение к базе данных и настройка оркестрации. Реализован сервис генерации данных и его интеграция с сервером

@github-actions github-actions bot added In progress Код в процессе проверки Lab 4 Лабораторная №4. Инфраструктура labels Dec 23, 2025
@github-actions github-actions bot requested a review from danlla December 23, 2025 13:50
Copy link

@danlla danlla left a 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) должна быть запись на прием

Сейчас солюшен не билдится, запустить ничего нельзя и вряд ли он когда вообще запускался

Нужно это привести хотя бы к состоянию когда это запускается и соответствует заданию

Я может не очевидную вещь скажу, но в этом репозитории есть пулл реквесты других студентов, списывать строчка в строчку конечно не надо, но хотя бы посмотреть как это примерно должно выглядеть можно же, хотя бы понять сколько проектов и что в них должно быть
Или можно посмотреть код в репозитории, который написал ваш преподаватель в качестве примера всех лабораторных

@ryzalena ryzalena requested a review from danlla December 24, 2025 08:00
Copy link

@danlla danlla left a 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()
Copy link

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
Copy link

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(
Copy link

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(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как и в этом

Comment on lines 10 to 27
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Один файл - один класс

Comment on lines 10 to 11
var nats = builder.AddContainer("nats", "nats")
.WithArgs("--jetstream");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно использовать builder.AddNats

Comment on lines 5 to 20
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");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут точно никакие сервисы не должны подождать другие сервисы? думаю как минимум api должен дождаться поднятия базы

@ryzalena ryzalena requested a review from danlla December 26, 2025 04:59
@danlla danlla added Approved Лабораторная зачтена and removed In progress Код в процессе проверки labels Dec 26, 2025
@danlla danlla closed this Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Лабораторная зачтена Lab 4 Лабораторная №4. Инфраструктура

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants