================================================================================
PROJECT: ClassNotify
SNAPSHOT_ID: 20261002-032041-73dd8d7
BUNDLE: 2/8
GIT_HEAD: 73dd8d7c5feb1cc42c8a6f218815748bfbe88bf3
WORKTREE_DIRTY: true
FILES_IN_BUNDLE: 51
================================================================================
================================================================================
FILE BEGIN: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.Designer.cs
SHA256: 118f61890ce5578a02b9e83e07930ed96fb030b4c4705c093d1776ca5c5cabbb
SIZE: 22590
================================================================================
//
using System;
using ClassNotify.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ClassNotify.Server.Data.Migrations
{
[DbContext(typeof(ClassNotifyDbContext))]
[Migration("20260922130000_AddDeviceCommandDurationMs")]
partial class AddDeviceCommandDurationMs
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b =>
{
b.Property("Code")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("ClassroomId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("InstallationId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsUsed")
.HasColumnType("boolean");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("UsedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Code");
b.HasIndex("ClassroomId");
b.HasIndex("Code")
.IsUnique();
b.HasIndex("InstallationId");
b.HasIndex("TenantId");
b.ToTable("ActivationCodes");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.Property("Id")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("Classrooms");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("ClassroomId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CurrentIp")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("DeviceTokenHash")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Hostname")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("InstallationId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("LastHeartbeat")
.HasColumnType("timestamp with time zone");
b.Property("OnlineState")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("ClassroomId");
b.HasIndex("DeviceTokenHash")
.IsUnique();
b.HasIndex("InstallationId");
b.HasIndex("TenantId");
b.ToTable("Devices");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("CommandType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CompletedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("DeviceId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("DurationMs")
.HasColumnType("bigint");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("Parameters")
.HasColumnType("text");
b.Property("ResultCode")
.HasColumnType("integer");
b.Property("ResultMessage")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property("StartedAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("DeviceId", "Status");
b.HasIndex("Status", "ExpiresAt");
b.HasIndex("TenantId", "DeviceId", "CreatedAt")
.IsDescending(false, false, true);
b.ToTable("DeviceCommands");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredential", b =>
{
b.Property("DeviceId")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("EncryptedToken")
.IsRequired()
.HasColumnType("text");
b.Property("LastRotatedAt")
.HasColumnType("timestamp with time zone");
b.Property("TenantId")
.IsRequired()
.HasColumnType("text");
b.HasKey("DeviceId");
b.ToTable("DeviceCredentials");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Details")
.HasColumnType("text");
b.Property("MigratedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("MigrationMarkers");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("ClassroomId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DurationSeconds")
.HasColumnType("integer");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("Message")
.IsRequired()
.HasColumnType("text");
b.Property("Priority")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("SenderName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("SenderUserId")
.HasColumnType("text");
b.Property("Shake")
.HasColumnType("boolean");
b.Property("TenantId")
.IsRequired()
.HasColumnType("character varying(100)");
b.Property("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("Voice")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("ClassroomId", "CreatedAt")
.IsDescending(false, true);
b.HasIndex("TenantId", "CreatedAt")
.IsDescending(false, true);
b.HasIndex("TenantId", "ClassroomId", "ExpiresAt");
b.ToTable("Notifications");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("AcknowledgedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeviceId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("DeviceReceivedAt")
.HasColumnType("timestamp with time zone");
b.Property("DisplayedAt")
.HasColumnType("timestamp with time zone");
b.Property("FailedAt")
.HasColumnType("timestamp with time zone");
b.Property("FailureReason")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property("NotificationId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DeviceId", "Status");
b.HasIndex("DeviceId", "UpdatedAt")
.IsDescending(false, true);
b.HasIndex("NotificationId", "DeviceId")
.IsUnique();
b.ToTable("NotificationReceipts");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.RateLimitAuditLog", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("Action")
.IsRequired()
.HasColumnType("text");
b.Property("ClientIp")
.IsRequired()
.HasColumnType("text");
b.Property("Endpoint")
.IsRequired()
.HasColumnType("text");
b.Property("Reason")
.IsRequired()
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("text");
b.Property("Timestamp")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RateLimitAuditLogs");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Plan")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.ToTable("Tenants");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("PasswordHash")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Role")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("TenantId", "Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("ActivationCodes")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", null)
.WithMany("Classrooms")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom")
.WithMany("Devices")
.HasForeignKey("ClassroomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Devices")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Classroom");
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device")
.WithMany()
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Device");
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Notifications")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device")
.WithMany("Receipts")
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification")
.WithMany("Receipts")
.HasForeignKey("NotificationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Device");
b.Navigation("Notification");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Users")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.Navigation("Devices");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.Navigation("Receipts");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b =>
{
b.Navigation("Receipts");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b =>
{
b.Navigation("ActivationCodes");
b.Navigation("Classrooms");
b.Navigation("Devices");
b.Navigation("Notifications");
b.Navigation("Users");
});
#pragma warning restore 612, 618
}
}
}
================================================================================
FILE END: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.Designer.cs
================================================================================
================================================================================
FILE BEGIN: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.cs
SHA256: c99935f743acf18d16b28ed88687fe9d339693f50be553ec7bf4b11c0dbf67fc
SIZE: 760
================================================================================
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClassNotify.Server.Data.Migrations
{
///
public partial class AddDeviceCommandDurationMs : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "DurationMs",
table: "DeviceCommands",
type: "bigint",
nullable: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DurationMs",
table: "DeviceCommands");
}
}
}
================================================================================
FILE END: src/Server/ClassNotify.Server/Data/Migrations/20260922130000_AddDeviceCommandDurationMs.cs
================================================================================
================================================================================
FILE BEGIN: src/Server/ClassNotify.Server/Data/Migrations/20260924165851_AddReliabilityBaselineAndCorrelation.Designer.cs
SHA256: f32ebcd070f6e087113d686934d4fe97eade12891b8f32daabafe85810f539ce
SIZE: 29302
================================================================================
//
using System;
using ClassNotify.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ClassNotify.Server.Data.Migrations
{
[DbContext(typeof(ClassNotifyDbContext))]
[Migration("20260924165851_AddReliabilityBaselineAndCorrelation")]
partial class AddReliabilityBaselineAndCorrelation
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b =>
{
b.Property("Code")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("ClassroomId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("InstallationId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsUsed")
.HasColumnType("boolean");
b.Property("TenantId")
.IsRequired()
.HasColumnType("text");
b.Property("UsedAt")
.HasColumnType("timestamp with time zone");
b.Property("UsedByDeviceId")
.HasColumnType("text");
b.HasKey("Code");
b.HasIndex("ClassroomId");
b.HasIndex("Code")
.IsUnique();
b.HasIndex("InstallationId");
b.HasIndex("TenantId");
b.ToTable("ActivationCodes");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.AdminAuditEvent", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("Action")
.IsRequired()
.HasColumnType("text");
b.Property("ActorRole")
.IsRequired()
.HasColumnType("text");
b.Property("ActorUsername")
.IsRequired()
.HasColumnType("text");
b.Property("Details")
.HasColumnType("text");
b.Property("IpAddress")
.HasColumnType("text");
b.Property("OccurredAt")
.HasColumnType("timestamp with time zone");
b.Property("TargetId")
.IsRequired()
.HasColumnType("text");
b.Property("TargetType")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("AdminAuditEvents");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.Property("TenantId")
.HasColumnType("text");
b.Property("Id")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Grade")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("RoomNumber")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("TenantId", "Id");
b.HasIndex("TenantId", "Id");
b.ToTable("Classrooms");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("Architecture")
.HasColumnType("text");
b.Property("ClassroomId")
.IsRequired()
.HasColumnType("text");
b.Property("ClientVersion")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeviceTokenHash")
.IsRequired()
.HasColumnType("text");
b.Property("Hostname")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("InstallationId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsActive")
.HasColumnType("boolean");
b.Property("LastHeartbeatAt")
.HasColumnType("timestamp with time zone");
b.Property("LastHeartbeatCorrelationId")
.HasColumnType("text");
b.Property("OsVersion")
.HasColumnType("text");
b.Property("ProtocolVersion")
.HasColumnType("integer");
b.Property("RawDeviceToken")
.HasColumnType("text");
b.Property("ServiceVersion")
.HasColumnType("text");
b.Property("TenantId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("InstallationId")
.IsUnique()
.HasFilter("\"InstallationId\" IS NOT NULL");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "ClassroomId");
b.ToTable("Devices");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("CommandType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CompletedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("DeviceId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("DurationMs")
.HasColumnType("bigint");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("Parameters")
.HasColumnType("text");
b.Property("ResultCode")
.HasColumnType("integer");
b.Property("ResultMessage")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property("StartedAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("DeviceId", "Status");
b.HasIndex("Status", "ExpiresAt");
b.HasIndex("TenantId", "DeviceId", "CreatedAt")
.IsDescending(false, false, true);
b.ToTable("DeviceCommands");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCredentialRecord", b =>
{
b.Property("DeviceId")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeviceTokenHash")
.IsRequired()
.HasColumnType("text");
b.Property("EncryptedRecoverableToken")
.IsRequired()
.HasColumnType("text");
b.Property("InstallationId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("RotatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("DeviceId");
b.HasIndex("DeviceId")
.IsUnique();
b.HasIndex("InstallationId")
.IsUnique();
b.ToTable("DeviceCredentials");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceSelfCheckRun", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("CompletedAtUtc")
.HasColumnType("timestamp with time zone");
b.Property("CorrelationId")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("DeviceId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("RequestedAtUtc")
.HasColumnType("timestamp with time zone");
b.Property("RequestedByUserId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("ResultJson")
.HasMaxLength(32768)
.HasColumnType("character varying(32768)");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("TenantId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("CorrelationId");
b.HasIndex("DeviceId", "RequestedAtUtc")
.IsDescending(false, true);
b.HasIndex("TenantId", "Status");
b.ToTable("DeviceSelfChecks");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.MigrationMarker", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Details")
.HasColumnType("text");
b.Property("MigratedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("MigrationMarkers");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("BroadcastId")
.HasColumnType("text");
b.Property("CancelledAt")
.HasColumnType("timestamp with time zone");
b.Property("CancelledBy")
.HasColumnType("text");
b.Property("ClassroomId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CorrelationId")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DurationSeconds")
.HasColumnType("integer");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("IsCancelled")
.HasColumnType("boolean");
b.Property("Message")
.IsRequired()
.HasColumnType("text");
b.Property("Priority")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("SenderName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("SenderUserId")
.HasColumnType("text");
b.Property("Shake")
.HasColumnType("boolean");
b.Property("TenantId")
.IsRequired()
.HasColumnType("text");
b.Property("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("Voice")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("CorrelationId");
b.HasIndex("ClassroomId", "CreatedAt")
.IsDescending(false, true);
b.HasIndex("TenantId", "CreatedAt")
.IsDescending(false, true);
b.HasIndex("TenantId", "ClassroomId", "ExpiresAt");
b.ToTable("Notifications");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b =>
{
b.Property("Id")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("AcknowledgedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeviceId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("DeviceReceivedAt")
.HasColumnType("timestamp with time zone");
b.Property("DisplayedAt")
.HasColumnType("timestamp with time zone");
b.Property("FailedAt")
.HasColumnType("timestamp with time zone");
b.Property("FailureReason")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property("NotificationId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("VisualReceiptCapturedAt")
.HasColumnType("timestamp with time zone");
b.Property("VisualReceiptExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("VisualReceiptPath")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property("VisualReceiptSha256")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("VisualReceiptSizeBytes")
.HasColumnType("bigint");
b.Property("VisualReceiptState")
.IsRequired()
.ValueGeneratedOnAdd()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasDefaultValue("None");
b.HasKey("Id");
b.HasIndex("VisualReceiptExpiresAt");
b.HasIndex("DeviceId", "Status");
b.HasIndex("DeviceId", "UpdatedAt")
.IsDescending(false, true);
b.HasIndex("NotificationId", "DeviceId")
.IsUnique();
b.ToTable("NotificationReceipts");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("IsActive")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.ToTable("Tenants");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsLocked")
.HasColumnType("boolean");
b.Property("LastLoginAt")
.HasColumnType("timestamp with time zone");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("Role")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("TenantId")
.IsRequired()
.HasColumnType("text");
b.Property("TokenVersion")
.HasColumnType("integer");
b.Property("Username")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("ActivationCodes")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Classrooms")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Devices")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Classroom", "Classroom")
.WithMany("Devices")
.HasForeignKey("TenantId", "ClassroomId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Classroom");
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceCommand", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device")
.WithMany()
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Device");
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.DeviceSelfCheckRun", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device")
.WithMany()
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Device");
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Notifications")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.NotificationReceipt", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Device", "Device")
.WithMany("Receipts")
.HasForeignKey("DeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClassNotify.Server.Domain.Entities.Notification", "Notification")
.WithMany("Receipts")
.HasForeignKey("NotificationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Device");
b.Navigation("Notification");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.User", b =>
{
b.HasOne("ClassNotify.Server.Domain.Entities.Tenant", "Tenant")
.WithMany("Users")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.Navigation("Devices");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.Navigation("Receipts");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Notification", b =>
{
b.Navigation("Receipts");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Tenant", b =>
{
b.Navigation("ActivationCodes");
b.Navigation("Classrooms");
b.Navigation("Devices");
b.Navigation("Notifications");
b.Navigation("Users");
});
#pragma warning restore 612, 618
}
}
}
================================================================================
FILE END: src/Server/ClassNotify.Server/Data/Migrations/20260924165851_AddReliabilityBaselineAndCorrelation.Designer.cs
================================================================================
================================================================================
FILE BEGIN: src/Server/ClassNotify.Server/Data/Migrations/20260924165851_AddReliabilityBaselineAndCorrelation.cs
SHA256: 33c4b10a0df186448c632d03ae8658ad2666a0304974992952f28cc6e631258d
SIZE: 5775
================================================================================
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClassNotify.Server.Data.Migrations
{
///
public partial class AddReliabilityBaselineAndCorrelation : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "CorrelationId",
table: "Notifications",
type: "character varying(32)",
maxLength: 32,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn(
name: "Architecture",
table: "Devices",
type: "text",
nullable: true);
migrationBuilder.AddColumn(
name: "ClientVersion",
table: "Devices",
type: "text",
nullable: true);
migrationBuilder.AddColumn(
name: "LastHeartbeatCorrelationId",
table: "Devices",
type: "text",
nullable: true);
migrationBuilder.AddColumn(
name: "OsVersion",
table: "Devices",
type: "text",
nullable: true);
migrationBuilder.AddColumn(
name: "ProtocolVersion",
table: "Devices",
type: "integer",
nullable: true);
migrationBuilder.AddColumn(
name: "ServiceVersion",
table: "Devices",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "DeviceSelfChecks",
columns: table => new
{
Id = table.Column(type: "character varying(100)", maxLength: 100, nullable: false),
TenantId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false),
DeviceId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false),
CorrelationId = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
RequestedAtUtc = table.Column(type: "timestamp with time zone", nullable: false),
CompletedAtUtc = table.Column(type: "timestamp with time zone", nullable: true),
ResultJson = table.Column(type: "character varying(32768)", maxLength: 32768, nullable: true),
RequestedByUserId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DeviceSelfChecks", x => x.Id);
table.ForeignKey(
name: "FK_DeviceSelfChecks_Devices_DeviceId",
column: x => x.DeviceId,
principalTable: "Devices",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DeviceSelfChecks_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Notifications_CorrelationId",
table: "Notifications",
column: "CorrelationId");
migrationBuilder.CreateIndex(
name: "IX_DeviceSelfChecks_CorrelationId",
table: "DeviceSelfChecks",
column: "CorrelationId");
migrationBuilder.CreateIndex(
name: "IX_DeviceSelfChecks_DeviceId_RequestedAtUtc",
table: "DeviceSelfChecks",
columns: new[] { "DeviceId", "RequestedAtUtc" },
descending: new[] { false, true });
migrationBuilder.CreateIndex(
name: "IX_DeviceSelfChecks_TenantId_Status",
table: "DeviceSelfChecks",
columns: new[] { "TenantId", "Status" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DeviceSelfChecks");
migrationBuilder.DropIndex(
name: "IX_Notifications_CorrelationId",
table: "Notifications");
migrationBuilder.DropColumn(
name: "CorrelationId",
table: "Notifications");
migrationBuilder.DropColumn(
name: "Architecture",
table: "Devices");
migrationBuilder.DropColumn(
name: "ClientVersion",
table: "Devices");
migrationBuilder.DropColumn(
name: "LastHeartbeatCorrelationId",
table: "Devices");
migrationBuilder.DropColumn(
name: "OsVersion",
table: "Devices");
migrationBuilder.DropColumn(
name: "ProtocolVersion",
table: "Devices");
migrationBuilder.DropColumn(
name: "ServiceVersion",
table: "Devices");
}
}
}
================================================================================
FILE END: src/Server/ClassNotify.Server/Data/Migrations/20260924165851_AddReliabilityBaselineAndCorrelation.cs
================================================================================
================================================================================
FILE BEGIN: src/Server/ClassNotify.Server/Data/Migrations/20260925122539_AddDeviceSelfCheckBatch.Designer.cs
SHA256: b9b3e0b59c9e7206a2b51b3861e8e78fe01647d2b60b4f975876c4349679c46f
SIZE: 32922
================================================================================
//
using System;
using ClassNotify.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ClassNotify.Server.Data.Migrations
{
[DbContext(typeof(ClassNotifyDbContext))]
[Migration("20260925122539_AddDeviceSelfCheckBatch")]
partial class AddDeviceSelfCheckBatch
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.ActivationCode", b =>
{
b.Property("Code")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("ClassroomId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("InstallationId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsUsed")
.HasColumnType("boolean");
b.Property("TenantId")
.IsRequired()
.HasColumnType("text");
b.Property("UsedAt")
.HasColumnType("timestamp with time zone");
b.Property("UsedByDeviceId")
.HasColumnType("text");
b.HasKey("Code");
b.HasIndex("ClassroomId");
b.HasIndex("Code")
.IsUnique();
b.HasIndex("InstallationId");
b.HasIndex("TenantId");
b.ToTable("ActivationCodes");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.AdminAuditEvent", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("Action")
.IsRequired()
.HasColumnType("text");
b.Property("ActorRole")
.IsRequired()
.HasColumnType("text");
b.Property("ActorUsername")
.IsRequired()
.HasColumnType("text");
b.Property("Details")
.HasColumnType("text");
b.Property("IpAddress")
.HasColumnType("text");
b.Property("OccurredAt")
.HasColumnType("timestamp with time zone");
b.Property("TargetId")
.IsRequired()
.HasColumnType("text");
b.Property("TargetType")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("AdminAuditEvents");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Classroom", b =>
{
b.Property("TenantId")
.HasColumnType("text");
b.Property("Id")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("Grade")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("RoomNumber")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("TenantId", "Id");
b.HasIndex("TenantId", "Id");
b.ToTable("Classrooms");
});
modelBuilder.Entity("ClassNotify.Server.Domain.Entities.Device", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("Architecture")
.HasColumnType("text");
b.Property("ClassroomId")
.IsRequired()
.HasColumnType("text");
b.Property("ClientVersion")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DeviceTokenHash")
.IsRequired()
.HasColumnType("text");
b.Property("Hostname")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("InstallationId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsActive")
.HasColumnType("boolean");
b.Property("LastHeartbeatAt")
.HasColumnType("timestamp with time zone");
b.Property("LastHeartbeatCorrelationId")
.HasColumnType("text");
b.Property