delete old lab
This commit is contained in:
parent
50cf3cd912
commit
176c931602
@ -1,15 +0,0 @@
|
|||||||
version: "3.1"
|
|
||||||
services:
|
|
||||||
worker-1:
|
|
||||||
build: ./worker-1
|
|
||||||
worker-2:
|
|
||||||
build: ./worker-2
|
|
||||||
depends_on:
|
|
||||||
- worker-1
|
|
||||||
gateway:
|
|
||||||
image: nginx:latest
|
|
||||||
ports:
|
|
||||||
- 8080:8080
|
|
||||||
volumes:
|
|
||||||
- ./static:/usr/share/nginx/html:ro
|
|
||||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
@ -1,26 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 8080;
|
|
||||||
listen [::]:8080;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html index.htm;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /worker-1/ {
|
|
||||||
proxy_pass http://worker-1:80/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header X-Forwarded-Prefix /worker-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /worker-2/ {
|
|
||||||
proxy_pass http://worker-2:80/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header X-Forwarded-Prefix /worker-2;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="ru">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Тестовое приложение для л/р 3</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Именно этот файл вы видите, когда открываете приложение.</p>
|
|
||||||
<p><a href="/worker-1/">Отправить запрос к worker-1</a></p>
|
|
||||||
<p><a href="/worker-2/">Отправить запрос к worker-2</a></p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY . ./
|
|
||||||
RUN dotnet restore
|
|
||||||
RUN dotnet publish -c Release -o out
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=build-env /app/out .
|
|
||||||
ENTRYPOINT ["dotnet", "worker-1.dll"]
|
|
@ -1,124 +0,0 @@
|
|||||||
List<Request> requests = new()
|
|
||||||
{
|
|
||||||
new Request() { Uuid= Guid.Parse("7184fa5f-b786-4478-863a-99cc000eb752"), Title = "Расход на коммуналку", SourceOfFunds = "Мердеев", Sum = 100000, IsCompleted = false },
|
|
||||||
new Request() { Uuid= Guid.Parse("55a9aed1-218a-468e-92b9-99f6a6a34543"), Title = "Расход на газ", SourceOfFunds = "Киселев", Sum = 25000, IsCompleted = true },
|
|
||||||
};
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseSwagger();
|
|
||||||
app.UseSwaggerUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
|
||||||
|
|
||||||
app.MapGet("/", () =>
|
|
||||||
{
|
|
||||||
return requests.Select(r => new RequestEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = r.Uuid,
|
|
||||||
Title = r.Title,
|
|
||||||
Sum = r.Sum,
|
|
||||||
SourceOfFunds = r.SourceOfFunds,
|
|
||||||
IsCompleted = r.IsCompleted,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("GetRequests")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapGet("/{uuid}", (Guid uuid) =>
|
|
||||||
{
|
|
||||||
var request = requests.FirstOrDefault(r => r.Uuid == uuid);
|
|
||||||
if (request == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
return Results.Json(new RequestEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = request.Uuid,
|
|
||||||
Title = request.Title,
|
|
||||||
Sum = request.Sum,
|
|
||||||
SourceOfFunds = request.SourceOfFunds,
|
|
||||||
IsCompleted = request.IsCompleted,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("GetRequestByGUID")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapPost("/{title}/{sourceOfFunds}/{sum}/{isCompleted}", (string title, string sourceOfFunds, decimal sum, bool isCompleted) =>
|
|
||||||
{
|
|
||||||
Guid NewGuid = Guid.NewGuid();
|
|
||||||
requests.Add(new Request() { Uuid = NewGuid, Title = (string)title, SourceOfFunds = (string)sourceOfFunds, Sum = (decimal)sum, IsCompleted = (bool)isCompleted});
|
|
||||||
|
|
||||||
var request = requests.FirstOrDefault(r => r.Uuid == NewGuid);
|
|
||||||
if (request == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
return Results.Json(new RequestEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = request.Uuid,
|
|
||||||
Title = request.Title,
|
|
||||||
Sum = request.Sum,
|
|
||||||
SourceOfFunds = request.SourceOfFunds,
|
|
||||||
IsCompleted = request.IsCompleted,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("PostRequest")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapPatch("/{uuid}/{title}/{sourceOfFunds}/{sum}/{isCompleted}", (Guid uuid, string ?title, string ?sourceOfFunds, decimal sum, bool isCompleted) =>
|
|
||||||
{
|
|
||||||
var request = requests.FirstOrDefault(r => r.Uuid == uuid);
|
|
||||||
if (request == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
if (title != null) request.Title = title;
|
|
||||||
if (sourceOfFunds != ",") request.SourceOfFunds = sourceOfFunds;
|
|
||||||
if (sum != request.Sum && sum != 0) request.Sum = sum;
|
|
||||||
if (isCompleted != request.IsCompleted) request.IsCompleted = isCompleted;
|
|
||||||
|
|
||||||
return Results.Json(new RequestEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = request.Uuid,
|
|
||||||
Title = request.Title,
|
|
||||||
Sum = request.Sum,
|
|
||||||
SourceOfFunds = request.SourceOfFunds,
|
|
||||||
IsCompleted = request.IsCompleted,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("UpdateRequest")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapDelete("/{uuid}", (Guid uuid) =>
|
|
||||||
{
|
|
||||||
var request = requests.FirstOrDefault(r => r.Uuid == uuid);
|
|
||||||
if (request == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
requests.Remove(request);
|
|
||||||
return Results.Json(new RequestEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = request.Uuid,
|
|
||||||
Title = request.Title,
|
|
||||||
Sum = request.Sum,
|
|
||||||
SourceOfFunds = request.SourceOfFunds,
|
|
||||||
IsCompleted = request.IsCompleted,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("DeleteRequestByGUID")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
|
|
||||||
public class Request
|
|
||||||
{
|
|
||||||
public Guid Uuid { get; set; }
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public string SourceOfFunds { get; set; } = string.Empty;
|
|
||||||
public decimal Sum { get; set; } = 0;
|
|
||||||
public bool IsCompleted { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RequestEntityDto : Request { }
|
|
@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:6980",
|
|
||||||
"sslPort": 44332
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"http": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "http://localhost:5019",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"https": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "https://localhost:7244;http://localhost:5019",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"targets": {
|
|
||||||
"net8.0": {}
|
|
||||||
},
|
|
||||||
"libraries": {},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net8.0": []
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"C:\\Users\\tornado\\.nuget\\packages\\": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj",
|
|
||||||
"projectName": "worker-1",
|
|
||||||
"projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj",
|
|
||||||
"packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\",
|
|
||||||
"outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\obj\\",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
|
||||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.AspNetCore.App": {
|
|
||||||
"privateAssets": "none"
|
|
||||||
},
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "+cwREIHqhmU0K0lolkc+aJ4VfGcHTd+lgDzxgzG6VVzVqzcMiP/4HBRoxfRQGZM0f0Z+Rmba7TxtDbNQh/2bYw==",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj",
|
|
||||||
"expectedPackageFiles": [],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj",
|
|
||||||
"projectName": "worker-1",
|
|
||||||
"projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj",
|
|
||||||
"packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\",
|
|
||||||
"outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\obj\\",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
|
||||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.AspNetCore.App": {
|
|
||||||
"privateAssets": "none"
|
|
||||||
},
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\tornado\.nuget\packages\</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="C:\Users\tornado\.nuget\packages\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
@ -1,10 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<RootNamespace>worker_1</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,11 +0,0 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY . ./
|
|
||||||
RUN dotnet restore
|
|
||||||
RUN dotnet publish -c Release -o out
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=build-env /app/out .
|
|
||||||
ENTRYPOINT ["dotnet", "worker-2.dll"]
|
|
@ -1,145 +0,0 @@
|
|||||||
|
|
||||||
List<Agreement> agrs = new()
|
|
||||||
{
|
|
||||||
new Agreement() { Uuid= Guid.NewGuid(), Number = "75ИФ-61", Date = new DateOnly(), Sum = 50000, IdRequest = Guid.Parse("7184fa5f-b786-4478-863a-99cc000eb752") }
|
|
||||||
};
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseSwagger();
|
|
||||||
app.UseSwaggerUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
|
||||||
|
|
||||||
app.MapGet("/", () =>
|
|
||||||
{
|
|
||||||
return agrs.Select(r => new AgreementEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = r.Uuid,
|
|
||||||
Number = r.Number,
|
|
||||||
Sum = r.Sum,
|
|
||||||
Date = r.Date,
|
|
||||||
IdRequest = r.IdRequest,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("GetAgreements")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapGet("/{uuid}", (Guid uuid) =>
|
|
||||||
{
|
|
||||||
var agr = agrs.FirstOrDefault(r => r.Uuid == uuid);
|
|
||||||
if (agr == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
return Results.Json(new AgreementEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = agr.Uuid,
|
|
||||||
Number = agr.Number,
|
|
||||||
Sum = agr.Sum,
|
|
||||||
Date = agr.Date,
|
|
||||||
IdRequest = agr.IdRequest,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("GetAgreementByGUID")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapPost("/{number}/{date}/{sum}/{idRequest}", (string? number, DateOnly date, decimal sum, Guid idRequest) =>
|
|
||||||
{
|
|
||||||
Guid NewGuid = Guid.NewGuid();
|
|
||||||
agrs.Add(new Agreement() { Uuid = NewGuid, Number = (string)number, Date = (DateOnly)date, Sum = (decimal)sum, IdRequest = (Guid)idRequest });
|
|
||||||
|
|
||||||
var agr = agrs.FirstOrDefault(r => r.Uuid == NewGuid);
|
|
||||||
if (agr == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
return Results.Json(new AgreementEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = agr.Uuid,
|
|
||||||
Number = agr.Number,
|
|
||||||
Sum = agr.Sum,
|
|
||||||
Date = agr.Date,
|
|
||||||
IdRequest = agr.IdRequest,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("PostAgreement")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapPatch("/{uuid}/{number}/{date}/{sum}/{idRequest}", (Guid uuid, string ?number, DateOnly date, decimal sum, Guid idRequest) =>
|
|
||||||
{
|
|
||||||
var agr = agrs.FirstOrDefault(r => r.Uuid == uuid);
|
|
||||||
if (agr == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
if (number != ",") agr.Number = number;
|
|
||||||
if (date != null)agr.Date = date;
|
|
||||||
if (sum != agr.Sum && sum != 0) agr.Sum = sum;
|
|
||||||
if (idRequest != agr.IdRequest) agr.IdRequest = idRequest;
|
|
||||||
|
|
||||||
return Results.Json(new AgreementEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = agr.Uuid,
|
|
||||||
Number = agr.Number,
|
|
||||||
Sum = agr.Sum,
|
|
||||||
Date = agr.Date,
|
|
||||||
IdRequest = agr.IdRequest,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("UpdateAgreement")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapDelete("/{uuid}", (Guid uuid) =>
|
|
||||||
{
|
|
||||||
var agr = agrs.FirstOrDefault(r => r.Uuid == uuid);
|
|
||||||
if (agr == null)
|
|
||||||
return Results.NotFound();
|
|
||||||
agrs.Remove(agr);
|
|
||||||
return Results.Json(new AgreementEntityDto()
|
|
||||||
{
|
|
||||||
Uuid = agr.Uuid,
|
|
||||||
Number = agr.Number,
|
|
||||||
Sum = agr.Sum,
|
|
||||||
Date = agr.Date,
|
|
||||||
IdRequest = agr.IdRequest,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.WithName("DeleteAgreement")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.MapGet("/Requests/", async () =>
|
|
||||||
{
|
|
||||||
var httpClient = new HttpClient();
|
|
||||||
var secondWorkerResponse = await httpClient.GetStringAsync("http://worker-2:80/");
|
|
||||||
|
|
||||||
return secondWorkerResponse.ToArray();
|
|
||||||
})
|
|
||||||
.WithName("GetRequests")
|
|
||||||
.WithOpenApi();
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
|
|
||||||
public class Agreement
|
|
||||||
{
|
|
||||||
public Guid Uuid { get; set; }
|
|
||||||
public string Number { get; set; } = string.Empty;
|
|
||||||
public DateOnly Date { get; set; }
|
|
||||||
public Guid IdRequest { get; set; }
|
|
||||||
public decimal Sum { get; set; } = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AgreementEntityDto : Agreement { }
|
|
||||||
|
|
||||||
public class Request
|
|
||||||
{
|
|
||||||
public Guid Uuid { get; set; }
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public string SourceOfFunds { get; set; } = string.Empty;
|
|
||||||
public decimal Sum { get; set; } = 0;
|
|
||||||
public bool IsCompleted { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RequestEntityDto : Request { }
|
|
@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:22357",
|
|
||||||
"sslPort": 44378
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"http": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "http://localhost:5068",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"https": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "https://localhost:7027;http://localhost:5068",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"targets": {
|
|
||||||
"net8.0": {}
|
|
||||||
},
|
|
||||||
"libraries": {},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net8.0": []
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"C:\\Users\\tornado\\.nuget\\packages\\": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj",
|
|
||||||
"projectName": "worker-2",
|
|
||||||
"projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj",
|
|
||||||
"packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\",
|
|
||||||
"outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\obj\\",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
|
||||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.AspNetCore.App": {
|
|
||||||
"privateAssets": "none"
|
|
||||||
},
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "1v+091MPSsb0GY9t1QT541i6Br4GtjsgMis1YtUlrFQMBiie91sJdKxeMF4519i4iZtFk8/rkf1BQTKEycP1/w==",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj",
|
|
||||||
"expectedPackageFiles": [],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj",
|
|
||||||
"projectName": "worker-2",
|
|
||||||
"projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj",
|
|
||||||
"packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\",
|
|
||||||
"outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\obj\\",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
|
||||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.AspNetCore.App": {
|
|
||||||
"privateAssets": "none"
|
|
||||||
},
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\tornado\.nuget\packages\</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="C:\Users\tornado\.nuget\packages\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
@ -1,10 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<RootNamespace>worker_2</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
Loading…
Reference in New Issue
Block a user