From b9ab10e3e7aa47e2dd83c6b33acfb600976c2035 Mon Sep 17 00:00:00 2001 From: DavidLazarescu Date: Thu, 14 Mar 2024 13:20:39 +0100 Subject: [PATCH] Added extension --- src/Application/Common/DTOs/Books/BookInDto.cs | 3 +++ src/Application/Common/DTOs/Books/BookOutDto.cs | 2 ++ src/Domain/Entities/Book.cs | 3 +++ .../Persistence/Migrations/DataContextModelSnapshot.cs | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/src/Application/Common/DTOs/Books/BookInDto.cs b/src/Application/Common/DTOs/Books/BookInDto.cs index 18c8a5a..941a439 100644 --- a/src/Application/Common/DTOs/Books/BookInDto.cs +++ b/src/Application/Common/DTOs/Books/BookInDto.cs @@ -30,6 +30,9 @@ public class BookInDto [MinLength(2, ErrorMessage = "The format is too short")] [MaxLength(100, ErrorMessage = "The format is too long")] public string Format { get; set; } + + [MaxLength(500, ErrorMessage = "The extension is too long")] + public string Extension { get; set; } [EmptyOrMinLength(2, ErrorMessage = "The language is too short")] [MaxLength(100, ErrorMessage = "The language is too long")] diff --git a/src/Application/Common/DTOs/Books/BookOutDto.cs b/src/Application/Common/DTOs/Books/BookOutDto.cs index d2cb386..d67c501 100644 --- a/src/Application/Common/DTOs/Books/BookOutDto.cs +++ b/src/Application/Common/DTOs/Books/BookOutDto.cs @@ -16,6 +16,8 @@ public class BookOutDto public string Format { get; set; } + public string Extension { get; set; } + public string Language { get; set; } public string DocumentSize { get; set; } diff --git a/src/Domain/Entities/Book.cs b/src/Domain/Entities/Book.cs index 55bab24..e079a85 100644 --- a/src/Domain/Entities/Book.cs +++ b/src/Domain/Entities/Book.cs @@ -27,6 +27,9 @@ public class Book [MaxLength(100, ErrorMessage = "The format is too long")] public string Format { get; set; } + [MaxLength(500, ErrorMessage = "The extension is too long")] + public string Extension { get; set; } + [MinLength(2, ErrorMessage = "The language is too short")] [MaxLength(100, ErrorMessage = "The language is too long")] public string Language { get; set; } diff --git a/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs b/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs index 2bbdac9..4283808 100644 --- a/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs +++ b/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs @@ -64,6 +64,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(60) .HasColumnType("nvarchar(60)"); + b.Property("Extension") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + b.Property("FileHash") .IsRequired() .ValueGeneratedOnAdd()