From 4cc09025fe58c4110e48e94139055ed916749134 Mon Sep 17 00:00:00 2001 From: Lisoveliy Date: Thu, 10 Jul 2025 16:00:35 +0300 Subject: [PATCH] fix: fixed build of projects --- .../20250501164641_InitialCreate.Designer.cs | 52 ------------------- .../20250501165245_UpdateUser.Designer.cs | 50 ------------------ .../Migrations/20250501165245_UpdateUser.cs | 50 ------------------ .../Migrations/20250501165633_AddTimeStamp.cs | 30 ----------- ....cs => 20250710125338_Initial.Designer.cs} | 7 ++- ...ialCreate.cs => 20250710125338_Initial.cs} | 7 +-- .../Migrations/AppDbContextModelSnapshot.cs | 3 ++ JOBot.Backend/Dockerfile | 2 + JOBot.Backend/Program.cs | 2 +- JOBot.Backend/Startup.cs | 2 + JOBot.Backend/appsettings.json | 10 ++-- JOBot.TClient/JOBot.TClient.csproj | 1 + JOBot.TClient/Program.cs | 9 +++- 13 files changed, 33 insertions(+), 192 deletions(-) delete mode 100644 JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.Designer.cs delete mode 100644 JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.Designer.cs delete mode 100644 JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.cs delete mode 100644 JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.cs rename JOBot.Backend/Data/Migrations/{20250501165633_AddTimeStamp.Designer.cs => 20250710125338_Initial.Designer.cs} (90%) rename JOBot.Backend/Data/Migrations/{20250501164641_InitialCreate.cs => 20250710125338_Initial.cs} (78%) diff --git a/JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.Designer.cs b/JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.Designer.cs deleted file mode 100644 index 7263472..0000000 --- a/JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.Designer.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -using System; -using JOBot.Backend.DAL.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace JOBot.Backend.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250501164641_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("JOBot.Backend.DAL.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("TelegramId") - .HasColumnType("bigint"); - - b.Property("Username") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasAlternateKey("TelegramId"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.Designer.cs b/JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.Designer.cs deleted file mode 100644 index fe93466..0000000 --- a/JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.Designer.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -using System; -using JOBot.Backend.DAL.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace JOBot.Backend.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250501165245_UpdateUser")] - partial class UpdateUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("JOBot.Backend.DAL.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("TelegramId") - .HasColumnType("bigint"); - - b.Property("Username") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.HasAlternateKey("TelegramId"); - - b.ToTable("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.cs b/JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.cs deleted file mode 100644 index 22073d8..0000000 --- a/JOBot.Backend/Data/Migrations/20250501165245_UpdateUser.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace JOBot.Backend.Data.Migrations -{ - /// - public partial class UpdateUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "Users"); - - migrationBuilder.AlterColumn( - name: "Username", - table: "Users", - type: "character varying(50)", - maxLength: 50, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Username", - table: "Users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(50)", - oldMaxLength: 50, - oldNullable: true); - - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "Users", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - } - } -} diff --git a/JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.cs b/JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.cs deleted file mode 100644 index 35dd638..0000000 --- a/JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace JOBot.Backend.Data.Migrations -{ - /// - public partial class AddTimeStamp : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "Users", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "Users"); - } - } -} diff --git a/JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.Designer.cs b/JOBot.Backend/Data/Migrations/20250710125338_Initial.Designer.cs similarity index 90% rename from JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.Designer.cs rename to JOBot.Backend/Data/Migrations/20250710125338_Initial.Designer.cs index ee9e7b9..24df0f4 100644 --- a/JOBot.Backend/Data/Migrations/20250501165633_AddTimeStamp.Designer.cs +++ b/JOBot.Backend/Data/Migrations/20250710125338_Initial.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace JOBot.Backend.Data.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20250501165633_AddTimeStamp")] - partial class AddTimeStamp + [Migration("20250710125338_Initial")] + partial class Initial { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -34,6 +34,9 @@ namespace JOBot.Backend.Data.Migrations b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); + b.Property("HeadHunterResumeUrl") + .HasColumnType("text"); + b.Property("TelegramId") .HasColumnType("bigint"); diff --git a/JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.cs b/JOBot.Backend/Data/Migrations/20250710125338_Initial.cs similarity index 78% rename from JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.cs rename to JOBot.Backend/Data/Migrations/20250710125338_Initial.cs index ed3cae4..f868d53 100644 --- a/JOBot.Backend/Data/Migrations/20250501164641_InitialCreate.cs +++ b/JOBot.Backend/Data/Migrations/20250710125338_Initial.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace JOBot.Backend.Data.Migrations { /// - public partial class InitialCreate : Migration + public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -17,8 +17,9 @@ namespace JOBot.Backend.Data.Migrations { Id = table.Column(type: "uuid", nullable: false), TelegramId = table.Column(type: "bigint", nullable: false), - Username = table.Column(type: "text", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + Username = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + HeadHunterResumeUrl = table.Column(type: "text", nullable: true) }, constraints: table => { diff --git a/JOBot.Backend/Data/Migrations/AppDbContextModelSnapshot.cs b/JOBot.Backend/Data/Migrations/AppDbContextModelSnapshot.cs index b4aae05..24a6ae6 100644 --- a/JOBot.Backend/Data/Migrations/AppDbContextModelSnapshot.cs +++ b/JOBot.Backend/Data/Migrations/AppDbContextModelSnapshot.cs @@ -31,6 +31,9 @@ namespace JOBot.Backend.Data.Migrations b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); + b.Property("HeadHunterResumeUrl") + .HasColumnType("text"); + b.Property("TelegramId") .HasColumnType("bigint"); diff --git a/JOBot.Backend/Dockerfile b/JOBot.Backend/Dockerfile index ef4caf5..da0d968 100644 --- a/JOBot.Backend/Dockerfile +++ b/JOBot.Backend/Dockerfile @@ -8,4 +8,6 @@ RUN dotnet publish "JOBot.Backend/JOBot.Backend.csproj" -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet:9.0 WORKDIR /app COPY --from=build /app . +EXPOSE 5001 +EXPOSE 5000 ENTRYPOINT ["dotnet", "JOBot.Backend.dll"] \ No newline at end of file diff --git a/JOBot.Backend/Program.cs b/JOBot.Backend/Program.cs index cc05177..95467a3 100644 --- a/JOBot.Backend/Program.cs +++ b/JOBot.Backend/Program.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Server.Kestrel.Core; +using JOBot.Backend; var builder = WebApplication.CreateBuilder(args); diff --git a/JOBot.Backend/Startup.cs b/JOBot.Backend/Startup.cs index a1b0a0c..3a2c585 100644 --- a/JOBot.Backend/Startup.cs +++ b/JOBot.Backend/Startup.cs @@ -2,6 +2,8 @@ using JOBot.Backend.DAL.Context; using JOBot.Backend.Services.gRPC; using Microsoft.EntityFrameworkCore; +namespace JOBot.Backend; + public class Startup { public Startup(IConfiguration configuration) diff --git a/JOBot.Backend/appsettings.json b/JOBot.Backend/appsettings.json index 01f5b1d..6bb04e6 100644 --- a/JOBot.Backend/appsettings.json +++ b/JOBot.Backend/appsettings.json @@ -7,13 +7,17 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "PostgreSQL": "Host=localhost;Port=5432;Database=jobot;Username=postgres;Password=LocalDbPass" + "PostgreSQL": "Host=postgres;Port=5432;Database=jobot;Username=postgres;Password=LocalDbPass" }, "Kestrel": { "Endpoints": { - "Http": { - "Url": "http://localhost:5001", + "gRPC": { + "Url": "http://*:5001", "Protocols": "Http2" + }, + "REST": { + "Url": "http://*:5000", + "Protocols": "Http1" } } } diff --git a/JOBot.TClient/JOBot.TClient.csproj b/JOBot.TClient/JOBot.TClient.csproj index f6feafd..1639923 100644 --- a/JOBot.TClient/JOBot.TClient.csproj +++ b/JOBot.TClient/JOBot.TClient.csproj @@ -10,6 +10,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/JOBot.TClient/Program.cs b/JOBot.TClient/Program.cs index b3b4a8d..a352217 100644 --- a/JOBot.TClient/Program.cs +++ b/JOBot.TClient/Program.cs @@ -1,5 +1,8 @@ -using JOBot.TClient; +using JOBot.Proto; +using JOBot.TClient; +using JOBot.TClient.Commands; using JOBot.TClient.Core.HostedServices; +using JOBot.TClient.Core.Services; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -11,6 +14,10 @@ var host = Host.CreateDefaultBuilder(args) // Фоновый сервис для бота services.AddHostedService(); + + services.AddScoped(); + services.AddSingleton(); + services.AddGrpcClient(o => o.Address = new Uri("http://backend:5001")); }) .Build();