Files
ECMJobRunner/ECMJobRunner.Domain/Entities/CfgProfile.cs
TekH ce47653831 Refactor Profile entity and update property constraints
Renamed `Profile` to `CfgProfile` across the codebase for clarity and consistency. Updated property constraints in `CfgProfile.cs`, `ProfileHistory.cs`, and `ProfileSqlJob.cs` to include maximum length validations. Changed navigation properties in `CfgProfile.cs` to use `IEnumerable` and made them nullable. Updated `ForeignKey` attributes in `ProfileHistory.cs` and `ProfileSqlJob.cs` to reference `CfgProfile`. Improved property descriptions for better documentation.
2026-07-09 13:23:46 +02:00

102 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ECMJobRunner.Domain.Entities
{
/// <summary>
/// Job Runner Configuration Profile Entity
/// Represents a job runner profile configuration
/// Type: 0 = ADSync; 1 = GraphQL; 2 = SQL-Job; 3 = SQL and REST-Job
/// </summary>
[Table("TBJR_CFG_PROFILE", Schema = "dbo")]
public class CfgProfile
{
/// <summary>
/// Primary Key
/// </summary>
[Key]
[Column("PK_TBJR_CFG_PROFILE_ID")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
/// <summary>
/// Active / Inactive switch
/// </summary>
[Required]
[Column("ACTIVE")]
public bool Active { get; set; } = true;
/// <summary>
/// Profile name (max 150 chars)
/// </summary>
[Required]
[Column("PROFILE_NAME")]
[MaxLength(150)]
public string ProfileName { get; set; } = null!;
/// <summary>
/// Profile type: 0 = ADSync; 1 = GraphQL; 2 = SQL-Job; 3 = SQL and REST-Job
/// </summary>
[Required]
[Column("TYPE_ID")]
public byte TypeId { get; set; }
/// <summary>
/// Schedule in Cron format (max 150 chars)
/// </summary>
[Required]
[Column("SCHEDULE")]
[MaxLength(150)]
public string Schedule { get; set; } = "0 30 4 ? * MON-SAT";
/// <summary>
/// Optional description (max 500 chars)
/// </summary>
[Column("COMMENT")]
[MaxLength(500)]
public string? Comment { get; set; }
/// <summary>
/// Created by (max 50 chars)
/// </summary>
[Required]
[Column("ADDED_WHO")]
[MaxLength(50)]
public string AddedWho { get; set; } = "DEFAULT";
/// <summary>
/// Created at
/// </summary>
[Required]
[Column("ADDED_WHEN")]
public DateTime AddedWhen { get; set; } = DateTime.Now;
/// <summary>
/// Modified by (max 50 chars)
/// </summary>
[Column("CHANGED_WHO")]
[MaxLength(50)]
public string? ChangedWho { get; set; }
/// <summary>
/// Modified at
/// </summary>
[Column("CHANGED_WHEN")]
public DateTime? ChangedWhen { get; set; }
// Navigation properties
/// <summary>
/// SQL Jobs associated with this profile
/// </summary>
public virtual IEnumerable<ProfileSqlJob>? SqlJobs { get; set; }
/// <summary>
/// Profile execution history
/// </summary>
public virtual IEnumerable<ProfileHistory>? ProfileHistories { get; set; }
}
}