diff --git a/sergeev_evgenii_lab_3/.gitattributes b/sergeev_evgenii_lab_3/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/sergeev_evgenii_lab_3/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/sergeev_evgenii_lab_3/.gitignore b/sergeev_evgenii_lab_3/.gitignore new file mode 100644 index 0000000..dfcfd56 --- /dev/null +++ b/sergeev_evgenii_lab_3/.gitignore @@ -0,0 +1,350 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ diff --git a/sergeev_evgenii_lab_3/Lessons/.dockerignore b/sergeev_evgenii_lab_3/Lessons/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons.sln b/sergeev_evgenii_lab_3/Lessons/Lessons.sln new file mode 100644 index 0000000..9db579f --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32319.34 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lessons", "Lessons\Lessons.csproj", "{0CC7E6F5-2A84-4409-9150-FD73B69801FA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0CC7E6F5-2A84-4409-9150-FD73B69801FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CC7E6F5-2A84-4409-9150-FD73B69801FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CC7E6F5-2A84-4409-9150-FD73B69801FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CC7E6F5-2A84-4409-9150-FD73B69801FA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8DA76FDB-3479-4EB5-88B3-089FA9F57FF5} + EndGlobalSection +EndGlobal diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Controllers/LessonController.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/Controllers/LessonController.cs new file mode 100644 index 0000000..f9acadf --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Controllers/LessonController.cs @@ -0,0 +1,111 @@ +using Lessons.DatabaseAccess; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace Lessons.Controllers +{ + [ApiController] + [Route("[controller]")] + public class LessonController : ControllerBase + { + private readonly LessonsDatabase _dbContext; + private readonly ILogger _logger; + private readonly IHttpClientFactory _clientFactory; + + public LessonController(ILogger logger, LessonsDatabase dbContext, + IHttpClientFactory clientFactory) + { + _logger = logger; + _dbContext = dbContext; + _clientFactory = clientFactory; + } + + // GET: /{id} ID + [HttpGet("{id}")] + public ActionResult GetLesson(int id) + { + var lesson = _dbContext.Lessons.Find(id); + + return lesson == null ? NotFound() : lesson; + } + + // POST: / + [HttpPost] + public ActionResult CreateLesson(LessonModel lesson) + { + if (!StudentsExists(lesson.StudentLessonsId)) + { + return BadRequest(" "); + } + + _dbContext.Lessons.Add(lesson); + _dbContext.SaveChangesAsync(); + + return CreatedAtAction(nameof(GetLesson), new { id = lesson.Id }, lesson); + } + + // PUT: /{id} + [HttpPut("{id}")] + public IActionResult UpdateLesson(int id, LessonModel lesson) + { + if (!LessonExists(lesson.StudentLessonsId)) + { + return BadRequest(" "); + } + + if (id != lesson.Id) + { + return BadRequest(); + } + + _dbContext.Entry(lesson).State = EntityState.Modified; + + try + { + _dbContext.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!StudentsExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return NoContent(); + } + + // DELETE: /{id} + [HttpDelete("{id}")] + public IActionResult DeleteLesson(int id) + { + var lesson = _dbContext.Lessons.Find(id); + if (lesson == null) + { + return NotFound(); + } + + _dbContext.Lessons.Remove(lesson); + _dbContext.SaveChangesAsync(); + + return StatusCode(200); + } + + private bool LessonExists(int id) + { + return _dbContext.Lessons + .Any(e => e.Id == id); + } + + private bool StudentsExists(int studentId) + { + var client = _clientFactory.CreateClient("StudentService"); + var response = client.GetAsync($"Students/{studentId}"); + return response.Result.IsSuccessStatusCode; + } + } +} \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/DatabaseAccess/LessonModel.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/DatabaseAccess/LessonModel.cs new file mode 100644 index 0000000..dd568e2 --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/DatabaseAccess/LessonModel.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +namespace Lessons.DatabaseAccess +{ + public class LessonModel + { + [Key] + public int Id { get; set; } + + [Required] + public string Name { get; set; } + + [Required] + public string Description { get; set; } + + [Required] + public int StudentLessonsId { get; set; } + } +} diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/DatabaseAccess/LessonsDatabase.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/DatabaseAccess/LessonsDatabase.cs new file mode 100644 index 0000000..f17a63b --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/DatabaseAccess/LessonsDatabase.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; + +namespace Lessons.DatabaseAccess +{ + public partial class LessonsDatabase : DbContext + { + public LessonsDatabase() + { + } + + public LessonsDatabase(DbContextOptions options) + : base(options) + { + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + + public virtual DbSet Lessons { set; get; } + } +} diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Dockerfile b/sergeev_evgenii_lab_3/Lessons/Lessons/Dockerfile new file mode 100644 index 0000000..4e63750 --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Dockerfile @@ -0,0 +1,27 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +ENV ASPNETCORE_URLS=http://+:80 +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["Lessons/Lessons.csproj", "Lessons/"] +RUN dotnet restore "Lessons/Lessons.csproj" +COPY . . +WORKDIR "/src/Lessons" +RUN dotnet build "Lessons.csproj" -c Release -o /app/build + +#RUN dotnet tool install --global dotnet-ef --version 6.0.26 +#ENV PATH="$PATH:/root/.dotnet/tools" +#RUN dotnet ef migrations add InitCreate +#RUN dotnet ef database update + +FROM build AS publish +RUN dotnet publish "Lessons.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Lessons.dll"] \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Lessons.csproj b/sergeev_evgenii_lab_3/Lessons/Lessons/Lessons.csproj new file mode 100644 index 0000000..64763ac --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Lessons.csproj @@ -0,0 +1,26 @@ + + + + net6.0 + enable + enable + c0f1514d-0c72-4e1c-bf59-1472405b4d01 + Linux + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/20240118232940_InitCreate.Designer.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/20240118232940_InitCreate.Designer.cs new file mode 100644 index 0000000..d360543 --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/20240118232940_InitCreate.Designer.cs @@ -0,0 +1,52 @@ +// +using Lessons.DatabaseAccess; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Lessons.Migrations +{ + [DbContext(typeof(LessonsDatabase))] + [Migration("20240118232940_InitCreate")] + partial class InitCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.26") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Lessons.DatabaseAccess.LessonModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentLessonsId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Lessons"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/20240118232940_InitCreate.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/20240118232940_InitCreate.cs new file mode 100644 index 0000000..943a29a --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/20240118232940_InitCreate.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Lessons.Migrations +{ + public partial class InitCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Lessons", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + StudentLessonsId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Lessons", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Lessons"); + } + } +} diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/LessonsDatabaseModelSnapshot.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/LessonsDatabaseModelSnapshot.cs new file mode 100644 index 0000000..18a81d9 --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Migrations/LessonsDatabaseModelSnapshot.cs @@ -0,0 +1,50 @@ +// +using Lessons.DatabaseAccess; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Lessons.Migrations +{ + [DbContext(typeof(LessonsDatabase))] + partial class LessonsDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.26") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Lessons.DatabaseAccess.LessonModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentLessonsId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Lessons"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Program.cs b/sergeev_evgenii_lab_3/Lessons/Lessons/Program.cs new file mode 100644 index 0000000..106bae0 --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Program.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore; +using Lessons.DatabaseAccess; +using Microsoft.Extensions.Configuration; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +builder.Services.AddDbContext(options => +{ + options.UseNpgsql(builder.Configuration.GetConnectionString("DBConnect")); +}); + +builder.Services.AddHttpClient("StudentService", client => +{ + client.BaseAddress = new Uri("http://student-service:8080/"); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/Properties/launchSettings.json b/sergeev_evgenii_lab_3/Lessons/Lessons/Properties/launchSettings.json new file mode 100644 index 0000000..84d27fe --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/Properties/launchSettings.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:44046", + "sslPort": 44366 + } + }, + "profiles": { + "Lessons": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:7200;http://localhost:5200", + "dotnetRunMessages": true + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/appsettings.Development.json b/sergeev_evgenii_lab_3/Lessons/Lessons/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/sergeev_evgenii_lab_3/Lessons/Lessons/appsettings.json b/sergeev_evgenii_lab_3/Lessons/Lessons/appsettings.json new file mode 100644 index 0000000..27abace --- /dev/null +++ b/sergeev_evgenii_lab_3/Lessons/Lessons/appsettings.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "DBConnect": "Host=db-entering-system;Port=5434;Database=testdb;Username=zhenya;Password=12345678" + } +} diff --git a/sergeev_evgenii_lab_3/README.md b/sergeev_evgenii_lab_3/README.md new file mode 100644 index 0000000..8b3a80a --- /dev/null +++ b/sergeev_evgenii_lab_3/README.md @@ -0,0 +1,26 @@ +Сергеев Е. Д. ПИбд-42 + +Было разработано два сервиса реализующих CRUD двух сущностей, которые соответствуют теме диплома +"Система учёта посещаемости студентов" + +Один сервис ответственен за занятия, второй - за студентов + +У одного проекта есть несколько решений: + +Сервис для Студентов: +![Alt text](images/img_students.png) + +Сервис для Занятий: +![Alt text](images/img_lessons.png) + +Создается http-клиент для взаимодействия со вторым сервисом + +![Http-клиент](images/img_client.png) + +![Alt text](images/img_access.png) + +Ссылка на видео: +https://youtu.be/26zPVaWqJss + +Запуск: +docker-compose up -d запустит все контейнеры, определенные в файле docker-compose.yml, в фоновом режиме \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Students/.dockerignore b/sergeev_evgenii_lab_3/Students/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Students/Students.sln b/sergeev_evgenii_lab_3/Students/Students.sln new file mode 100644 index 0000000..bb1828d --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32319.34 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Students", "Students\Students.csproj", "{6EB357ED-FCFC-4069-83CC-52E8CAA9EB17}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6EB357ED-FCFC-4069-83CC-52E8CAA9EB17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6EB357ED-FCFC-4069-83CC-52E8CAA9EB17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6EB357ED-FCFC-4069-83CC-52E8CAA9EB17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6EB357ED-FCFC-4069-83CC-52E8CAA9EB17}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D536BCA3-6838-45AE-BB91-654277E1439E} + EndGlobalSection +EndGlobal diff --git a/sergeev_evgenii_lab_3/Students/Students/Controllers/StudentController.cs b/sergeev_evgenii_lab_3/Students/Students/Controllers/StudentController.cs new file mode 100644 index 0000000..b132284 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Controllers/StudentController.cs @@ -0,0 +1,100 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Students.DatabaseAccess; + +namespace Students.Controllers +{ + [ApiController] + [Route("[controller]")] + public class StudentController : ControllerBase + { + private readonly StudentsDatabase _dbContext; + private readonly ILogger _logger; + + public StudentController(ILogger logger, StudentsDatabase dbContext) + { + _logger = logger; + _dbContext = dbContext; + } + + // GET: / + [HttpGet] + public ActionResult> GetAllStudents() + { + return _dbContext.Students.ToList(); + } + + // GET: /{id} ID + [HttpGet("{id}")] + public ActionResult GetStudent(int id) + { + var student = _dbContext.Students.Find(id); + + return student == null ? NotFound() : student; + } + + // POST: / + [HttpPost] + public ActionResult CreateStudent(StudentModel student) + { + _dbContext.Students.Add(student); + + _dbContext.SaveChangesAsync(); + + return CreatedAtAction(nameof(GetStudent), new { id = student.Id }, student); + } + + // PUT: /{id} + [HttpPut("{id}")] + public IActionResult UpdateStudent(int id, StudentModel student) + { + if (id != student.Id) + { + return BadRequest(); + } + + _dbContext.Entry(student).State = EntityState.Modified; + + try + { + _dbContext.SaveChanges(); + } + catch (DbUpdateConcurrencyException) + { + if (!StudentExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return StatusCode(200); + } + + // DELETE: /{id} + [HttpDelete("{id}")] + public IActionResult DeleteStudent(int id) + { + var student = _dbContext.Students.Find(id); + if (student == null) + { + return NotFound(); + } + + _dbContext.Students.Remove(student); + + _dbContext.SaveChanges(); + + return StatusCode(200); + } + + private bool StudentExists(int id) + { + return _dbContext.Students + .Any(e => e.Id == id); + } + } +} \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Students/Students/DatabaseAccess/StudentModel.cs b/sergeev_evgenii_lab_3/Students/Students/DatabaseAccess/StudentModel.cs new file mode 100644 index 0000000..744f17d --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/DatabaseAccess/StudentModel.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Students.DatabaseAccess +{ + public partial class StudentModel + { + [Key] + public int Id { get; set; } + [Required] + public string Name { get; set; } + [Required] + public string Surname { get; set; } + + public DateTime EnterDate { get; set; } = DateTime.Now; + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/DatabaseAccess/StudentsDatabase.cs b/sergeev_evgenii_lab_3/Students/Students/DatabaseAccess/StudentsDatabase.cs new file mode 100644 index 0000000..bb881ea --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/DatabaseAccess/StudentsDatabase.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; + +namespace Students.DatabaseAccess +{ + public partial class StudentsDatabase : DbContext + { + public StudentsDatabase() + { + } + + public StudentsDatabase(DbContextOptions options) + : base(options) + { + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + + public virtual DbSet Students { set; get; } + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/Dockerfile b/sergeev_evgenii_lab_3/Students/Students/Dockerfile new file mode 100644 index 0000000..3314802 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Dockerfile @@ -0,0 +1,28 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +ENV ASPNETCORE_URLS=http://+:80 +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["Students/Students.csproj", "Students/"] +RUN dotnet restore "Students/Students.csproj" +COPY . . +WORKDIR "/src/Students" +RUN dotnet build "Students.csproj" -c Release -o /app/build + +#RUN dotnet tool install --global dotnet-ef --version 6.0.26 +#ENV PATH="$PATH:/root/.dotnet/tools" +#RUN dotnet ef migrations add InitCreate2 +#RUN dotnet ef database update + +FROM build AS publish +RUN dotnet publish "Students.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Students.dll"] \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Students/Students/Migrations/20240118223501_Init.Designer.cs b/sergeev_evgenii_lab_3/Students/Students/Migrations/20240118223501_Init.Designer.cs new file mode 100644 index 0000000..1a07008 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Migrations/20240118223501_Init.Designer.cs @@ -0,0 +1,53 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Students.DatabaseAccess; + +#nullable disable + +namespace Students.Migrations +{ + [DbContext(typeof(StudentsDatabase))] + [Migration("20240118223501_Init")] + partial class Init + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.26") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Students.DatabaseAccess.StudentModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EnterDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Students"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/Migrations/20240118223501_Init.cs b/sergeev_evgenii_lab_3/Students/Students/Migrations/20240118223501_Init.cs new file mode 100644 index 0000000..74913c0 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Migrations/20240118223501_Init.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Students.Migrations +{ + public partial class Init : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Students", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Surname = table.Column(type: "text", nullable: false), + EnterDate = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Students", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Students"); + } + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/Migrations/StudentsDatabaseModelSnapshot.cs b/sergeev_evgenii_lab_3/Students/Students/Migrations/StudentsDatabaseModelSnapshot.cs new file mode 100644 index 0000000..9bc118c --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Migrations/StudentsDatabaseModelSnapshot.cs @@ -0,0 +1,51 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Students.DatabaseAccess; + +#nullable disable + +namespace Students.Migrations +{ + [DbContext(typeof(StudentsDatabase))] + partial class StudentsDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.26") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Students.DatabaseAccess.StudentModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EnterDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Students"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/Program.cs b/sergeev_evgenii_lab_3/Students/Students/Program.cs new file mode 100644 index 0000000..d85e105 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Program.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore; +using Students.DatabaseAccess; +using Microsoft.Extensions.Configuration; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +builder.Services.AddDbContext(options => +{ + options.UseNpgsql(builder.Configuration.GetConnectionString("DBConnect")); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +//app.UseEndpoints(endpoints => +//{ +// endpoints.MapControllers(); +//}); + +app.MapControllers(); + +app.Run(); diff --git a/sergeev_evgenii_lab_3/Students/Students/Properties/launchSettings.json b/sergeev_evgenii_lab_3/Students/Students/Properties/launchSettings.json new file mode 100644 index 0000000..e3ef309 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Properties/launchSettings.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:3352", + "sslPort": 44303 + } + }, + "profiles": { + "Students": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:7010;http://localhost:5010", + "dotnetRunMessages": true + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/Students/Students/Students.csproj b/sergeev_evgenii_lab_3/Students/Students/Students.csproj new file mode 100644 index 0000000..b8153b4 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/Students.csproj @@ -0,0 +1,26 @@ + + + + net6.0 + enable + enable + b1c24042-2de9-4095-8109-8d1054148b8d + Linux + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/sergeev_evgenii_lab_3/Students/Students/appsettings.Development.json b/sergeev_evgenii_lab_3/Students/Students/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/appsettings.json b/sergeev_evgenii_lab_3/Students/Students/appsettings.json new file mode 100644 index 0000000..27abace --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/appsettings.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "DBConnect": "Host=db-entering-system;Port=5434;Database=testdb;Username=zhenya;Password=12345678" + } +} diff --git a/sergeev_evgenii_lab_3/Students/Students/libman.json b/sergeev_evgenii_lab_3/Students/Students/libman.json new file mode 100644 index 0000000..ceee271 --- /dev/null +++ b/sergeev_evgenii_lab_3/Students/Students/libman.json @@ -0,0 +1,5 @@ +{ + "version": "1.0", + "defaultProvider": "cdnjs", + "libraries": [] +} \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/docker-compose.yml b/sergeev_evgenii_lab_3/docker-compose.yml new file mode 100644 index 0000000..7b67eaf --- /dev/null +++ b/sergeev_evgenii_lab_3/docker-compose.yml @@ -0,0 +1,52 @@ +version: '3' + +services: + db-entering-system: + container_name: npgsql-db-entering-system + image: postgres:14.0 + environment: + POSTGRES_DB: "testdb" + POSTGRES_USER: "zhenya" + POSTGRES_PASSWORD: "12345678" + PGDATA: "/var/lib/postgresql/data/pgdata" + ports: + - "5434:5432" + volumes: + - postgresql-data:/var/lib/postgresql/data + networks: + - entering-system-network + + student-service: + container_name: student-service + depends_on: + - db-entering-system + environment: + - ASPNETCORE_ENVIRONMENT=Development + build: + context: ./Students + dockerfile: ./Students/Dockerfile + ports: + - 8086:80 + networks: + - entering-system-network + + lesson-service: + container_name: lesson-service + depends_on: + - db-entering-system + environment: + - ASPNETCORE_ENVIRONMENT=Development + build: + context: ./Lessons + dockerfile: ./Lessons/Dockerfile + ports: + - 8088:80 + networks: + - entering-system-network + +networks: + entering-system-network: + driver: bridge + +volumes: + postgresql-data: \ No newline at end of file diff --git a/sergeev_evgenii_lab_3/images/img_access.png b/sergeev_evgenii_lab_3/images/img_access.png new file mode 100644 index 0000000..db87060 Binary files /dev/null and b/sergeev_evgenii_lab_3/images/img_access.png differ diff --git a/sergeev_evgenii_lab_3/images/img_client.png b/sergeev_evgenii_lab_3/images/img_client.png new file mode 100644 index 0000000..5abda4e Binary files /dev/null and b/sergeev_evgenii_lab_3/images/img_client.png differ diff --git a/sergeev_evgenii_lab_3/images/img_lessons.png b/sergeev_evgenii_lab_3/images/img_lessons.png new file mode 100644 index 0000000..dde3bb5 Binary files /dev/null and b/sergeev_evgenii_lab_3/images/img_lessons.png differ diff --git a/sergeev_evgenii_lab_3/images/img_students.png b/sergeev_evgenii_lab_3/images/img_students.png new file mode 100644 index 0000000..28ba176 Binary files /dev/null and b/sergeev_evgenii_lab_3/images/img_students.png differ