Squash and merge of version-0.1 Co-authored-by: James Wampler <james@wamp.dev> Co-committed-by: James Wampler <james@wamp.dev>
20 lines
697 B
C#
Executable File
20 lines
697 B
C#
Executable File
using MicCheck.Api.Common.Security.ApiKeys;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace MicCheck.Api.Data.Configurations;
|
|
|
|
public class ApiKeyConfiguration : IEntityTypeConfiguration<ApiKey>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ApiKey> builder)
|
|
{
|
|
builder.HasKey(k => k.Id);
|
|
builder.Property(k => k.Key).HasMaxLength(512).IsRequired();
|
|
builder.Property(k => k.Prefix).HasMaxLength(8).IsRequired();
|
|
builder.Property(k => k.Name).HasMaxLength(200).IsRequired();
|
|
builder.Property(k => k.CreatedAt).IsRequired();
|
|
|
|
builder.HasIndex(k => k.Key).IsUnique();
|
|
}
|
|
}
|