-
Notifications
You must be signed in to change notification settings - Fork 9
Горшенин Дмитрий Лаб. 1 Группа 6511 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dmgorshenin
wants to merge
8
commits into
itsecd:main
Choose a base branch
from
dmgorshenin:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8fd9d9d
Добавлен сервис генерации и кэширования кредитных заявок для первой л…
dmgorshenin e1db504
Update README.md
dmgorshenin c0518fa
Очистка кода
dmgorshenin 90ecc6e
Update README.md
dmgorshenin 8d9edea
Update README.md
dmgorshenin 85e73d2
Исправил правки
dmgorshenin 9e1bd91
Merge branch 'main' of https://github.com/dmgorshenin/cloud-development
dmgorshenin 7d74621
Забыл еще _logger убрать
dmgorshenin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| { | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning" | ||
| } | ||
| }, | ||
| "AllowedHosts": "*", | ||
| "BaseAddress": "https://localhost:7170/land-plot" | ||
| "BaseAddress": "https://localhost:7171/credit-application" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
CreditApplication.AppHost/CreditApplication.AppHost.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" /> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <IsAspireHost>true</IsAspireHost> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Aspire.Hosting" Version="9.5.2" /> | ||
| <PackageReference Include="Aspire.Hosting.AppHost" Version="9.5.2" /> | ||
| <PackageReference Include="Aspire.Hosting.Redis" Version="9.5.2" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\CreditApplication.Generator\CreditApplication.Generator.csproj" /> | ||
| <ProjectReference Include="..\Client.Wasm\Client.Wasm.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| var builder = DistributedApplication.CreateBuilder(args); | ||
|
|
||
| var redis = builder.AddRedis("redis") | ||
| .WithRedisCommander(); | ||
|
|
||
| var generator = builder.AddProject<Projects.CreditApplication_Generator>("generator") | ||
| .WithReference(redis) | ||
| .WithExternalHttpEndpoints(); | ||
|
|
||
| builder.AddProject<Projects.Client_Wasm>("client") | ||
| .WithReference(generator); | ||
|
|
||
| builder.Build().Run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "$schema": "http://json.schemastore.org/launchsettings.json", | ||
| "profiles": { | ||
| "https": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "https://localhost:17170;http://localhost:15170", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "DOTNET_ENVIRONMENT": "Development", | ||
| "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21170", | ||
| "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22170" | ||
| } | ||
| }, | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "http://localhost:15170", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "DOTNET_ENVIRONMENT": "Development", | ||
| "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19170", | ||
| "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20170" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning", | ||
| "Aspire.Hosting.Dcp": "Warning" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning", | ||
| "Aspire.Hosting.Dcp": "Warning" | ||
| } | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
CreditApplication.Generator/CreditApplication.Generator.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Aspire.StackExchange.Redis.DistributedCaching" Version="9.5.2" /> | ||
| <PackageReference Include="Bogus" Version="35.6.1" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\CreditApplication.ServiceDefaults\CreditApplication.ServiceDefaults.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
57 changes: 57 additions & 0 deletions
57
CreditApplication.Generator/Models/CreditApplicationModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| namespace CreditApplication.Generator.Models; | ||
|
|
||
| /// <summary> | ||
| /// Модель кредитной заявки | ||
| /// </summary> | ||
| public class CreditApplicationModel | ||
| { | ||
| /// <summary> | ||
| /// Идентификатор в системе | ||
| /// </summary> | ||
| public int Id { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Тип кредита (Потребительский, Ипотека, Автокредит и т.д.) | ||
| /// </summary> | ||
| public string CreditType { get; set; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Запрашиваемая сумма (округляется до 2 знаков) | ||
| /// </summary> | ||
| public decimal RequestedAmount { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Срок в месяцах | ||
| /// </summary> | ||
| public int TermInMonths { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Процентная ставка (не менее ставки ЦБ РФ, округляется до 2 знаков) | ||
| /// </summary> | ||
| public double InterestRate { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Дата подачи (не более 2 лет назад) | ||
| /// </summary> | ||
| public DateOnly ApplicationDate { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Необходимость страховки | ||
| /// </summary> | ||
| public bool InsuranceRequired { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Статус заявки (Новая, В обработке, Одобрена, Отклонена) | ||
| /// </summary> | ||
| public string Status { get; set; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Дата решения (только для терминальных статусов) | ||
| /// </summary> | ||
| public DateOnly? DecisionDate { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Одобренная сумма (только для статуса "Одобрена", <= RequestedAmount) | ||
| /// </summary> | ||
| public decimal? ApprovedAmount { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| using CreditApplication.Generator.Services; | ||
| using CreditApplication.ServiceDefaults; | ||
| using Serilog; | ||
|
|
||
| var builder = WebApplication.CreateBuilder(args); | ||
|
|
||
| builder.AddServiceDefaults(); | ||
|
|
||
| builder.AddRedisDistributedCache("redis"); | ||
|
|
||
| builder.Services.AddSingleton<CreditApplicationGenerator>(); | ||
| builder.Services.AddScoped<CreditApplicationService>(); | ||
|
|
||
| builder.Services.AddCors(options => | ||
| { | ||
| options.AddDefaultPolicy(policy => | ||
| { | ||
| if (builder.Environment.IsDevelopment()) | ||
| { | ||
| policy.AllowAnyOrigin() | ||
| .AllowAnyMethod() | ||
| .AllowAnyHeader(); | ||
| } | ||
| else | ||
| { | ||
| policy.WithOrigins("https://your-production-frontend.example") | ||
| .WithMethods("GET") | ||
| .WithHeaders("Content-Type", "Authorization"); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.UseCors(); | ||
| app.UseSerilogRequestLogging(); | ||
|
|
||
| app.MapDefaultEndpoints(); | ||
|
|
||
| // API endpoint для получения кредитной заявки | ||
| app.MapGet("/credit-application", async ( | ||
| int id, | ||
| CreditApplicationService service, | ||
| ILogger<Program> logger, | ||
| CancellationToken cancellationToken) => | ||
| { | ||
| logger.LogInformation("Received request for credit application with ID: {Id}", id); | ||
|
|
||
| if (id <= 0) | ||
| { | ||
| logger.LogWarning("Received invalid ID: {Id}", id); | ||
| return Results.BadRequest(new { error = "ID must be a positive number" }); | ||
| } | ||
|
|
||
| try | ||
| { | ||
| var application = await service.GetByIdAsync(id, cancellationToken); | ||
| return Results.Ok(application); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| logger.LogError(ex, "Error while getting credit application {Id}", id); | ||
| return Results.Problem("An error occurred while processing the request"); | ||
| } | ||
| }) | ||
| .WithName("GetCreditApplication"); | ||
|
|
||
| app.Run(); |
23 changes: 23 additions & 0 deletions
23
CreditApplication.Generator/Properties/launchSettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "$schema": "http://json.schemastore.org/launchsettings.json", | ||
| "profiles": { | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": false, | ||
| "applicationUrl": "http://localhost:5171", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| }, | ||
| "https": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": false, | ||
| "applicationUrl": "https://localhost:7171;http://localhost:5171", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatically this reads as feminine (“Выполнена”), while the sentence is about the work/assignment (“задание/лабораторная”) and is usually phrased as “Выполнено …”. Consider adjusting the wording to avoid the agreement error.