Telegram.Bot.SpaceApi/Backend/Database/Tables/Bot.cs
2023-04-08 14:47:20 +02:00

26 lines
1 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Telegram.Bot.SpaceApi.Backend.Database.Tables;
public class Bot {
public int Id { get; set; }
public string Name { get; set; } = null!;
public string Token { get; set; } = null!;
public string Chat { get; set; } = null!;
public string ApiUrl { get; set; } = null!;
public string? ApiOverrideAddress { get; set; }
public class Configuration : IEntityTypeConfiguration<Bot> {
public void Configure(EntityTypeBuilder<Bot> builder) {
builder.ToTable("Bots");
builder.HasKey(p => p.Id);
builder.Property(b => b.Name).HasColumnName("Name").IsRequired();
builder.Property(b => b.Chat).HasColumnName("Chat").IsRequired();
builder.Property(b => b.Token).HasColumnName("Token").IsRequired();
builder.Property(b => b.ApiUrl).HasColumnName("ApiUrl").IsRequired();
builder.Property(b => b.ApiOverrideAddress).HasColumnName("ApiOverrideAddress");
}
}
}