Изменение объектов данных

1. Добавил флаг прочитано ли уведомление
2. Добавил новые миграции
This commit is contained in:
parent d1555cc67b
commit 399a8a6c59
6 changed files with 26 additions and 5 deletions

View File

@ -46,6 +46,11 @@ public class NotificationDto : IId
/// Дата отправки уведомления /// Дата отправки уведомления
/// </summary> /// </summary>
public DateTime? SentDateAtUtc { get; set; } public DateTime? SentDateAtUtc { get; set; }
/// <summary>
/// Прочитано ли уведомление
/// </summary>
public bool? IsRead { get; set; }
/// <summary> /// <summary>
/// DTO способа доставки уведомления /// DTO способа доставки уведомления

View File

@ -13,8 +13,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations namespace AsbCloudDb.Migrations
{ {
[DbContext(typeof(AsbCloudDbContext))] [DbContext(typeof(AsbCloudDbContext))]
[Migration("20230707112234_Add_Notification")] [Migration("20230710113646_Add_Notifications")]
partial class Add_Notification partial class Add_Notifications
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -1178,6 +1178,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_user") .HasColumnName("id_user")
.HasComment("Id получателя"); .HasComment("Id получателя");
b.Property<bool?>("IsRead")
.HasColumnType("boolean")
.HasColumnName("is_read")
.HasComment("Прочитано ли уведомление");
b.Property<DateTime?>("SentDateAtUtc") b.Property<DateTime?>("SentDateAtUtc")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("sent_date_at_utc") .HasColumnName("sent_date_at_utc")

View File

@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations namespace AsbCloudDb.Migrations
{ {
public partial class Add_Notification : Migration public partial class Add_Notifications : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -60,7 +60,8 @@ namespace AsbCloudDb.Migrations
title = table.Column<string>(type: "text", nullable: false, comment: "Заголовок уведомления"), title = table.Column<string>(type: "text", nullable: false, comment: "Заголовок уведомления"),
subject = table.Column<string>(type: "text", nullable: false, comment: "Текст уведомления"), subject = table.Column<string>(type: "text", nullable: false, comment: "Текст уведомления"),
time_to_life = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "Время жизни уведомления"), time_to_life = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "Время жизни уведомления"),
sent_date_at_utc = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "Дата отправки уведомления") sent_date_at_utc = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "Дата отправки уведомления"),
is_read = table.Column<bool>(type: "boolean", nullable: true, comment: "Прочитано ли уведомление")
}, },
constraints: table => constraints: table =>
{ {

View File

@ -1176,6 +1176,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_user") .HasColumnName("id_user")
.HasComment("Id получателя"); .HasComment("Id получателя");
b.Property<bool?>("IsRead")
.HasColumnType("boolean")
.HasColumnName("is_read")
.HasComment("Прочитано ли уведомление");
b.Property<DateTime?>("SentDateAtUtc") b.Property<DateTime?>("SentDateAtUtc")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("sent_date_at_utc") .HasColumnName("sent_date_at_utc")

View File

@ -24,7 +24,9 @@ namespace AsbCloudDb.Model.DefaultData
{ typeof(WellType), new EntityFillerWellType()}, { typeof(WellType), new EntityFillerWellType()},
{ typeof(MeasureCategory), new EntityFillerMeasureCategory()}, { typeof(MeasureCategory), new EntityFillerMeasureCategory()},
{ typeof(CompanyType), new EntityFillerCompanyType()}, { 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; return fillers;
} }

View File

@ -32,6 +32,9 @@ public class Notification : IId
[Column("sent_date_at_utc"), Comment("Дата отправки уведомления")] [Column("sent_date_at_utc"), Comment("Дата отправки уведомления")]
public DateTime? SentDateAtUtc { get; set; } public DateTime? SentDateAtUtc { get; set; }
[Column("is_read"), Comment("Прочитано ли уведомление")]
public bool? IsRead { get; set; }
[ForeignKey(nameof(IdNotificationTransport))] [ForeignKey(nameof(IdNotificationTransport))]
public virtual NotificationTransport NotificationTransport { get; set; } = null!; public virtual NotificationTransport NotificationTransport { get; set; } = null!;