mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 11:58:19 +02:00
Use DTOs to return API requests instead of Database Schema types.
Make use of IHttpStatusCodeResults
This commit is contained in:
52
API/Controllers/DTOs/Chapter.cs
Normal file
52
API/Controllers/DTOs/Chapter.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.Controllers.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="API.Schema.MangaContext.Chapter"/> DTO
|
||||
/// </summary>
|
||||
public record Chapter(string Key, string MangaId, int? Volume, string ChapterNumber, string? Title, IEnumerable<MangaConnectorId> MangaConnectorIds, bool Downloaded) : Identifiable(Key)
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier of the Manga this Chapter belongs to
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Identifier of the Manga this Chapter belongs to")]
|
||||
public string MangaId { get; init; } = MangaId;
|
||||
|
||||
/// <summary>
|
||||
/// Volume number
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Volume number")]
|
||||
public int? Volume { get; init; } = Volume;
|
||||
|
||||
/// <summary>
|
||||
/// Chapter number
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Chapter number")]
|
||||
public string ChapterNumber { get; init; } = ChapterNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Title of the Chapter
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Title of the Chapter")]
|
||||
public string? Title { get; init; } = Title;
|
||||
|
||||
/// <summary>
|
||||
/// Whether Chapter is Downloaded (on disk)
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Whether Chapter is Downloaded (on disk)")]
|
||||
public bool Downloaded { get; init; } = Downloaded;
|
||||
|
||||
/// <summary>
|
||||
/// Ids of the Manga on MangaConnectors
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("Ids of the Manga on MangaConnectors")]
|
||||
public IEnumerable<MangaConnectorId> MangaConnectorIds { get; init; } = MangaConnectorIds;
|
||||
}
|
Reference in New Issue
Block a user