32 lines
1.5 KiB
C#
32 lines
1.5 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json;
|
|
using Tiku.Application.PlatformAdmin;
|
|
using Tiku.Domain.Common;
|
|
using Tiku.Domain.Platform;
|
|
|
|
namespace Tiku.Api.Contracts;
|
|
|
|
public sealed record SavePlatformConfigurationDraftDto(
|
|
[Required, MaxLength(120)] string DefinitionCode,
|
|
[Required, MaxLength(80)] string Environment,
|
|
JsonElement? Value,
|
|
[MaxLength(300)] string? SecretRef,
|
|
[Required, MaxLength(1000)] string Reason)
|
|
{
|
|
public SavePlatformConfigurationDraftCommand ToCommand() => new(DefinitionCode, Environment, Value, SecretRef, Reason);
|
|
}
|
|
public sealed record PlatformRollbackDto([Required, MaxLength(1000)] string Reason);
|
|
public sealed record UpsertPlatformNotificationTemplateDto(Guid? Id, [Required, MaxLength(120)] string Code,
|
|
[Required, MaxLength(200)] string Name, PlatformNotificationChannel Channel,
|
|
[Required, MaxLength(500)] string SubjectTemplate, [Required, MaxLength(8000)] string BodyTemplate,
|
|
bool Enabled, JsonElement? Variables)
|
|
{
|
|
public UpsertPlatformNotificationTemplateCommand ToCommand() => new(Id, Code, Name, Channel, SubjectTemplate, BodyTemplate, Enabled, Variables?.Clone() ?? JsonDefaults.Array());
|
|
}
|
|
public sealed record SendPlatformNotificationDto(Guid TemplateId, [MinLength(1)] IReadOnlyCollection<string> RoleCodes,
|
|
IReadOnlyDictionary<string, string>? Variables,
|
|
[Required, MaxLength(200)] string IdempotencyKey)
|
|
{
|
|
public SendPlatformNotificationCommand ToCommand() => new(TemplateId, RoleCodes, Variables ?? new Dictionary<string, string>(), IdempotencyKey);
|
|
}
|