Skip to content

Куненков Иван Лаб. 1 Группа 6511#3

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

Куненков Иван Лаб. 1 Группа 6511#3
razzzenya wants to merge 11 commits intoitsecd:mainfrom
razzzenya:main

Conversation

@razzzenya
Copy link

ФИО: Куненков Иван
Номер группы: 6511
Номер лабораторной: 1
Номер варианта: 9
Краткое описание предметной области: Кредитные заявки
Краткое описание добавленных фич: Добавлен сервис генерации и кеширование через redis

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Feb 16, 2026
@github-actions github-actions bot requested a review from danlla February 16, 2026 13:57
@razzzenya razzzenya requested a review from danlla February 18, 2026 12:09
<PackageReference Include="Aspire.StackExchange.Redis" Version="9.5.2" />
<PackageReference Include="Bogus" Version="35.6.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.24" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.24" />
Copy link

Choose a reason for hiding this comment

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

Скорее всего использование Aspire.StackExchange.Redis.DistributedCaching будет лучше

Comment on lines 29 to 48
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Microsoft.OpenApi.OpenApiInfo
{
Title = "CreditApp API"
});

var xmlFilename = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFilename);
if (File.Exists(xmlPath))
{
options.IncludeXmlComments(xmlPath);
}

var domainXmlPath = Path.Combine(AppContext.BaseDirectory, "CreditApp.Domain.xml");
if (File.Exists(domainXmlPath))
{
options.IncludeXmlComments(domainXmlPath);
}
});
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 string[] _terminalStatuses = ["Одобрена", "Отклонена"];

public async Task<CreditApplication> GetByIdAsync(int id, CancellationToken cancellationToken = default)
Copy link

Choose a reason for hiding this comment

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

Я бы этот метод в try catch обернул


var application = GenerateApplication(id);

var expirationMinutes = _configuration.GetValue("CacheSettings:ExpirationMinutes", 10);
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 95 to 102
var submissionDateTime = c.SubmissionDate.ToDateTime(TimeOnly.MinValue);
var daysAfterSubmission = f.Random.Int(1, 60);
var approvalDateTime = submissionDateTime.AddDays(daysAfterSubmission);

if (approvalDateTime > DateTime.Now)
approvalDateTime = DateTime.Now;

return DateOnly.FromDateTime(approvalDateTime);
Copy link

Choose a reason for hiding this comment

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

Можно как-нибудь вот так:

return f.Date.BetweenDateOnly(c.SubmissionDate, DateOnly.FromDateTime(DateTime.Today));


var builder = DistributedApplication.CreateBuilder(args);

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

Choose a reason for hiding this comment

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

Я бы добавил сюда .WithRedisCommander()

@@ -0,0 +1,15 @@
using Aspire.Hosting;
Copy link

Choose a reason for hiding this comment

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

clean up

/// <summary>
/// Тип кредита
/// </summary>
public string Type { get; set; } = String.Empty;
Copy link

Choose a reason for hiding this comment

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

Лучше тут использовать string.Empty

А вообще, если это значение обязательное, то нужно убрать string.Empty и пометить модификатором required

Возможно какие-то другие проперти тоже можно сделать required

/// <summary>
/// Статус заявки
/// </summary>
public string Status { get; set; } = String.Empty;
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,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.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, на всякий случай

@razzzenya razzzenya requested a review from danlla February 19, 2026 16:47
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

Comments