feat: created register method for entry
This commit is contained in:
@@ -8,4 +8,12 @@ class AppDbContext : DbContext
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<User>()
|
||||
.HasAlternateKey(b => b.TelegramId);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace JOBot.Backend.DAL.Models;
|
||||
|
||||
[PrimaryKey(nameof(Id))]
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public long TelegramId { get; set; }
|
||||
|
||||
[Key]
|
||||
public required long TelegramId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
}
|
||||
Reference in New Issue
Block a user