mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-11-15 18:37:10 +01:00
Co-authored-by: Kieran <kieran@harkin.me> Reviewed-on: https://git.v0l.io/Kieran/void.cat/pulls/65
26 lines
659 B
C#
26 lines
659 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace VoidCat.Database.Configurations;
|
|
|
|
public class ApiKeyConfiguration : IEntityTypeConfiguration<ApiKey>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ApiKey> builder)
|
|
{
|
|
builder.ToTable("ApiKey");
|
|
builder.HasKey(a => a.Id);
|
|
builder.Property(a => a.Token)
|
|
.IsRequired();
|
|
|
|
builder.Property(a => a.Expiry)
|
|
.IsRequired();
|
|
|
|
builder.Property(a => a.Created)
|
|
.IsRequired();
|
|
|
|
builder.HasOne(a => a.User)
|
|
.WithMany()
|
|
.HasForeignKey(a => a.UserId);
|
|
}
|
|
}
|