mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
33 lines
892 B
C#
33 lines
892 B
C#
using Govor.Core.Models.Users;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Govor.Data.Configurations;
|
|
|
|
public class UserPushTokenConfiguration : IEntityTypeConfiguration<UserPushToken>
|
|
{
|
|
public void Configure(EntityTypeBuilder<UserPushToken> builder)
|
|
{
|
|
builder.HasKey(t => t.Id);
|
|
|
|
builder.HasIndex(x => x.Token)
|
|
.IsUnique();
|
|
|
|
builder.HasIndex(x => x.UserSessionId)
|
|
.IsUnique();
|
|
|
|
builder.HasIndex(x => new { x.UserId, x.IsActive });
|
|
|
|
builder.Property(x => x.Token)
|
|
.IsRequired()
|
|
.HasMaxLength(512);
|
|
|
|
builder.Property(x => x.Platform)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
builder.Property(x => x.Provider)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
}
|
|
} |