feat: добавил личные уведомления для пользователей
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 9s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 26s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 19s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 8s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 9s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 26s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 19s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 8s
Реализовал хранение, получение и отметку прочитанными пользовательских уведомлений. Обновил фронтенд для отображения и управления уведомлениями в профиле студента.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using UniVerse.Domain.Entities;
|
||||
|
||||
namespace UniVerse.Infrastructure.Data.Configurations;
|
||||
|
||||
public class UserNotificationConfiguration : IEntityTypeConfiguration<UserNotification>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserNotification> builder)
|
||||
{
|
||||
builder.ToTable("user_notifications");
|
||||
|
||||
builder.HasKey(n => n.Id);
|
||||
builder.Property(n => n.Id).HasColumnName("id");
|
||||
builder.Property(n => n.UserId).HasColumnName("user_id");
|
||||
builder.Property(n => n.Type).HasColumnName("type").HasMaxLength(50).IsRequired();
|
||||
builder.Property(n => n.Title).HasColumnName("title").HasMaxLength(255).IsRequired();
|
||||
builder.Property(n => n.Body).HasColumnName("body").HasMaxLength(1000).IsRequired();
|
||||
builder.Property(n => n.IsRead).HasColumnName("is_read").HasDefaultValue(false);
|
||||
builder.Property(n => n.CreatedAt).HasColumnName("created_at").HasDefaultValueSql("NOW()");
|
||||
|
||||
builder.HasOne(n => n.User)
|
||||
.WithMany(u => u.Notifications)
|
||||
.HasForeignKey(n => n.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasIndex(n => new { n.UserId, n.CreatedAt });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user