mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 11:58:19 +02:00
Use DTOs to return API requests instead of Database Schema types.
Make use of IHttpStatusCodeResults
This commit is contained in:
39
API/Controllers/DTOs/Worker.cs
Normal file
39
API/Controllers/DTOs/Worker.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Workers;
|
||||
|
||||
namespace API.Controllers.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="BaseWorker"/> DTO
|
||||
/// </summary>
|
||||
public record Worker(string Key, IEnumerable<string> Dependencies, IEnumerable<string> MissingDependencies, bool DependenciesFulfilled, WorkerExecutionState State) : Identifiable(Key)
|
||||
{
|
||||
/// <summary>
|
||||
/// Workers this worker depends on having ran.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Workers this worker depends on having ran.")]
|
||||
public IEnumerable<string> Dependencies { get; init; } = Dependencies;
|
||||
|
||||
/// <summary>
|
||||
/// Workers that have not yet ran, that need to run for this Worker to run.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Workers that have not yet ran, that need to run for this Worker to run.")]
|
||||
public IEnumerable<string> MissingDependencies { get; init; } = MissingDependencies;
|
||||
|
||||
/// <summary>
|
||||
/// Worker can run.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Worker can run.")]
|
||||
public bool DependenciesFulfilled { get; init; } = DependenciesFulfilled;
|
||||
|
||||
/// <summary>
|
||||
/// Execution state of the Worker.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Execution state of the Worker.")]
|
||||
public WorkerExecutionState State { get; init; } = State;
|
||||
}
|
Reference in New Issue
Block a user