-
Notifications
You must be signed in to change notification settings - Fork 76
Лаб. 3 6413 Зюзин Егор #228
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
This reverts commit 2a917f8.
…moved to subjects folder)
…nd add some comments
…data (for good results)
… make class DataSeed static class
commit 17: add PolyclinicTests.yml - action for my tests
…ary and remove some from Tests.csproj
… controller-level now can get response about invalid api request
…ger, i added a doctor 'name')
…nd get it in swagger. lab3
DmitryKrakhmalev
left a comment
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.
| { | ||
| private readonly Mock<IRepository<Appointment, int>> _mockAppointmentRepository; | ||
| private readonly Mock<IRepository<Patient, int>> _mockPatientRepository; | ||
| private readonly IAnalyticsService _analyticsService; |
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.
Если вы в конструкторе создаете AnalyticsService то и тут тип лучше прописать AnalyticsService вместо интерфейса.
| public class AnalyticsServiceTests | ||
| { | ||
| private readonly Mock<IRepository<Appointment, int>> _mockAppointmentRepository; | ||
| private readonly Mock<IRepository<Patient, int>> _mockPatientRepository; |
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.
Не используется, можно убрать.
| using Polyclinic.Contracts.Dto; | ||
| using Xunit; | ||
|
|
||
| namespace Polyclinic.Tests.API; |
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 переименовать в PascalCase. Не забыть про неймспейсы.
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
| using Polyclinic.Domain.Subjects; | ||
|
|
||
| namespace Polyclinic.Infrastructure.PostgreSQL.Configurations; |
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.
Папку PostgreSQL переименовать в PascalCase. Не забыть про неймспейсы.
| @@ -0,0 +1,185 @@ | |||
| using System; | |||
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.
Добавить первой строкой // <auto-generated />
| /// </summary> | ||
| public List<Patient> ReadAll() | ||
| { | ||
| return context.Patients.ToList(); |
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 List<Specialization> ReadAll() | ||
| { | ||
| return context.Specializations.ToList(); |
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.
и тут
| [Fact] | ||
| public void GetPatientsByDoctor_NoPatients_ReturnsNotFound() | ||
| { | ||
| _mockAnalyticsService.Setup(service => service.GetPatientsByDoctor(999)).Returns(new List<PatientDto>()); |
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.
| _mockAnalyticsService.Setup(service => service.GetPatientsByDoctor(999)).Returns(new List<PatientDto>()); | |
| _mockAnalyticsService.Setup(service => service.GetPatientsByDoctor(999)).Returns([]); |
|
|
||
| var patients = analyticsService.GetPatientsByDoctor(id); | ||
|
|
||
| if (patients == null || !patients.Any()) |
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.
| if (patients == null || !patients.Any()) | |
| if (patients == null || patients.Count == 0) |
|
|
||
| public class PolyclinicDbContext : DbContext | ||
| { | ||
| public PolyclinicDbContext(DbContextOptions<PolyclinicDbContext> options) |
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.
primary constructor
…c. rename to pascalcase namespace.
DmitryKrakhmalev
left a comment
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.
Обратите внимание на замечания выше. Я не увидел чтобы они были устранены. Также добавил новые замечания.
Вам необходимо устранить все замечание, а главное:
- Использовать Aspire;
- При работе с базой данных необходимо использовать асинхронные методы. Переделайте репозитории.
Polyclinic/Polyclinic.API.Host/Controllers/AnalyticsController.cs
Outdated
Show resolved
Hide resolved
Polyclinic/Polyclinic.API.Host/Controllers/AnalyticsController.cs
Outdated
Show resolved
Hide resolved
Polyclinic/Polyclinic.Infrastructure.PostgreSQL/Repository/PostgresPatientRepository.cs
Outdated
Show resolved
Hide resolved
| /// </summary> | ||
| public int Create(Patient entity) | ||
| { | ||
| context.Patients.Add(entity); |
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.
Работать нужно с асинхронными методами. Переделать все методы репозиториев на асинхронные
Polyclinic/Polyclinic.Infrastructure.PostgreSQL/Repository/PostgresSpecializationRepository.cs
Outdated
Show resolved
Hide resolved
| private readonly Mock<IRepository<Patient, int>> _mockPatientRepository; | ||
| private readonly Mock<IRepository<Appointment, int>> _mockAppointmentRepository; | ||
| private readonly PolyclinicDbContext _dbContext; | ||
| private readonly IPatientService _patientService; |
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.
Замечание не устранено.
|
Я не вижу запроса не Review. 4 PR буду принимать только когда по этому будут устранены все замечания. |
DmitryKrakhmalev
left a comment
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.
Работу засчитываю. Так как некоторые замечания не были устранены (главное из них использование асинхронных методов), оценка -1 балл.

ФИО: Зюзин Егор
Номер группы: 6413
Номер лабораторной: 3
Номер варианта: 67
Краткое описание предметной области: Поликлиника
Краткое описание добавленных фич: «ORM» - Реализовал объектно-реляционную модель. Подключился к базе данных PostgreSQL, проект полностью освободился от inmemory инфраструктуры.