Sube carpetas API, API.Tests, Application y Domain del Backend
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Application.DTOs.BlogPosts.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to create a new blog post, including file upload for the photo.
|
||||
/// </summary>
|
||||
public class CreateBlogPostRequest
|
||||
{
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Author { get; set; }
|
||||
|
||||
[Required]
|
||||
public required string Title { get; set; }
|
||||
|
||||
public IFormFile? PhotoFile { get; set; }
|
||||
|
||||
[Required]
|
||||
public required string MarkdownText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the post is published or a draft; defaults to true so existing create flows are unaffected.
|
||||
/// </summary>
|
||||
public bool IsPublished { get; set; } = true;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Application.DTOs.Abstract.Request;
|
||||
|
||||
namespace Application.DTOs.BlogPosts.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get filtered blog posts.
|
||||
/// </summary>
|
||||
public class GetBlogPostsFilteredRequest : PaginatedFilterRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Overrides the base PaginatedFilterRequest default to sort newest-created-first.
|
||||
/// </summary>
|
||||
public GetBlogPostsFilteredRequest()
|
||||
{
|
||||
// String literal matches EntityBase.DateCreated; QueryableExtensions.SortBy resolves this name against the entity by reflection.
|
||||
OrderBy = "DateCreated";
|
||||
Order = SortOrder.Descending;
|
||||
}
|
||||
|
||||
public string? Author { get; set; }
|
||||
|
||||
public string? Title { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Application.DTOs.BlogPosts.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to update the photo for a blog post.
|
||||
/// </summary>
|
||||
public class UpdateBlogPostPhotoRequest
|
||||
{
|
||||
[Required]
|
||||
public required IFormFile PhotoFile { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Application.DTOs.BlogPosts.Request;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to update a blog post.
|
||||
/// </summary>
|
||||
public class UpdateBlogPostRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Null leaves the current title unchanged.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Null leaves the current Markdown content unchanged.
|
||||
/// </summary>
|
||||
public string? MarkdownText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Null leaves the current author unchanged.
|
||||
/// </summary>
|
||||
public string? Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The updated publication state; null leaves it unchanged, true publishes, false reverts to a draft.
|
||||
/// </summary>
|
||||
public bool? IsPublished { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Application.DTOs.Abstract.Response;
|
||||
|
||||
using System;
|
||||
|
||||
namespace Application.DTOs.BlogPosts.Response;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response data for a blog post.
|
||||
/// </summary>
|
||||
public class BlogPostResponse : BaseEntityResponse
|
||||
{
|
||||
public required string Author { get; set; }
|
||||
|
||||
public required string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique, URL-friendly identifier used in public blog post links.
|
||||
/// </summary>
|
||||
public required string Slug { get; set; }
|
||||
|
||||
public int Views { get; set; }
|
||||
|
||||
public string? PhotoUrl { get; set; }
|
||||
|
||||
public required string MarkdownText { get; set; }
|
||||
|
||||
public required DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the post is published and visible publicly, or is a draft.
|
||||
/// </summary>
|
||||
public bool IsPublished { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user