Move Databese stuff into Core and remove DiunaBI.Database Project

This commit is contained in:
Michał Zieliński
2025-06-06 22:15:23 +02:00
parent edbb39c1cc
commit e56be55274
64 changed files with 285 additions and 88 deletions

View File

@@ -3,27 +3,68 @@ using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models;
public enum JobStatus
public class QueueJob
{
New,
Failed,
Success
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public Guid LayerId { get; set; }
[Required]
[MaxLength(200)]
public string LayerName { get; set; } = string.Empty;
[Required]
[MaxLength(100)]
public string PluginName { get; set; } = string.Empty;
[Required]
public JobType JobType { get; set; }
public int Priority { get; set; } = 0; // 0 = highest priority
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public int RetryCount { get; set; } = 0;
public int MaxRetries { get; set; } = 5;
[Required]
public JobStatus Status { get; set; } = JobStatus.Pending;
[MaxLength(1000)]
public string? LastError { get; set; }
public DateTime? LastAttemptAt { get; set; }
public DateTime? CompletedAt { get; set; }
[Required]
public Guid CreatedById { get; set; }
[Required]
public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow;
[Required]
public Guid ModifiedById { get; set; }
[Required]
public DateTime ModifiedAtUtc { get; set; } = DateTime.UtcNow;
}
public enum JobType
{
ImportWorker,
ProcessWorker
Import = 0,
Process = 1
}
public class QueueJob
public enum JobStatus
{
[Key] public Guid Id { get; set; }
[Required] public Guid LayerId { get; set; }
[Required] public int Attempts { get; set; }
[Required] public JobStatus Status { get; set; } = JobStatus.New;
[Required] public JobType Type { get; set; } = JobType.ImportWorker;
public string Message { get; set; } = string.Empty;
[Required] public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required] public DateTime ModifiedAt { get; set; } = DateTime.UtcNow;
Pending,
Running,
Completed,
Failed,
Retrying
}