mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[reputation] Move reputation to separate module.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Kruzya.TelegramBot.Core.EF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace West.TelegramBot.Reputation.Data;
|
||||
|
||||
public class ReputationContext : AutoSaveDbContext
|
||||
{
|
||||
public DbSet<UserReputation> UserReputation { get; set; } = null!;
|
||||
|
||||
public ReputationContext(DbContextOptions<ReputationContext> options) : base(options)
|
||||
{
|
||||
Database.EnsureCreated();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<UserReputation>().HasKey(e => new {e.ChatId, e.UserId});
|
||||
modelBuilder.Entity<UserReputation>().HasIndex(e => e.ChatId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user