forked from gongxuegit/tiku-backend.net
feat: add phase five operations foundation
This commit is contained in:
22
Tiku.Api/Contracts/BackgroundJobDtos.cs
Normal file
22
Tiku.Api/Contracts/BackgroundJobDtos.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Application.Jobs;
|
||||
|
||||
namespace Tiku.Api.Contracts;
|
||||
|
||||
public sealed class CreateBackgroundJobDto
|
||||
{
|
||||
public string JobType { get; set; } = string.Empty;
|
||||
public JsonElement Payload { get; set; }
|
||||
public DateTimeOffset? RunAfter { get; set; }
|
||||
public int MaxRetries { get; set; } = 3;
|
||||
|
||||
public CreateBackgroundJobCommand ToCommand(Guid tenantId)
|
||||
{
|
||||
return new CreateBackgroundJobCommand(
|
||||
tenantId,
|
||||
JobType,
|
||||
Payload.ValueKind == JsonValueKind.Undefined ? JsonSerializer.SerializeToElement(new { }) : Payload,
|
||||
RunAfter,
|
||||
MaxRetries);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user