Skip to content

Уваров Никита Лаб. 1 Группа 6513#16

Open
Rifinn-crypto wants to merge 17 commits intoitsecd:mainfrom
Rifinn-crypto:main
Open

Уваров Никита Лаб. 1 Группа 6513#16
Rifinn-crypto wants to merge 17 commits intoitsecd:mainfrom
Rifinn-crypto:main

Conversation

@Rifinn-crypto
Copy link

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

image

Запутался в коде и пытаюсь исправить проблему с контейнерами
…ременную...

Это была война не на жизнь, а на смерть с 2 часами сна, кровью из носа и криками боли.
@Rifinn-crypto Rifinn-crypto changed the title Лаб1 Уваров Никита 6513 Уваров Никита Лаб. 1 Группа 6513 Feb 24, 2026
@Rifinn-crypto
Copy link
Author

image

@alxmcs alxmcs closed this Feb 26, 2026
@alxmcs alxmcs reopened this Feb 26, 2026
@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Feb 26, 2026
@github-actions github-actions bot requested a review from alxmcs February 26, 2026 09: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.

Как и в #15, у тебя на запрос с одним и тем же идентификатором возвращаются разные результаты генерации.

Image

Мне не очень интересно, кто из вас у кого украл код (и за кого из вас Богу стыдно).
Но воровство подобного кода равноценно похищению пакета с мусором с помойки.

catch (Exception ex)
{
_logger.LogError(ex, "Error getting credit application {CreditId}", id);
return StatusCode(500, "Internal server error");
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 61 to 108
/// <summary>
/// Сгенерировать кредитную заявку с указанным seed
/// </summary>
[HttpGet]
[ProducesResponseType(typeof(CreditApplication), StatusCodes.Status200OK)]
public async Task<ActionResult<CreditApplication>> GenerateCredit(
[FromQuery] int? seed,
CancellationToken cancellationToken)
{
_logger.LogInformation("Generating credit application with seed: {Seed}", seed);

var id = new Random().Next(1, 10000);

CreditApplication creditApplication;

if (seed.HasValue)
{
creditApplication = await _creditService.GetAsync(id, seed.Value, cancellationToken);
_logger.LogInformation("Generated credit application with seed {Seed}: {CreditId}", seed, id);
}
else
{
creditApplication = await _creditService.GetAsync(id, cancellationToken);
_logger.LogInformation("Generated random credit application: {CreditId}", id);
}

return Ok(creditApplication);
}

/// <summary>
/// Удалить заявку из кэша
/// </summary>
[HttpDelete("{id:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> RemoveCreditApplication(
int id,
CancellationToken cancellationToken)
{
if (id <= 0)
{
return BadRequest("Id must be positive number");
}

await _creditService.RemoveAsync(id, cancellationToken);
return NoContent();
}
} No newline at end of file
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 23
private readonly ICreditService _creditService;
private readonly ILogger<CreditController> _logger;

public CreditController(
ICreditService creditService,
ILogger<CreditController> logger)
{
_creditService = creditService;
_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.

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

А знаешь, где еще такая же проблема? В #15

Comment on lines 28 to 48
var faker = new Faker<CreditApplication>()
.RuleFor(x => x.Id, id)
.RuleFor(x => x.CreditType, f => f.PickRandom(_types))
.RuleFor(x => x.RequestedAmount, f => Math.Round(f.Random.Decimal(10000, 5_000_000), 2))
.RuleFor(x => x.TermMonths, f => f.Random.Int(6, 360))
.RuleFor(x => x.InterestRate, f => Math.Round(f.Random.Double(CbRate, CbRate + 5), 2))
.RuleFor(x => x.ApplicationDate, f => DateOnly.FromDateTime(f.Date.Past(2)))
.RuleFor(x => x.HasInsurance, f => f.Random.Bool())
.RuleFor(x => x.Status, f => f.PickRandom(_statuses))
.RuleFor(x => x.DecisionDate, (f, x) =>
x.Status is "Одобрена" or "Отклонена"
? DateOnly.FromDateTime(
f.Date.Between(
x.ApplicationDate.ToDateTime(TimeOnly.MinValue),
DateTime.Now))
: null)
.RuleFor(x => x.ApprovedAmount, (f, x) =>
x.Status == "Одобрена"
? Math.Round(f.Random.Decimal(10000, x.RequestedAmount), 2)
: null);

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
Collaborator

Choose a reason for hiding this comment

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

Выпилить отсюда лишний функционал

Comment on lines 12 to 13
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.3" />
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 7 to 11
var redisCommander = builder.AddContainer("redis-commander", "rediscommander/redis-commander")
.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.

Редис коммандер есть в интеграции аспаер

Знаешь, где я это уже видел? В #15

<ItemGroup>
<ProjectReference Include="..\Client.Wasm\Client.Wasm.csproj" />
<ProjectReference Include="..\CreditApp.Api\CreditApp.Api.csproj" />
<ProjectReference Include="..\CreditApp.Domain\CreditApp.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.

Потрясающее совпадение, тут тоже, как и в #15 класс либа добавлена в оркестратор

Copy link
Collaborator

Choose a reason for hiding this comment

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

Image

Comment on lines +3 to +4
# Visual Studio Version 18
VisualStudioVersion = 18.3.11512.155 d18.3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Мог бы и 10 дотнет с 13 аспаером использовать, раз ты 2026 вижуал студией пользуешься

@alxmcs alxmcs added AI slop Вы уличены в вайб-кодинге. Вы покрыли себя несмываемым позором Stolen Вы уличены в краже кода. Вы покрыли себя несмываемым позором and removed AI slop Вы уличены в вайб-кодинге. Вы покрыли себя несмываемым позором labels Feb 26, 2026
@Rifinn-crypto
Copy link
Author

Не воровали, просто рядом сидели делали в бреду, но я понял про код и его качество

@Rifinn-crypto Rifinn-crypto requested a review from alxmcs February 26, 2026 18:20
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