mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[reputation] Use file-scoped namespaces.
This commit is contained in:
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace West.TelegramBot.Reputation.Migrations
|
namespace West.TelegramBot.Reputation.Migrations;
|
||||||
{
|
|
||||||
public partial class Initial : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterDatabase()
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
public partial class Initial : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterDatabase()
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
name: "UserReputation",
|
name: "UserReputation",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
@@ -23,18 +23,17 @@ namespace West.TelegramBot.Reputation.Migrations
|
|||||||
{
|
{
|
||||||
table.PrimaryKey("PK_UserReputation", x => new { x.ChatId, x.UserId });
|
table.PrimaryKey("PK_UserReputation", x => new { x.ChatId, x.UserId });
|
||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_UserReputation_ChatId",
|
name: "IX_UserReputation_ChatId",
|
||||||
table: "UserReputation",
|
table: "UserReputation",
|
||||||
column: "ChatId");
|
column: "ChatId");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "UserReputation");
|
name: "UserReputation");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,36 +5,35 @@ using West.TelegramBot.Reputation.Data;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace West.TelegramBot.Reputation.Migrations
|
namespace West.TelegramBot.Reputation.Migrations;
|
||||||
|
|
||||||
|
[DbContext(typeof(ReputationContext))]
|
||||||
|
partial class ReputationContextModelSnapshot : ModelSnapshot
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ReputationContext))]
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
partial class ReputationContextModelSnapshot : ModelSnapshot
|
|
||||||
{
|
{
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "6.0.2")
|
.HasAnnotation("ProductVersion", "6.0.2")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
modelBuilder.Entity("West.TelegramBot.ChatManagement.Data.UserReputation", b =>
|
modelBuilder.Entity("West.TelegramBot.ChatManagement.Data.UserReputation", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("ChatId")
|
b.Property<long>("ChatId")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<long>("UserId")
|
b.Property<long>("UserId")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<double>("Value")
|
b.Property<double>("Value")
|
||||||
.HasColumnType("double");
|
.HasColumnType("double");
|
||||||
|
|
||||||
b.HasKey("ChatId", "UserId");
|
b.HasKey("ChatId", "UserId");
|
||||||
|
|
||||||
b.HasIndex("ChatId");
|
b.HasIndex("ChatId");
|
||||||
|
|
||||||
b.ToTable("UserReputation");
|
b.ToTable("UserReputation");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,20 +6,19 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using West.TelegramBot.Reputation.Data;
|
using West.TelegramBot.Reputation.Data;
|
||||||
using West.TelegramBot.Reputation.Service;
|
using West.TelegramBot.Reputation.Service;
|
||||||
|
|
||||||
namespace West.TelegramBot.Reputation
|
namespace West.TelegramBot.Reputation;
|
||||||
|
|
||||||
|
public class Reputation : Module
|
||||||
{
|
{
|
||||||
public class Reputation : Module
|
public Reputation(Core core) : base(core)
|
||||||
{
|
{
|
||||||
public Reputation(Core core) : base(core)
|
}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ConfigureServices(IServiceCollection services)
|
public override void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
var dsn = Configuration.GetConnectionString("Reputation");
|
var dsn = Configuration.GetConnectionString("Reputation");
|
||||||
services.AddDbContext<ReputationContext>(options => options.UseMySql(dsn, ServerVersion.AutoDetect(dsn)));
|
services.AddDbContext<ReputationContext>(options => options.UseMySql(dsn, ServerVersion.AutoDetect(dsn)));
|
||||||
|
|
||||||
services.AddScoped<IReputation, ReputationService>();
|
services.AddScoped<IReputation, ReputationService>();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user