From 399a8a6c59449e0655ba3b1f4191d75a6fcdf604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 10 Jul 2023 16:43:58 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Добавил флаг прочитано ли уведомление 2. Добавил новые миграции --- AsbCloudApp/Data/NotificationDto.cs | 5 +++++ ...r.cs => 20230710113646_Add_Notifications.Designer.cs} | 9 +++++++-- ...tification.cs => 20230710113646_Add_Notifications.cs} | 5 +++-- AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs | 5 +++++ AsbCloudDb/Model/DefaultData/DefaultContextData.cs | 4 +++- AsbCloudDb/Model/Notification.cs | 3 +++ 6 files changed, 26 insertions(+), 5 deletions(-) rename AsbCloudDb/Migrations/{20230707112234_Add_Notification.Designer.cs => 20230710113646_Add_Notifications.Designer.cs} (99%) rename AsbCloudDb/Migrations/{20230707112234_Add_Notification.cs => 20230710113646_Add_Notifications.cs} (97%) 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!;