Skip to content

Абанин Иван Лаб. 1 Группа 6512#56

Open
UselessMiva wants to merge 1 commit intoitsecd:mainfrom
UselessMiva:main
Open

Абанин Иван Лаб. 1 Группа 6512#56
UselessMiva wants to merge 1 commit intoitsecd:mainfrom
UselessMiva:main

Conversation

@UselessMiva
Copy link

ФИО: Абанин Иван
Номер группы: 6512
Номер лабораторной: 1
Номер варианта: 19
Краткое описание предметной области: «Объект жилого строительства»
Краткое описание добавленных фич: Добавлена модель данных, добавлен сервис генерации, сделан endpoint, добавлен кеш, оркестратор

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Mar 14, 2026
@github-actions github-actions bot requested a review from Gwymlas March 14, 2026 22:26
/// <param name="cancellationToken">Токен отмены операции</param>
/// <returns>Объект жилого строительства</returns>
[HttpGet]
public async Task<ActionResult<ResidentialPropertyEntity>> GetById([FromQuery] int id, CancellationToken cancellationToken)
Copy link

Choose a reason for hiding this comment

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

Добавить атрибут ProducesResponseType


public ResidentialPropertyGenerator()
{
var propertyTypes = new[] { "Квартира", "ИЖС", "Апартаменты", "Офис", "Коммерческая" };
Copy link

Choose a reason for hiding this comment

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

Вынести в private static readonly поле

public ResidentialPropertyGenerator()
{
var propertyTypes = new[] { "Квартира", "ИЖС", "Апартаменты", "Офис", "Коммерческая" };
var currentYear = DateTime.Now.Year;
Copy link

Choose a reason for hiding this comment

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

Может лучше вычислять в момент генерации

.RuleFor(p => p.Floor, (f, p) =>
p.PropertyType == "ИЖС" ? null : f.Random.Number(1, p.TotalFloors))
.RuleFor(p => p.CadastralNumber, f =>
$"{f.Random.Number(1, 99):D2}.{f.Random.Number(1, 99):D2}.{f.Random.Number(1, 99):D2}.{f.Random.Number(1, 999999):D6}.{f.Random.Number(1, 9999):D4}")
Copy link

Choose a reason for hiding this comment

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

Есть Random.ReplaceNumbers

@@ -0,0 +1,92 @@
using Microsoft.Extensions.Caching.Distributed;
using ResidentialProperty.Api.Services.ResidentialPropertyGeneratorService;
Copy link

Choose a reason for hiding this comment

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

Неиспользуемый using

/// <summary>
/// Сервис получения объекта жилого строительства: сначала ищет в кэше, при промахе — генерирует новый и сохраняет
/// </summary>
public class ResidentialPropertyGeneratorService(
Copy link

Choose a reason for hiding this comment

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

Работу с кэшем выделить либо в отдельные методы, либо в отдельную службу


// Добавляем клиентский проект с ссылкой на API
builder.AddProject<Projects.Client_Wasm>("client-wasm")
.WithReference(api)
Copy link

Choose a reason for hiding this comment

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

Не нужен .WithReference(api)

@@ -0,0 +1,20 @@
<Project Sdk="Aspire.AppHost.Sdk/13.1.0">
Copy link

Choose a reason for hiding this comment

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

До этого по коду использовалась версия 9.5.2, ее и оставим. Тут и ниже подправить

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