summaryrefslogtreecommitdiff
path: root/Models/Book.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Models/Book.cs')
-rw-r--r--Models/Book.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Models/Book.cs b/Models/Book.cs
index 29faa97..49bd527 100644
--- a/Models/Book.cs
+++ b/Models/Book.cs
@@ -1,12 +1,22 @@
+using System.ComponentModel.DataAnnotations;
+using LibraryAPI.Validators;
+
namespace LibraryAPI.Models {
public class Book {
public long Id { get; set; }
+ [Required]
public long AuthorId { get; set; }
public Author? Author { get; set; }
+ [Required]
public int PublicationYear { get; set; }
+ [Required]
public string[]? Genres { get; set; }
public int Edition { get; set; }
+ [Required]
+ [ISBN(13)]
public string? ISBN { get; set; }
+ [Required]
+ [StringLength(128, ErrorMessage = "Title too long")]
public string? Title { get; set; }
}
} \ No newline at end of file