image änderungen
This commit is contained in:
@@ -1,71 +1,57 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
// src/Webshop.Domain/Entities/Product.cs
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
public class Product
|
||||
namespace Webshop.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
public class Product
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; }
|
||||
[Required, MaxLength(255)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[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(4000)]
|
||||
public string? Description { get; set; }
|
||||
// << ENTFERNT: ImageUrl wird durch Images ersetzt >>
|
||||
// public string? ImageUrl { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? ShortDescription { get; set; }
|
||||
[Required, MaxLength(255)]
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public DateTimeOffset CreatedDate { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset? LastModifiedDate { get; set; }
|
||||
[ForeignKey(nameof(Supplier))]
|
||||
public Guid? SupplierId { get; set; }
|
||||
public decimal? PurchasePrice { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string SKU { get; set; } = string.Empty;
|
||||
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>();
|
||||
|
||||
[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>();
|
||||
}
|
||||
// << NEU: Navigation Property zu Bildern >>
|
||||
public virtual ICollection<ProductImage> Images { get; set; } = new List<ProductImage>();
|
||||
}
|
||||
}
|
||||
26
Webshop.Domain/Entities/ProductImage.cs
Normal file
26
Webshop.Domain/Entities/ProductImage.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
// src/Webshop.Domain/Entities/ProductImage.cs
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities
|
||||
{
|
||||
public class ProductImage
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Required]
|
||||
public string Url { get; set; } = string.Empty;
|
||||
|
||||
public bool IsMainImage { get; set; } = false;
|
||||
|
||||
public int DisplayOrder { get; set; } = 0;
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid ProductId { get; set; }
|
||||
|
||||
public virtual Product Product { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user