mirror of
https://github.com/bitwarden/server
synced 2026-01-03 09:03:44 +00:00
[PM-10560] Create notification database storage (#4688)
* Add new tables * Add stored procedures * Add core entities and models * Setup EF * Add repository interfaces * Add dapper repos * Add EF repos * Add order by * EF updates * PM-10560: Notifications repository matching requirements. * PM-10560: Notifications repository matching requirements. * PM-10560: Migration scripts * PM-10560: EF index optimizations * PM-10560: Cleanup * PM-10560: Priority in natural order, Repository, sql simplifications * PM-10560: Title column update * PM-10560: Incorrect EF migration removal * PM-10560: EF migrations * PM-10560: Added views, SP naming simplification * PM-10560: Notification entity Title update, EF migrations * PM-10560: Removing Notification_ReadByUserId * PM-10560: Notification ReadByUserIdAndStatus fix * PM-10560: Notification ReadByUserIdAndStatus fix to be in line with requirements and EF --------- Co-authored-by: Maciej Zieniuk <mzieniuk@bitwarden.com> Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#nullable enable
|
||||
using Bit.Infrastructure.EntityFramework.NotificationCenter.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.NotificationCenter.Configurations;
|
||||
|
||||
public class NotificationEntityTypeConfiguration : IEntityTypeConfiguration<Notification>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Notification> builder)
|
||||
{
|
||||
builder
|
||||
.Property(n => n.Id)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
builder
|
||||
.HasKey(n => n.Id)
|
||||
.IsClustered();
|
||||
|
||||
builder
|
||||
.HasIndex(n => new { n.ClientType, n.Global, n.UserId, n.OrganizationId, n.Priority, n.CreationDate })
|
||||
.IsDescending(false, false, false, false, true, true)
|
||||
.IsClustered(false);
|
||||
|
||||
builder
|
||||
.HasIndex(n => n.OrganizationId)
|
||||
.IsClustered(false);
|
||||
|
||||
builder
|
||||
.HasIndex(n => n.UserId)
|
||||
.IsClustered(false);
|
||||
|
||||
builder.ToTable(nameof(Notification));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#nullable enable
|
||||
using Bit.Infrastructure.EntityFramework.NotificationCenter.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.NotificationCenter.Configurations;
|
||||
|
||||
public class NotificationStatusEntityTypeConfiguration : IEntityTypeConfiguration<NotificationStatus>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<NotificationStatus> builder)
|
||||
{
|
||||
builder
|
||||
.HasKey(ns => new { ns.UserId, ns.NotificationId })
|
||||
.IsClustered();
|
||||
|
||||
builder.ToTable(nameof(NotificationStatus));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user