Add base product DbEntities and domain Entities

This commit is contained in:
lumijiez
2025-05-04 00:53:16 +03:00
parent 6e98b7dc22
commit 7fd2af2d5a
13 changed files with 379 additions and 15 deletions

View File

@@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Printbase.Infrastructure.DbEntities.Products;
[Table("Products")]
public class ProductDbEntity
{
[Key, Required]
public Guid Id { get; set; }
[MaxLength(50), Required]
public required string Name { get; set; }
[MaxLength(1000)]
public string? Description { get; set; }
[Column(TypeName = "decimal(18,2)")]
public decimal? Discount { get; set; }
[Required]
public Guid TypeId { get; set; }
[ForeignKey(nameof(TypeId)), Required]
public required ProductTypeDbEntity Type { get; set; }
[InverseProperty(nameof(ProductVariantDbEntity.Product)), Required]
public required ICollection<ProductVariantDbEntity> Variants { get; set; }
}