diff --git a/AsbCloudApp/Data/NotificationDto.cs b/AsbCloudApp/Data/NotificationDto.cs index ecb33c90..29e50b41 100644 --- a/AsbCloudApp/Data/NotificationDto.cs +++ b/AsbCloudApp/Data/NotificationDto.cs @@ -46,6 +46,11 @@ public class NotificationDto : IId /// Дата отправки уведомления /// public DateTime? SentDateAtUtc { get; set; } + + /// + /// Прочитано ли уведомление + /// + public bool? IsRead { get; set; } /// /// DTO способа доставки уведомления diff --git a/AsbCloudDb/Migrations/20230707112234_Add_Notification.Designer.cs b/AsbCloudDb/Migrations/20230710113646_Add_Notifications.Designer.cs similarity index 99% rename from AsbCloudDb/Migrations/20230707112234_Add_Notification.Designer.cs rename to AsbCloudDb/Migrations/20230710113646_Add_Notifications.Designer.cs index 903ef912..5946f800 100644 --- a/AsbCloudDb/Migrations/20230707112234_Add_Notification.Designer.cs +++ b/AsbCloudDb/Migrations/20230710113646_Add_Notifications.Designer.cs @@ -13,8 +13,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AsbCloudDb.Migrations { [DbContext(typeof(AsbCloudDbContext))] - [Migration("20230707112234_Add_Notification")] - partial class Add_Notification + [Migration("20230710113646_Add_Notifications")] + partial class Add_Notifications { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -1178,6 +1178,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("id_user") .HasComment("Id получателя"); + b.Property("IsRead") + .HasColumnType("boolean") + .HasColumnName("is_read") + .HasComment("Прочитано ли уведомление"); + b.Property("SentDateAtUtc") .HasColumnType("timestamp with time zone") .HasColumnName("sent_date_at_utc") diff --git a/AsbCloudDb/Migrations/20230707112234_Add_Notification.cs b/AsbCloudDb/Migrations/20230710113646_Add_Notifications.cs similarity index 97% rename from AsbCloudDb/Migrations/20230707112234_Add_Notification.cs rename to AsbCloudDb/Migrations/20230710113646_Add_Notifications.cs index b3d56fcf..a5765bc7 100644 --- a/AsbCloudDb/Migrations/20230707112234_Add_Notification.cs +++ b/AsbCloudDb/Migrations/20230710113646_Add_Notifications.cs @@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AsbCloudDb.Migrations { - public partial class Add_Notification : Migration + public partial class Add_Notifications : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -60,7 +60,8 @@ namespace AsbCloudDb.Migrations title = table.Column(type: "text", nullable: false, comment: "Заголовок уведомления"), subject = table.Column(type: "text", nullable: false, comment: "Текст уведомления"), time_to_life = table.Column(type: "interval", nullable: false, comment: "Время жизни уведомления"), - sent_date_at_utc = table.Column(type: "timestamp with time zone", nullable: true, comment: "Дата отправки уведомления") + sent_date_at_utc = table.Column(type: "timestamp with time zone", nullable: true, comment: "Дата отправки уведомления"), + is_read = table.Column(type: "boolean", nullable: true, comment: "Прочитано ли уведомление") }, constraints: table => { diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index 94f4f9b3..7e46cc02 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -1176,6 +1176,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("id_user") .HasComment("Id получателя"); + b.Property("IsRead") + .HasColumnType("boolean") + .HasColumnName("is_read") + .HasComment("Прочитано ли уведомление"); + b.Property("SentDateAtUtc") .HasColumnType("timestamp with time zone") .HasColumnName("sent_date_at_utc") diff --git a/AsbCloudDb/Model/DefaultData/DefaultContextData.cs b/AsbCloudDb/Model/DefaultData/DefaultContextData.cs index bc664a78..637525f0 100644 --- a/AsbCloudDb/Model/DefaultData/DefaultContextData.cs +++ b/AsbCloudDb/Model/DefaultData/DefaultContextData.cs @@ -24,7 +24,9 @@ namespace AsbCloudDb.Model.DefaultData { typeof(WellType), new EntityFillerWellType()}, { typeof(MeasureCategory), new EntityFillerMeasureCategory()}, { typeof(CompanyType), new EntityFillerCompanyType()}, - { typeof(AsbCloudDb.Model.Subsystems.Subsystem), new EntityFillerSubsystem() }, + { typeof(Subsystems.Subsystem), new EntityFillerSubsystem() }, + { typeof(NotificationCategory), new EntityNotificationCategory()}, + { typeof(NotificationTransport), new EntityNotificationTransport() } }; return fillers; } diff --git a/AsbCloudDb/Model/Notification.cs b/AsbCloudDb/Model/Notification.cs index 5df1ef08..d9f63f7a 100644 --- a/AsbCloudDb/Model/Notification.cs +++ b/AsbCloudDb/Model/Notification.cs @@ -32,6 +32,9 @@ public class Notification : IId [Column("sent_date_at_utc"), Comment("Дата отправки уведомления")] public DateTime? SentDateAtUtc { get; set; } + + [Column("is_read"), Comment("Прочитано ли уведомление")] + public bool? IsRead { get; set; } [ForeignKey(nameof(IdNotificationTransport))] public virtual NotificationTransport NotificationTransport { get; set; } = null!;