Created Author, Book, AuthorBook, Page and Product with Price

This commit is contained in:
Khwezi Mngoma
2026-05-25 22:18:53 +02:00
parent 87da491ed6
commit d55bf4f82f
39 changed files with 1383 additions and 23 deletions
@@ -0,0 +1,9 @@
using LiteCharms.Features.MidrandBooks.AuthorBooks.Entities;
namespace LiteCharms.Features.MidrandBooks.Authors.Entities;
[EntityTypeConfiguration<AuthorConfiguration, Author>]
public class Author : Models.Author
{
public ICollection<AuthorBook> Books { get; set; } = [];
}
@@ -0,0 +1,24 @@
namespace LiteCharms.Features.MidrandBooks.Authors.Entities;
public class AuthorConfiguration : IEntityTypeConfiguration<Author>
{
public void Configure(EntityTypeBuilder<Author> builder)
{
builder.ToTable("Authors");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
builder.Property(f => f.UpdatedAt).HasDefaultValueSql("now()");
builder.Property(f => f.PublisherType).IsRequired();
builder.Property(f => f.VatNumber).IsRequired(false).HasMaxLength(255);
builder.Property(f => f.Name).IsRequired().HasMaxLength(255);
builder.Property(f => f.LastName).IsRequired().HasMaxLength(255);
builder.Property(f => f.Biography).IsRequired(false).HasMaxLength(2048);
builder.Property(f => f.Email).IsRequired().HasMaxLength(512);
builder.Property(f => f.Website).IsRequired(false).HasMaxLength(1024);
builder.Property(f => f.ImageUrl).IsRequired().HasMaxLength(2048);
builder.Property(f => f.ThumbnailImageUrl).IsRequired(false).HasMaxLength(2048);
builder.Property(f => f.SocialMedia).IsRequired(false).HasColumnType("jsonb");
builder.Property(f => f.Enabled).HasDefaultValue(true);
}
}