Skip to content

Белякова Вероника Лаб. 1 Группа 6511#39

Open
Cat-sandwich wants to merge 1 commit intoitsecd:mainfrom
Cat-sandwich:main
Open

Белякова Вероника Лаб. 1 Группа 6511#39
Cat-sandwich wants to merge 1 commit intoitsecd:mainfrom
Cat-sandwich:main

Conversation

@Cat-sandwich
Copy link

ФИО: Белякова Вероника
Номер группы: 6511
Номер лабораторной: 1
Номер варианта: 2
Краткое описание предметной области: Сотрудник компании
Краткое описание добавленных фич: Создан класс по предметной области, написан генератор и сервис

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Mar 10, 2026
@github-actions github-actions bot requested a review from danlla March 10, 2026 17:02
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.

  • Нет Readme
  • Клиент находится отдельно от остальных проектов, которые лежат в папке Employee, лучше все проекты оставить в корне
  • При запуске aspire проекта открывается лишний браузер с клиентом, чтобы этого не происходило нужно задать "launchBrowser": false в launchsettings.json клиента

Comment on lines +54 to +57
private static DateOnly GenerateAdmissionDate(Faker f)
{
return DateOnly.FromDateTime(f.Date.Past(10));
}
Copy link

Choose a reason for hiding this comment

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

Как будто нет смысла выделять это в метод, можно в лямбде RuleFor написать этот код

А еще есть Date.PastDateOnly(10), который сразу вернут только дату

Comment on lines +43 to +49
private static string GeneratePosition(Faker f)
{
var level = f.PickRandom(_positionLevels.Keys.ToArray());
var profession = f.PickRandom(_professions);

return $"{level} {profession}";
}
Copy link

Choose a reason for hiding this comment

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

Этот метод возможно тоже не стоит выделять и написать все в RuleFor

Выделять стоит только большие участки кода


var start = employee.DateAdmission.ToDateTime(TimeOnly.MinValue);

var dismissal = f.Date.Between(start, DateTime.Now);
Copy link

Choose a reason for hiding this comment

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

Есть Date.BetweenDateOnly

/// Преднастроенный генератор
/// </summary>
private static readonly Faker<EmployeeModel> _faker = new Faker<EmployeeModel>("ru")
.RuleFor(e => e.Name, f => GenerateFullName(f))
Copy link

Choose a reason for hiding this comment

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

Тут можно попроще:

.RuleFor(e => e.Name, GenerateFullName)

Ниже аналогично


try
{
var expirationMinutes = _configuration.GetValue("CacheSettings:ExpirationMinutes", 5);
Copy link

Choose a reason for hiding this comment

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

Лучше один раз считать и сохранить в поле класса

Copy link

Choose a reason for hiding this comment

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

Этот файл можно удалить

@@ -0,0 +1,15 @@
var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("redis");
Copy link

Choose a reason for hiding this comment

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

Нужно добавить или .WithRedisInsight(), или .WithRedisCommander()


var redis = builder.AddRedis("redis");

var apiService = builder.AddProject<Projects.Employee_ApiService>("apiservice")
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 +27 to +31
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
Copy link

Choose a reason for hiding this comment

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

Если добавлять swagger, то нужно и добавить xml комментарии

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants