-
Notifications
You must be signed in to change notification settings - Fork 76
Лаб. 4 6412 Чуева Мария #262
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.
Это надо удалить
| IList<string> arrivalCity) => | ||
| new Faker<CreateFlightDto>() | ||
| .CustomInstantiator(f => new CreateFlightDto( | ||
| FlightCode: f.Random.String2(2, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") + f.Random.Number(100, 999), |
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.
Для подобной генерации нужно использовать faker.Random.Char('A', 'Z'), нет необходимости каждую генерацию создавать строку с алфавитом
| var modelId = configuration.GetSection("FlightGenerator:ModelFamilyId") | ||
| .Get<int[]>() ?? []; | ||
|
|
||
| var departureCity = configuration.GetSection("FlightGenerator:DepartureCity") | ||
| .Get<string[]>() ?? []; | ||
|
|
||
| var arrivalCity = configuration.GetSection("FlightGenerator:ArrivalCity") | ||
| .Get<string[]>() ?? []; | ||
|
|
||
| if (modelId.Length == 0 || departureCity.Length == 0 || arrivalCity.Length == 0) | ||
| return StatusCode(StatusCodes.Status500InternalServerError, "SeedModelIds is empty"); |
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.
Все эти данные принадлежат генератору, а не контроллеру. Необходимо перенести их в генератор и сделать статическими, чтобы не дергать конфигурацию на каждый вызов метода
|
Мне жаль, что такой разрыв по времени между поправками получился, каюсь... |
ФИО: Чуева Мария
Номер группы: 6412
Номер лабораторной: 4
Номер варианта: 53
Краткое описание предметной области: Авиакомпания
Краткое описание добавленных фич: С помощью брокера сообщений Apache Kafka реализован Kafka Producer с генератором случайных данных через Bogus и добавлен Kafka Consumer, который подписывается на топик и сохраняет полученные данные в базу данных.