Skip to content

Елагин Денис 6513 Лаб. 1#12

Open
Donistr wants to merge 15 commits intoitsecd:mainfrom
Donistr:main
Open

Елагин Денис 6513 Лаб. 1#12
Donistr wants to merge 15 commits intoitsecd:mainfrom
Donistr:main

Conversation

@Donistr
Copy link

@Donistr Donistr commented Feb 22, 2026

ФИО: Елагин Денис
Номер группы: 6513
Номер лабораторной: 1
Номер варианта: 38
Краткое описание предметной области: Объект жилого строительства
Краткое описание добавленных фич: Добавлен сервис генерации данных на основе Bogus, кеширование с использованием Redis, структурное логирование для сервиса генерации данных, оркестрация Aspire.

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Feb 22, 2026
@github-actions github-actions bot requested a review from alxmcs February 22, 2026 15:53
namespace Generator.Controller;

/// <summary>
/// Контроллер для объектов жилого строительства.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Здесь      и далее по коду -
Зачем      отступы?

Copy link
Author

Choose a reason for hiding this comment

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

в ide нажал кнопку code cleanup на всём проекте и они появились

}

logger.LogInformation("Getting residential building with Id={id}.", id);
ResidentialBuildingDto result = await residentialBuildingService.GetByIdAsync(id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Когда-нибудь слышал про var?

Suggested change
ResidentialBuildingDto result = await residentialBuildingService.GetByIdAsync(id);
var result = await residentialBuildingService.GetByIdAsync(id);

Copy link
Author

Choose a reason for hiding this comment

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

в ide нажал кнопку code cleanup на всём проекте var поменялись на типы

Copy link
Collaborator

Choose a reason for hiding this comment

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

Могу только посоветовать сконфигурировать профайл клинапа вменяемым образом 🤷‍♂️

{
logger.LogInformation("Generating Residential Building for Id={id}", id);

ResidentialBuildingDto? generatedObject = _faker!.Generate();
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 82 to 89
logger.LogInformation(
"Residential building generated: Id={Id}, Address='{Address}', PropertyType='{PropertyType}', " +
"BuildYear={BuildYear}, TotalArea={TotalArea}, LivingArea={LivingArea}, Floor={Floor}, " +
"TotalFloors={TotalFloors}, CadastralNumber='{CadastralNumber}', CadastralValue={CadastralValue}",
generatedObject.Id, generatedObject.Address, generatedObject.PropertyType, generatedObject.BuildYear,
generatedObject.TotalArea, generatedObject.LivingArea, generatedObject.Floor, generatedObject.TotalFloors,
generatedObject.CadastralNumber, generatedObject.CadastralValue
);
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 81 to 90
/// <summary>
/// Создаёт настройки кэша - задаёт время жизни кэша.
/// </summary>
private DistributedCacheEntryOptions CreateCacheOptions()
{
return new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = _cacheExpirationTimeMinutes
};
}
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 29 to 31
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
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 1 to 4
using System.Text.Json;
using Generator.DTO;
using Generator.Generator;
using Microsoft.Extensions.Caching.Distributed;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Запустить клинап

Copy link
Author

Choose a reason for hiding this comment

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

у меня клинап с этим ничего не делает, может в Rider клинап неправильный какой-то

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 19
builder.Host.UseSerilog((hostingContext, services, loggerConfiguration) =>
{
loggerConfiguration
.MinimumLevel.Information()
.ReadFrom.Configuration(hostingContext.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.WriteTo.Console(
new CompactJsonFormatter()
);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Класс, серилог ты добавил, а синк в опентелеметрию - нет
В итоге в консоль (которая бесполезна) у тебя логи падают:

Image

А в структурных логах пусто:

Image

Либо добавляй недостающий синк, либо сноси серилог 🤷‍♂️

@Donistr Donistr requested a review from alxmcs February 25, 2026 07:02
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.

Пара мелочей

Comment on lines 1 to 4
using System.Text.Json;
using Generator.DTO;
using Generator.Generator;
using Microsoft.Extensions.Caching.Distributed;
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 17 to 18
[HttpGet("{id:int}")]
public async Task<ActionResult<ResidentialBuildingDto>> GetResidentialBuilding(int id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Атрибутов с возвращаемыми типами не хватает

@Donistr Donistr requested a review from alxmcs February 26, 2026 08:57
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