Files
ShopSolution-backend/Webshop.Domain/Entities/Product.cs
Tizian.Breuch 55eeaca7f4 naming
2025-08-01 15:11:42 +02:00

72 lines
1.8 KiB
C#

using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace Webshop.Domain.Entities;
public class Product
{
[Key]
public Guid Id { get; set; }
[Required]
[MaxLength(255)]
public string Name { get; set; }
[MaxLength(4000)]
public string? Description { get; set; }
[MaxLength(500)]
public string? ShortDescription { get; set; }
[Required]
[MaxLength(50)]
public string SKU { get; set; } = string.Empty;
[Required]
public decimal Price { get; set; }
public decimal? OldPrice { get; set; }
[Required]
public bool IsActive { get; set; }
[Required]
public bool IsInStock { get; set; }
[Required]
public int StockQuantity { get; set; }
public decimal? Weight { get; set; }
public decimal? Width { get; set; }
public decimal? Height { get; set; }
public decimal? Length { get; set; }
[MaxLength(2000)]
public string? ImageUrl { get; set; }
[Required]
[MaxLength(255)]
public string Slug { get; set; }
[Required]
public DateTimeOffset CreatedDate { get; set; }
public DateTimeOffset? LastModifiedDate { get; set; }
[ForeignKey(nameof(Supplier))]
public Guid? SupplierId { get; set; }
public decimal? PurchasePrice { get; set; }
public virtual Supplier? Supplier { get; set; }
public virtual ICollection<ProductVariant> Variants { get; set; } = new List<ProductVariant>();
public virtual ICollection<Review> Reviews { get; set; } = new List<Review>();
public virtual ICollection<ProductDiscount> ProductDiscounts { get; set; } = new List<ProductDiscount>();
public virtual ICollection<Productcategorie> Productcategories { get; set; } = new List<Productcategorie>();
}