Add project files

This commit is contained in:
2025-10-04 13:27:29 +03:00
parent 75eba696c9
commit cc53824229
46 changed files with 3328 additions and 7 deletions

View File

@@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
namespace T120B165_ImgBoard.Dtos.Post;
public record CreatePostDto(string Title,
[Required]
string Description,
[Required]
List<string> Tags,
[Required]
string FileName,
[Required]
string FileMimeType,
[Required]
[Range(0, long.MaxValue, ErrorMessage = "The {0} must be a valid number and at least {1}.")]
long? FileSize
);
public record EditPostDto(string? Title, string? Description, List<string>? Tags): IValidatableObject
{
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var allEmpty = string.IsNullOrWhiteSpace(Title) &&
string.IsNullOrWhiteSpace(Description) &&
Tags == null;
if (allEmpty)
{
yield return new ValidationResult(
"You must provide at least one value to edit: Title, Description, or Tags.",
[nameof(Title), nameof(Description), nameof(Tags)]
);
}
}
}