Files
tiku-backend.net/Tiku.Api/Contracts/ProfileDtos.cs

121 lines
2.9 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Tiku.Application.Profile;
namespace Tiku.Api.Contracts;
public sealed class ProfileQueryDto
{
[Range(1, 50)]
public int? RecentLimit { get; set; }
[Range(1, 20)]
public int? Limit { get; set; }
[StringLength(32)]
public string? Status { get; set; }
[StringLength(50)]
public string? Type { get; set; }
[StringLength(50)]
public string? Category { get; set; }
public bool IncludeLocked { get; set; }
[StringLength(100)]
public string? SourceType { get; set; }
public DateTimeOffset? From { get; set; }
public DateTimeOffset? To { get; set; }
}
public sealed class UpdateProfileDto
{
[StringLength(100)]
public string? Name { get; set; }
[StringLength(32)]
public string? AvatarPreset { get; set; }
public Guid? RegionId { get; set; }
public Guid? SelectedSchoolId { get; set; }
public Guid? SelectedMajorId { get; set; }
public JsonElement? Stats { get; set; }
public JsonElement? Progress { get; set; }
public JsonElement? ModuleSelections { get; set; }
public JsonElement? RecentActivities { get; set; }
public UpdateProfileCommand ToCommand()
{
return new UpdateProfileCommand(
Name,
AvatarPreset,
RegionId,
SelectedSchoolId,
SelectedMajorId,
Stats,
Progress,
ModuleSelections,
RecentActivities);
}
}
public sealed class NotificationStatusDto
{
[Required]
[MinLength(1)]
[MaxLength(100)]
public IReadOnlyCollection<Guid> NotificationIds { get; set; } = [];
[StringLength(32)]
public string? Status { get; set; }
public UpdateNotificationStatusCommand ToCommand()
{
return new UpdateNotificationStatusCommand(NotificationIds, Status);
}
}
public sealed class SubmitFeedbackDto
{
public Guid? QuestionId { get; set; }
[StringLength(50)]
public string? Type { get; set; }
[StringLength(100)]
public string? Category { get; set; }
[StringLength(200)]
public string? Title { get; set; }
[Required]
[StringLength(5000)]
public string Description { get; set; } = string.Empty;
[StringLength(32)]
public string? Priority { get; set; }
[StringLength(200)]
public string? Contact { get; set; }
public JsonElement Attachments { get; set; } = JsonSerializer.SerializeToElement(Array.Empty<object>());
public JsonElement Metadata { get; set; } = JsonSerializer.SerializeToElement(new { });
public SubmitFeedbackCommand ToCommand()
{
return new SubmitFeedbackCommand(
QuestionId,
Type,
Category,
Title,
Description,
Priority,
Contact,
Attachments,
Metadata);
}
}