Files

33 lines
1.1 KiB
C#
Raw Permalink Normal View History

2025-09-24 19:36:28 +02:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
2026-01-11 02:30:08 +01:00
using TimetableDesigner.Backend.Services.Authentication.Database.Model;
2025-09-24 19:36:28 +02:00
2026-01-11 02:30:08 +01:00
namespace TimetableDesigner.Backend.Services.Authentication.Database.Configuration;
2025-09-24 19:36:28 +02:00
public class RefreshTokenConfiguration : IEntityTypeConfiguration<RefreshToken>
{
public void Configure(EntityTypeBuilder<RefreshToken> builder)
{
builder.HasKey(x => x.Token);
builder.HasIndex(x => x.Token)
.IsUnique();
builder.Property(x => x.Token)
.IsRequired();
builder.HasOne(x => x.Account)
.WithMany(x => x.RefreshTokens)
.HasForeignKey(x => x.AccountId)
.IsRequired();
builder.Property(x => x.AccountId)
.IsRequired();
builder.Property(x => x.ExpirationDate)
.IsRequired();
builder.Property(x => x.IsExtendable)
.IsRequired();
builder.Property(b => b.Version)
.IsRowVersion();
}
}