This fixes an issue where trying to save a script without a title causes the script editor dialog to fully lock up. It also prevents any unexpected closing of the dialog if there is an issue saving the script.
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using LANCommander.Data.Enums;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace LANCommander.Data.Models
|
|
{
|
|
[Table("Scripts")]
|
|
public class Script : BaseModel
|
|
{
|
|
[Required]
|
|
public string Name { get; set; }
|
|
public string? Description { get; set; }
|
|
public ScriptType Type { get; set; }
|
|
public string Contents { get; set; }
|
|
public bool RequiresAdmin { get; set; }
|
|
|
|
public Guid? GameId { get; set; }
|
|
[JsonIgnore]
|
|
[ForeignKey(nameof(GameId))]
|
|
[InverseProperty("Scripts")]
|
|
public virtual Game? Game { get; set; }
|
|
|
|
public Guid? RedistributableId { get; set; }
|
|
[JsonIgnore]
|
|
[ForeignKey(nameof(RedistributableId))]
|
|
[InverseProperty("Scripts")]
|
|
public virtual Redistributable? Redistributable { get; set; }
|
|
|
|
public Guid? ServerId { get; set; }
|
|
[JsonIgnore]
|
|
[ForeignKey(nameof(ServerId))]
|
|
[InverseProperty("Scripts")]
|
|
public virtual Server? Server { get; set; }
|
|
}
|
|
}
|