1219 lines
42 KiB
C#
1219 lines
42 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using GreenHome.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace GreenHome.Infrastructure.Migrations
|
|
{
|
|
[DbContext(typeof(GreenHomeDbContext))]
|
|
[Migration("20251217154130_AddDeviceTokenAndPhoneFields")]
|
|
partial class AddDeviceTokenAndPhoneFields
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "9.0.9")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
|
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AIQuery", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Answer")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("CompletionTokens")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int?>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Model")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<int>("PromptTokens")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Question")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<long?>("ResponseTimeMs")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<double?>("Temperature")
|
|
.HasColumnType("float");
|
|
|
|
b.Property<int>("TotalTokens")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int?>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CreatedAt");
|
|
|
|
b.HasIndex("DeviceId");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("AIQueries", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertCondition", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("CallCooldownMinutes")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsEnabled")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<int>("NotificationType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("SmsCooldownMinutes")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("TimeType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeviceId");
|
|
|
|
b.ToTable("AlertConditions", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertLog", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int?>("AlertConditionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("AlertType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("ErrorMessage")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<string>("Message")
|
|
.IsRequired()
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<int>("NotificationType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("PhoneNumber")
|
|
.IsRequired()
|
|
.HasMaxLength(20)
|
|
.HasColumnType("nvarchar(20)");
|
|
|
|
b.Property<long>("ProcessingTimeMs")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("SentAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("AlertConditionId");
|
|
|
|
b.HasIndex("AlertType");
|
|
|
|
b.HasIndex("Status");
|
|
|
|
b.HasIndex("DeviceId", "SentAt");
|
|
|
|
b.HasIndex("UserId", "SentAt");
|
|
|
|
b.ToTable("AlertLogs", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertNotification", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int?>("AlertConditionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("ErrorMessage")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<bool>("IsSent")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Message")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("MessageOutboxIds")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<int>("NotificationType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("SentAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("AlertConditionId");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.HasIndex("DeviceId", "UserId", "AlertConditionId", "SentAt");
|
|
|
|
b.ToTable("AlertNotifications", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertRule", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("AlertConditionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("ComparisonType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Order")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("SensorType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("Value1")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal?>("Value2")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("AlertConditionId");
|
|
|
|
b.ToTable("AlertRules", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.Checklist", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("CreatedByUserId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Title")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CreatedByUserId");
|
|
|
|
b.HasIndex("DeviceId", "IsActive");
|
|
|
|
b.ToTable("Checklists", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistCompletion", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("ChecklistId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CompletedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("CompletedByUserId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Notes")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<string>("PersianDate")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("nvarchar(10)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CompletedByUserId");
|
|
|
|
b.HasIndex("ChecklistId", "PersianDate");
|
|
|
|
b.ToTable("ChecklistCompletions", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistItem", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("ChecklistId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<bool>("IsRequired")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<int>("Order")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Title")
|
|
.IsRequired()
|
|
.HasMaxLength(300)
|
|
.HasColumnType("nvarchar(300)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ChecklistId", "Order");
|
|
|
|
b.ToTable("ChecklistItems", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistItemCompletion", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("ChecklistCompletionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("ChecklistItemId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsChecked")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Note")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ChecklistCompletionId");
|
|
|
|
b.HasIndex("ChecklistItemId");
|
|
|
|
b.ToTable("ChecklistItemCompletions", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DailyReport", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Analysis")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("CompletionTokens")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Model")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("PersianDate")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("nvarchar(10)");
|
|
|
|
b.Property<int>("PersianDay")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PersianMonth")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PersianYear")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PromptTokens")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("RecordCount")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<long?>("ResponseTimeMs")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<int>("SampledRecordCount")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("TotalTokens")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CreatedAt");
|
|
|
|
b.HasIndex("DeviceId", "PersianDate")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("DeviceId", "PersianYear", "PersianMonth");
|
|
|
|
b.ToTable("DailyReports", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.Device", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("DeviceName")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("nvarchar(10)");
|
|
|
|
b.Property<string>("Location")
|
|
.IsRequired()
|
|
.HasMaxLength(250)
|
|
.HasColumnType("nvarchar(250)");
|
|
|
|
b.Property<string>("NeshanLocation")
|
|
.IsRequired()
|
|
.HasMaxLength(80)
|
|
.HasColumnType("nvarchar(80)");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("Devices", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DevicePost", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("AuthorUserId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Content")
|
|
.IsRequired()
|
|
.HasMaxLength(5000)
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("AuthorUserId");
|
|
|
|
b.HasIndex("DeviceId", "CreatedAt");
|
|
|
|
b.ToTable("DevicePosts", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DevicePostImage", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ContentType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<int>("DevicePostId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("FileName")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("nvarchar(255)");
|
|
|
|
b.Property<string>("FilePath")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<long>("FileSize")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("UploadedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DevicePostId");
|
|
|
|
b.ToTable("DevicePostImages", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DeviceSettings", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<decimal?>("AreaSquareMeters")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<string>("City")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("DevicePhoneNumber")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<decimal?>("Latitude")
|
|
.HasColumnType("decimal(9,6)");
|
|
|
|
b.Property<decimal?>("Longitude")
|
|
.HasColumnType("decimal(9,6)");
|
|
|
|
b.Property<int>("MinimumCallIntervalMinutes")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasDefaultValue(60);
|
|
|
|
b.Property<int>("MinimumSmsIntervalMinutes")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasDefaultValue(15);
|
|
|
|
b.Property<string>("ProductType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Province")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<int?>("SimCardType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("TokenCode")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<DateTime?>("TokenExpiresAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("UploadIntervalMin")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("VerificationCode")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeviceId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("DeviceSettings", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DeviceUser", b =>
|
|
{
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("ReceiveAlerts")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bit")
|
|
.HasDefaultValue(true);
|
|
|
|
b.HasKey("DeviceId", "UserId");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("DeviceUsers", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ReportImage", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ContentType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("FileName")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("nvarchar(255)");
|
|
|
|
b.Property<string>("FilePath")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<long>("FileSize")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("UploadedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("UserDailyReportId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("UserDailyReportId");
|
|
|
|
b.ToTable("ReportImages", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.TelemetryRecord", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("GasPPM")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("HumidityPercent")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal>("Lux")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<string>("PersianDate")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("nvarchar(10)");
|
|
|
|
b.Property<int>("PersianMonth")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PersianYear")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("ServerTimestampUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<decimal>("SoilPercent")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal>("TemperatureC")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<DateTime>("TimestampUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeviceId", "ServerTimestampUtc");
|
|
|
|
b.HasIndex("DeviceId", "TimestampUtc");
|
|
|
|
b.HasIndex("DeviceId", "PersianYear", "PersianMonth");
|
|
|
|
b.ToTable("Telemetry", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.User", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Family")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<DateTime?>("LastLoginAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Mobile")
|
|
.IsRequired()
|
|
.HasMaxLength(11)
|
|
.HasColumnType("nvarchar(11)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<int>("Role")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Mobile")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Users", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.UserDailyReport", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("DeviceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Notes")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<string>("Observations")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("Operations")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("PersianDate")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("nvarchar(10)");
|
|
|
|
b.Property<int>("PersianDay")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PersianMonth")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PersianYear")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Title")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.HasIndex("DeviceId", "PersianDate");
|
|
|
|
b.HasIndex("DeviceId", "PersianYear", "PersianMonth");
|
|
|
|
b.ToTable("UserDailyReports", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.VerificationCode", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(4)
|
|
.HasColumnType("nvarchar(4)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime>("ExpiresAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<bool>("IsUsed")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Mobile")
|
|
.IsRequired()
|
|
.HasMaxLength(11)
|
|
.HasColumnType("nvarchar(11)");
|
|
|
|
b.Property<DateTime?>("UsedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Mobile", "Code", "IsUsed");
|
|
|
|
b.ToTable("VerificationCodes", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AIQuery", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.HasOne("GreenHome.Domain.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.Navigation("Device");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertCondition", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Device");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertLog", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.AlertCondition", "AlertCondition")
|
|
.WithMany()
|
|
.HasForeignKey("AlertConditionId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("AlertCondition");
|
|
|
|
b.Navigation("Device");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertNotification", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.AlertCondition", "AlertCondition")
|
|
.WithMany()
|
|
.HasForeignKey("AlertConditionId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("AlertCondition");
|
|
|
|
b.Navigation("Device");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertRule", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.AlertCondition", "AlertCondition")
|
|
.WithMany("Rules")
|
|
.HasForeignKey("AlertConditionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("AlertCondition");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.Checklist", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.User", "CreatedByUser")
|
|
.WithMany()
|
|
.HasForeignKey("CreatedByUserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("CreatedByUser");
|
|
|
|
b.Navigation("Device");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistCompletion", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Checklist", "Checklist")
|
|
.WithMany("Completions")
|
|
.HasForeignKey("ChecklistId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.User", "CompletedByUser")
|
|
.WithMany()
|
|
.HasForeignKey("CompletedByUserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Checklist");
|
|
|
|
b.Navigation("CompletedByUser");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistItem", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Checklist", "Checklist")
|
|
.WithMany("Items")
|
|
.HasForeignKey("ChecklistId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Checklist");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistItemCompletion", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.ChecklistCompletion", "ChecklistCompletion")
|
|
.WithMany("ItemCompletions")
|
|
.HasForeignKey("ChecklistCompletionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.ChecklistItem", "ChecklistItem")
|
|
.WithMany()
|
|
.HasForeignKey("ChecklistItemId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("ChecklistCompletion");
|
|
|
|
b.Navigation("ChecklistItem");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DailyReport", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Device");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.Device", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DevicePost", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.User", "AuthorUser")
|
|
.WithMany()
|
|
.HasForeignKey("AuthorUserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("AuthorUser");
|
|
|
|
b.Navigation("Device");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DevicePostImage", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.DevicePost", "DevicePost")
|
|
.WithMany("Images")
|
|
.HasForeignKey("DevicePostId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("DevicePost");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DeviceSettings", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Device");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DeviceUser", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany("DeviceUsers")
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.User", "User")
|
|
.WithMany("DeviceUsers")
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Device");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ReportImage", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.UserDailyReport", "UserDailyReport")
|
|
.WithMany("Images")
|
|
.HasForeignKey("UserDailyReportId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("UserDailyReport");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.UserDailyReport", b =>
|
|
{
|
|
b.HasOne("GreenHome.Domain.Device", "Device")
|
|
.WithMany()
|
|
.HasForeignKey("DeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GreenHome.Domain.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Device");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.AlertCondition", b =>
|
|
{
|
|
b.Navigation("Rules");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.Checklist", b =>
|
|
{
|
|
b.Navigation("Completions");
|
|
|
|
b.Navigation("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.ChecklistCompletion", b =>
|
|
{
|
|
b.Navigation("ItemCompletions");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.Device", b =>
|
|
{
|
|
b.Navigation("DeviceUsers");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.DevicePost", b =>
|
|
{
|
|
b.Navigation("Images");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.User", b =>
|
|
{
|
|
b.Navigation("DeviceUsers");
|
|
});
|
|
|
|
modelBuilder.Entity("GreenHome.Domain.UserDailyReport", b =>
|
|
{
|
|
b.Navigation("Images");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|