aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Data/AppDbContext.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Enmarcha.Backend/Data/AppDbContext.cs')
-rw-r--r--src/Enmarcha.Backend/Data/AppDbContext.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Enmarcha.Backend/Data/AppDbContext.cs b/src/Enmarcha.Backend/Data/AppDbContext.cs
index d5a29ee..e191b26 100644
--- a/src/Enmarcha.Backend/Data/AppDbContext.cs
+++ b/src/Enmarcha.Backend/Data/AppDbContext.cs
@@ -14,6 +14,7 @@ public class AppDbContext : IdentityDbContext<IdentityUser>
}
public DbSet<ServiceAlert> ServiceAlerts { get; set; }
+ public DbSet<PushSubscription> PushSubscriptions { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
@@ -72,5 +73,11 @@ public class AppDbContext : IdentityDbContext<IdentityUser>
v => JsonSerializer.Deserialize<List<string>>(v, (JsonSerializerOptions?)null) ?? new List<string>(),
JsonComparer<List<string>>());
});
+
+ builder.Entity<PushSubscription>(b =>
+ {
+ b.HasKey(x => x.Id);
+ b.HasIndex(x => x.Endpoint).IsUnique();
+ });
}
}