Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Client.Wasm/Components/StudentCard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
</CardHeader>
<CardBody>
<UnorderedList Unstyled>
<UnorderedListItem>Номер <Strong>№X "Название лабораторной"</Strong></UnorderedListItem>
<UnorderedListItem>Вариант <Strong>№Х "Название варианта"</Strong></UnorderedListItem>
<UnorderedListItem>Выполнена <Strong>Фамилией Именем 65ХХ</Strong> </UnorderedListItem>
<UnorderedListItem><Link To="https://puginarug.com/">Ссылка на форк</Link></UnorderedListItem>
<UnorderedListItem>Номер <Strong>№1 "Кэширование"</Strong></UnorderedListItem>
<UnorderedListItem>Вариант <Strong>№6 "Медицинский пациент"</Strong></UnorderedListItem>
<UnorderedListItem>Выполнена <Strong>Замотохиной Марией 6511</Strong> </UnorderedListItem>
<UnorderedListItem><Link To="https://github.com/ZamotohinaMaria/cloud-development">Ссылка на форк</Link></UnorderedListItem>
</UnorderedList>
</CardBody>
</Card>
2 changes: 1 addition & 1 deletion Client.Wasm/wwwroot/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
}
},
"AllowedHosts": "*",
"BaseAddress": ""
"BaseAddress": "https://localhost:7196/medicalpatient-generator"
}
20 changes: 19 additions & 1 deletion CloudDevelopment.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36811.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client.Wasm", "Client.Wasm\Client.Wasm.csproj", "{AE7EEA74-2FE0-136F-D797-854FD87E022A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client.Wasm", "Client.Wasm\Client.Wasm.csproj", "{AE7EEA74-2FE0-136F-D797-854FD87E022A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MedicalPatient.AppHost.AppHost", "MedicalPatient.AppHost\MedicalPatient.AppHost.AppHost\MedicalPatient.AppHost.AppHost.csproj", "{892597A3-DF97-470C-AA27-6398D1C68C9E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MedicalPatient.AppHost.ServiceDefaults", "MedicalPatient.AppHost\MedicalPatient.AppHost.ServiceDefaults\MedicalPatient.AppHost.ServiceDefaults.csproj", "{0E685E2F-3762-4FF1-AF4F-A3E204FDF791}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MedicalPatient.Generator", "MedicalPatient.Generator\MedicalPatient.Generator.csproj", "{B9054D03-6CF6-4B8C-8E6F-3D27D39983F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +21,18 @@ Global
{AE7EEA74-2FE0-136F-D797-854FD87E022A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE7EEA74-2FE0-136F-D797-854FD87E022A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE7EEA74-2FE0-136F-D797-854FD87E022A}.Release|Any CPU.Build.0 = Release|Any CPU
{892597A3-DF97-470C-AA27-6398D1C68C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{892597A3-DF97-470C-AA27-6398D1C68C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{892597A3-DF97-470C-AA27-6398D1C68C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{892597A3-DF97-470C-AA27-6398D1C68C9E}.Release|Any CPU.Build.0 = Release|Any CPU
{0E685E2F-3762-4FF1-AF4F-A3E204FDF791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E685E2F-3762-4FF1-AF4F-A3E204FDF791}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E685E2F-3762-4FF1-AF4F-A3E204FDF791}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E685E2F-3762-4FF1-AF4F-A3E204FDF791}.Release|Any CPU.Build.0 = Release|Any CPU
{B9054D03-6CF6-4B8C-8E6F-3D27D39983F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9054D03-6CF6-4B8C-8E6F-3D27D39983F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9054D03-6CF6-4B8C-8E6F-3D27D39983F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9054D03-6CF6-4B8C-8E6F-3D27D39983F5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
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.5.2" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>fe743bf2-08eb-41c7-817b-f144b739dce3</UserSecretsId>
</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="..\..\Client.Wasm\Client.Wasm.csproj" />
<ProjectReference Include="..\..\MedicalPatient.Generator\MedicalPatient.Generator.csproj" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions MedicalPatient.AppHost/MedicalPatient.AppHost.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("redis")
.WithRedisCommander();

var generator = builder.AddProject<Projects.MedicalPatient_Generator>("medicalpatient-generator")
.WithReference(redis)
.WaitFor(redis)
.WithExternalHttpEndpoints();

builder.AddProject<Projects.Client_Wasm>("client")
.WithReference(generator)
.WaitFor(generator);

builder.Build().Run();

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17189;http://localhost:15186",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21135",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22007"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15186",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19058",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20159"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
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"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using Serilog;

namespace MedicalPatient.AppHost.ServiceDefaults;

public static class Extensions
{
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
{
builder.ConfigureSerilog();
builder.ConfigureOpenTelemetry();
builder.AddDefaultHealthChecks();
builder.Services.AddServiceDiscovery();
builder.Services.ConfigureHttpClientDefaults(http =>
{
http.AddStandardResilienceHandler();
http.AddServiceDiscovery();
});

return builder;
}

public static IHostApplicationBuilder ConfigureSerilog(this IHostApplicationBuilder builder)
{
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(builder.Configuration)
.Enrich.FromLogContext()
.Enrich.WithEnvironmentName()
.Enrich.WithThreadId()
.Enrich.WithMachineName()
.WriteTo.Console(outputTemplate:
"[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}")
.CreateLogger();

builder.Services.AddSerilog();

return builder;
}

public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicationBuilder builder)
{
builder.Logging.AddOpenTelemetry(logging =>
{
logging.IncludeFormattedMessage = true;
logging.IncludeScopes = true;
});

builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
tracing.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation();
});

builder.AddOpenTelemetryExporters();

return builder;
}

private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostApplicationBuilder builder)
{
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);

if (useOtlpExporter)
{
builder.Services.AddOpenTelemetry().UseOtlpExporter();
}

return builder;
}

public static IHostApplicationBuilder AddDefaultHealthChecks(this IHostApplicationBuilder builder)
{
builder.Services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);

return builder;
}

public static WebApplication MapDefaultEndpoints(this WebApplication app)
{
app.MapHealthChecks("/health");
app.MapHealthChecks("/alive", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});

return app;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.1.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
<PackageReference Include="Serilog" Version="4.3.1" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
</ItemGroup>

</Project>
21 changes: 21 additions & 0 deletions MedicalPatient.Generator/MedicalPatient.Generator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<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="13.1.3" />
<PackageReference Include="Bogus" Version="35.6.5" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.5" />
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

<PackageReference Include="Serilog" Version="4.3.1" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MedicalPatient.AppHost\MedicalPatient.AppHost.ServiceDefaults\MedicalPatient.AppHost.ServiceDefaults.csproj" />
</ItemGroup>

</Project>
57 changes: 57 additions & 0 deletions MedicalPatient.Generator/Models/MedicalPatient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace MedicalPatient.Generator.Models;

/// <summary>
/// Класс, описывающий карточку медицинского пациента
/// </summary>
public class MedicalPatientModel
{
/// <summary>
/// Идентификатор пациента в системе
/// </summary>
public int Id { get; set; }

/// <summary>
/// ФИО пациента - конкатенация фамилии, имени и отчества через пробел
/// </summary>
public required string FullName { get; set; }

/// <summary>
/// Адрес проживания пациента
/// </summary>
public required string Address { get; set; }

/// <summary>
/// Дата рождения - не может быть позже текущей
/// </summary>
public required DateOnly BirthDate { get; set; }

/// <summary>
/// Рост - округляется до двух знаков после запятой
/// </summary>
public required double Height { get; set; }

/// <summary>
/// Вес - округляется до двух знаков после запятой
/// </summary>
public required double Weight { get; set; }

/// <summary>
/// Группа крови (на рукаве) - это число от 1 до 4
/// </summary>
public required int BloodType { get; set; }

/// <summary>
/// Резус-фактор
/// </summary>
public required bool RhFactor { get; set; }

/// <summary>
/// Дата последнего осмотра - не может быть раньше даты рождения
/// </summary>
public required DateOnly LastInspectionDate { get; set; }

/// <summary>
/// Отметка о вакцинации
/// </summary>
public required bool VaccinationMark { get; set; }
}
Loading