drop the deigner.cs

This commit is contained in:
Paul Schneider 2026-07-04 16:06:02 +01:00
commit 90dfe9c13f
4 changed files with 60 additions and 109 deletions

View file

@ -35,7 +35,7 @@ namespace Yavsc.Server.Hubs
{
bool valid = ValidateStringLength(roomName,1,25);
if (valid) valid = IsLetterOrDigit(roomName);
if (!valid) NotifyUser(NotificationTypes.Error, "roomName", _locator.GetString(ChatHubLabels.InvalidRoomName));
if (!valid) NotifyUser(NotificationTypes.Error, "roomName", _locator.GetString("InvalidRoomName"));
return valid;
}
public bool ValidateUserName (string userName)
@ -52,14 +52,14 @@ namespace Yavsc.Server.Hubs
NotifyUser(
NotificationTypes.Error,
"userName",
_locator.GetString(ChatHubLabels.InvalidUserName));
_locator.GetString("InvalidUserName)"));
return valid;
}
public bool ValidateMessage (string message)
{
if (!ValidateStringLength(message, 1, 10240))
{
NotifyUser(NotificationTypes.Error, "message", _locator.GetString(ChatHubLabels.InvalidMessage));
NotifyUser(NotificationTypes.Error, "message", _locator.GetString("InvalidMessage"));
return false;
}
return true;
@ -68,7 +68,7 @@ namespace Yavsc.Server.Hubs
{
if (!ValidateStringLength(reason, 1,240))
{
NotifyUser(NotificationTypes.Error, "reason", ChatHubLabels.InvalidReason);
NotifyUser(NotificationTypes.Error, "reason", "InvalidReason");
return false;
}
return true;

View file

@ -69,16 +69,17 @@ namespace Yavsc.Models
builder.Entity<DeviceDeclaration>().Property(x => x.DeclarationDate).HasDefaultValueSql(NOW_SQL);
builder.Entity<BlogTag>().HasKey(x => new { x.PostId, x.TagId });
// Signature: composite index (EstimateId, Type,
// CapturedAtUtc DESC) to support the controller's
// "most recent signature per type" read pattern
// without an extra ORDER BY cost. The default
// EF-generated FK index on EstimateId alone is
// replaced by the composite to avoid duplicate
// indexes.
// Signature: unique constraint on (EstimateId, Type)
// — the most recent version replaces the previous
// one, so a partial unique index (not a regular one)
// is the right shape. The controller does a
// Find-or-Add so EF translates an upsert into a
// single UPDATE when the row already exists; the
// unique index is the database-level guarantee that
// the contract holds.
builder.Entity<Signature>()
.HasIndex(s => new { s.EstimateId, s.Type, s.CapturedAtUtc })
.IsDescending(false, false, true);
.HasIndex(s => new { s.EstimateId, s.Type })
.IsUnique();
builder.Entity<Signature>()
.HasOne(s => s.Estimate)
.WithMany(e => e.Signatures)