Skip to content

Карпачева Полина Лаб. 1 Группа 6512#19

Closed
PolinaKrp wants to merge 19 commits intoitsecd:mainfrom
PolinaKrp:main
Closed

Карпачева Полина Лаб. 1 Группа 6512#19
PolinaKrp wants to merge 19 commits intoitsecd:mainfrom
PolinaKrp:main

Conversation

@PolinaKrp
Copy link

ФИО: Карпачева Полина
Номер группы: 6512
Номер лабораторной: 1
Номер варианта: 22
Краткое описание предметной области: Товар на складе
Краткое описание добавленных фич: Добавлен сервис генерации и кэширование

image image

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Feb 27, 2026
@github-actions github-actions bot requested a review from Gwymlas February 27, 2026 07:39
Comment on lines +1 to +3
using System;
namespace AspireApp.ApiService.Properties.Entities;
using System.Text.Json.Serialization;
Copy link

Choose a reason for hiding this comment

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

Сначала using, потом namespace

Copy link

Choose a reason for hiding this comment

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

Папки Entities и Generator вынести из Properties

Comment on lines +11 to +18
public interface IWarehouseCache
{
/// <summary>Получить товар из кэша по идентификатору</summary>
Task<Warehouse?> GetAsync(int id);

/// <summary>Сохранить товар в кэш с временем</summary>
Task SetAsync(Warehouse warehouse, TimeSpan expiration);
}
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 +28 to +32
public WarehouseCache(IDistributedCache cache, ILogger<WarehouseCache> logger)
{
_cache = cache;
_logger = logger;
}
Copy link

Choose a reason for hiding this comment

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

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

/// <summary>
/// Генерация нескольких случайных товаров
/// </summary>
public List<Warehouse> Generate(int count) => _faker.Generate(count);
Copy link

Choose a reason for hiding this comment

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

Этот метод нужен?

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
Copy link

Choose a reason for hiding this comment

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

По заданию

Реализация серверной части на .NET 8.

Comment on lines +26 to +33
<ItemGroup>
<None Remove="Properties\Entities\" />
<None Remove="Properties\Generator\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\Entities\" />
<Folder Include="Properties\Generator\" />
</ItemGroup>
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 +19 to +21
<ProjectReference Include="..\AspireApp.Web\AspireApp.Web.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
</ProjectReference>
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 +11 to +13
<ItemGroup>
<PackageReference Include="Aspire.Hosting.Redis" Version="9.5.0" />
</ItemGroup>
Copy link

Choose a reason for hiding this comment

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

Версия aspire sdk и пакетов разные

builder.AddRedisDistributedCache("RedisCache");

builder.Services.AddScoped<IWarehouseCache, WarehouseCache>();
builder.Services.AddScoped<WarehouseGenerator>();
Copy link

Choose a reason for hiding this comment

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

WarehouseGenerator можно зарегистрировать как Singleton- он никакого состояния не хранит, его методы не зависят от внешних данных, конструктор выполняет разовые настройки правил генерации

@PolinaKrp
Copy link
Author

Вроде все поправила
image
image

@PolinaKrp PolinaKrp requested a review from Gwymlas February 28, 2026 23:51
Comment on lines +31 to +34
public Warehouse Generate()
{
return _faker.Generate();
}
Copy link

Choose a reason for hiding this comment

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

public Warehouse Generate() => _faker.Generate();

Copy link

Choose a reason for hiding this comment

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

Если я правильно понял, это файл, создаваемый macos для хранения пользовательских настроек папки. Может добавить его в .gitignore

</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.StackExchange.Redis.DistributedCaching" Version="8.2.2" />
Copy link

Choose a reason for hiding this comment

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

Давай апнем до Version="9.5.2"

Comment on lines +20 to +22
policy.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
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 +2 to +3
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
Copy link

Choose a reason for hiding this comment

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

Удалить неиспользуемые using

Comment on lines +2 to +4
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Copy link

Choose a reason for hiding this comment

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

Удалить неиспользуемые using

Copy link

Choose a reason for hiding this comment

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

Прошлая версия AppHost.cs была верной, вернуть ее

Comment on lines +1 to +2
<Project Sdk="Microsoft.NET.Sdk">

Copy link

Choose a reason for hiding this comment

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

<Project Sdk="Microsoft.NET.Sdk">

    <Sdk Name="Aspire.AppHost.Sdk" Version="9.5.2" />

и удалить global.json

Copy link
Author

Choose a reason for hiding this comment

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

Я выполнила все ваши правки, но на моей macOS 26.3 .NET 8 не может установить компоненты Aspire, хотя сам SDK работает. Все нормально работает и устанавливается только на .NET 10. Можно продолжить на .NET 10?

Copy link
Author

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.

Я посмотрела проекты одноггрупников, у некоторых тоже .NET 10 и им зачли лабораторную

Copy link

Choose a reason for hiding this comment

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

Хорошо, уговорили, можно и на .NET10

Comment on lines +17 to +18
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.2" />
<PackageReference Include="Aspire.Hosting.Redis" Version="8.2.2" />
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

AspireApp.sln Outdated
Comment on lines +74 to +97
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Debug|x64.ActiveCfg = Debug|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Debug|x64.Build.0 = Debug|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Debug|x86.ActiveCfg = Debug|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Debug|x86.Build.0 = Debug|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Release|Any CPU.Build.0 = Release|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Release|x64.ActiveCfg = Release|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Release|x64.Build.0 = Release|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Release|x86.ActiveCfg = Release|Any CPU
{B463AE3B-1390-4073-B15B-77069FFA5C85}.Release|x86.Build.0 = Release|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Debug|x64.ActiveCfg = Debug|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Debug|x64.Build.0 = Debug|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Debug|x86.ActiveCfg = Debug|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Debug|x86.Build.0 = Debug|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Release|Any CPU.Build.0 = Release|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Release|x64.ActiveCfg = Release|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Release|x64.Build.0 = Release|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Release|x86.ActiveCfg = Release|Any CPU
{AE8D1D1E-7160-4C73-B0DB-5AC93C8D7094}.Release|x86.Build.0 = Release|Any CPU
Copy link

Choose a reason for hiding this comment

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

Ссылки на проекты, которых нет

@PolinaKrp PolinaKrp requested a review from Gwymlas March 1, 2026 11:25
@PolinaKrp
Copy link
Author

image image не совсем поняла как именно нужно было настроить корс,поэтому просто ограничила под своего клиента http://localhost:5127

Comment on lines +17 to +19
policy.WithOrigins("http://localhost:5127")
.AllowAnyMethod()
.AllowAnyHeader();
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.

Опять он

Comment on lines 9 to 12
<PropertyGroup Condition=" '$(RunConfiguration)' == 'https' " />
<PropertyGroup Condition=" '$(RunConfiguration)' == 'http' " />
<ItemGroup>
<None Remove="Components\StudentCard.razor~RF1bb17a4.TMP" />
</ItemGroup>
Copy link

Choose a reason for hiding this comment

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

PropertyGroup и ItemGroup - пустые, можно удалить

@PolinaKrp PolinaKrp requested a review from Gwymlas March 5, 2026 18:00
@Gwymlas Gwymlas added Approved Лабораторная зачтена and removed In progress Код в процессе проверки labels Mar 5, 2026
@Gwymlas Gwymlas closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Лабораторная зачтена Lab 1 Лабораторная №1. Кэширование

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants