fix: fixed build of projects

This commit is contained in:
Pavel-Savely Savianok 2025-07-10 16:00:35 +03:00
parent ace122dbbd
commit 4cc09025fe
13 changed files with 33 additions and 192 deletions

View File

@ -1,52 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<long>("TelegramId")
.HasColumnType("bigint");
b.Property<string>("Username")
.HasColumnType("text");
b.HasKey("Id");
b.HasAlternateKey("TelegramId");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,50 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<long>("TelegramId")
.HasColumnType("bigint");
b.Property<string>("Username")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasAlternateKey("TelegramId");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,50 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JOBot.Backend.Data.Migrations
{
/// <inheritdoc />
public partial class UpdateUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Users");
migrationBuilder.AlterColumn<string>(
name: "Username",
table: "Users",
type: "character varying(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Username",
table: "Users",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "Users",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
}
}

View File

@ -1,30 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JOBot.Backend.Data.Migrations
{
/// <inheritdoc />
public partial class AddTimeStamp : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "Users",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Users");
}
}
}

View File

@ -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
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -34,6 +34,9 @@ namespace JOBot.Backend.Data.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("HeadHunterResumeUrl")
.HasColumnType("text");
b.Property<long>("TelegramId")
.HasColumnType("bigint");

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace JOBot.Backend.Data.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -17,8 +17,9 @@ namespace JOBot.Backend.Data.Migrations
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TelegramId = table.Column<long>(type: "bigint", nullable: false),
Username = table.Column<string>(type: "text", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
Username = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
HeadHunterResumeUrl = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{

View File

@ -31,6 +31,9 @@ namespace JOBot.Backend.Data.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("HeadHunterResumeUrl")
.HasColumnType("text");
b.Property<long>("TelegramId")
.HasColumnType("bigint");

View File

@ -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"]

View File

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Server.Kestrel.Core;
using JOBot.Backend;
var builder = WebApplication.CreateBuilder(args);

View File

@ -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)

View File

@ -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"
}
}
}

View File

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.30.2" />
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.71.0" />
<PackageReference Include="Grpc.Tools" Version="2.71.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>

View File

@ -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<BotBackgroundService>();
services.AddScoped<StartCommand>();
services.AddSingleton<UserService>();
services.AddGrpcClient<User.UserClient>(o => o.Address = new Uri("http://backend:5001"));
})
.Build();