Skip to content

Казаков Андрей Лаб. 1 Группа 6513#15

Open
Gironape wants to merge 11 commits intoitsecd:mainfrom
Gironape:main
Open

Казаков Андрей Лаб. 1 Группа 6513#15
Gironape wants to merge 11 commits intoitsecd:mainfrom
Gironape:main

Conversation

@Gironape
Copy link

ФИО: Казаков Андрей Дмитриевич
Номер группы: 6513
Номер лабораторной: 1
Номер варианта: 43
Краткое описание предметной области: Сотрудник компании
Краткое описание добавленных фич: Добавлен сервис генерации с кэшированием, структурное логирование и оркестрация

Стыдно должно быть, но пока рано
Не судите строго, я pycharman
С каждой строчкой я все дальше от бога
@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Feb 24, 2026
@github-actions github-actions bot requested a review from alxmcs February 24, 2026 20:58
Copy link
Collaborator

@alxmcs alxmcs left a comment

Choose a reason for hiding this comment

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

Общее замечание: у тебя по причине, которую ты должен обнаружить сам, теряется идентификатор при вызове эндпоинта апи
Image

Comment on lines 14 to 21
private readonly IEmployeeService _employeeService;
private readonly ILogger<EmployeeController> _logger;

public EmployeeController(IEmployeeService employeeService, ILogger<EmployeeController> logger)
{
_employeeService = employeeService;
_logger = logger;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Использовать праймари конструктор

Comment on lines 9 to 10
/// </summary>
[ApiController]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Добавить параметры праймари конструктора в саммари

Comment on lines 30 to 32
_logger.LogInformation("Запрос на получение сотрудника с seed: {Seed}", seed);
var employee = await _employeeService.GetEmployeeAsync(seed, cancellationToken);
return Ok(employee);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Точно не надо какую-нибудь обработку исключений соорудить?

Comment on lines 14 to 17
public EmployeeGenerator(ILogger<EmployeeGenerator> logger)
{
_logger = logger;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

6 дотнет вышел в 2021 году, в какой временной петле ты существуешь без праймари конструкторов?

Comment on lines 29 to 78
var gender = faker.PickRandom<Bogus.DataSets.Name.Gender>();
var firstName = faker.Name.FirstName(gender);
var lastName = faker.Name.LastName(gender);
var patronymicBase = faker.Name.FirstName(Name.Gender.Male);
var patronymic = gender == Name.Gender.Male
? patronymicBase + "ович"
: patronymicBase + "овна";
var fullName = $"{lastName} {firstName} {patronymic}";

var profession = faker.PickRandom(_professions);
var suffix = faker.PickRandom(_suffixes);
var position = $"{profession} {suffix}".Trim();

var department = faker.Commerce.Department();

var hireDate = DateOnly.FromDateTime(faker.Date.Past(10).ToUniversalTime());

var salary = suffix switch
{
"Junior" => faker.Random.Decimal(30000, 60000),
"Middle" => faker.Random.Decimal(60000, 100000),
"Senior" => faker.Random.Decimal(100000, 180000),
_ => faker.Random.Decimal(40000, 80000)
};
salary = Math.Round(salary, 2);

var email = faker.Internet.Email(firstName, lastName);
var phone = faker.Phone.PhoneNumber("+7(###)###-##-##");
var isTerminated = faker.Random.Bool(0.1f);

DateOnly? terminationDate = null;
if (isTerminated)
{
var termDate = faker.Date.Between(hireDate.ToDateTime(TimeOnly.MinValue), DateTime.Now);
terminationDate = DateOnly.FromDateTime(termDate);
}

var employee = new Employee
{
Id = faker.Random.Int(1, 100000),
FullName = fullName,
Position = position,
Department = department,
HireDate = hireDate,
Salary = salary,
Email = email,
Phone = phone,
IsTerminated = isTerminated,
TerminationDate = terminationDate
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Переписать все через .RuleFor()
Выйдет раза в три меньше кода, кстати

.WithEnvironment("REDIS_HOSTS", "local:redis:6379")
.WithReference(redis)
.WaitFor(redis)
.WithEndpoint(port: 8081, targetPort: 8081);
Copy link
Collaborator

Choose a reason for hiding this comment

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

RedisCommander доступен через интеграцию самого редиса

var redis = builder.AddRedis("redis").WithRedisCommander("redis-commander");

<PackageReference Include="Aspire.Hosting" Version="13.1.1" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.1.1" />
<PackageReference Include="Aspire.Hosting.Redis" Version="13.1.1" />
<PackageReference Include="Aspire.StackExchange.Redis.DistributedCaching" Version="13.1.1" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Рекомендация:
2. Подними версию sdk аспаер до последней предшествующей 13
3. Опусти версию библиотек до версии аспаер
Так у тебя точно ничего не отвалится

<ItemGroup>
<ProjectReference Include="..\Client.Wasm\Client.Wasm.csproj" />
<ProjectReference Include="..\CompanyEmployee.Api\CompanyEmployee.Api.csproj" />
<ProjectReference Include="..\CompanyEmployee.Domain\CompanyEmployee.Domain.csproj" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ты каким образом собрался оркестрировать класс либу?
Не надо пихать везде референсы на все остальное просто на всякий случай

Comment on lines 14 to 17
public string FullName { get; set; } = string.Empty;


/// <summary>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Пожалуйста






не надо щели
Код твоего решения и так меня впечатляет без необходимости накручивать счетчик измененных строк

README.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Вообще, в ридми было бы неплохо добавить инфу о своем проекте вместо того, чтобы отправлять файл в могилу

@alxmcs alxmcs added the Stolen Вы уличены в краже кода. Вы покрыли себя несмываемым позором label Feb 26, 2026
Сделал исправления
Пожалуйста, не ругайтесь на C#-инвалида (на меня)
@Gironape Gironape requested a review from alxmcs February 26, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование Stolen Вы уличены в краже кода. Вы покрыли себя несмываемым позором

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants