53 lines
1.8 KiB
C#
53 lines
1.8 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()
|
|
{
|
|
return new SavePlatformConfigurationDraftCommand(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()
|
|
{
|
|
return new UpsertPlatformNotificationTemplateCommand(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()
|
|
{
|
|
return new SendPlatformNotificationCommand(TemplateId, RoleCodes, Variables ?? new Dictionary<string, string>(),
|
|
IdempotencyKey);
|
|
}
|
|
} |