Projektdateien hinzufügen.
This commit is contained in:
7
Webshop.Domain/Class1.cs
Normal file
7
Webshop.Domain/Class1.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Webshop.Domain
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
56
Webshop.Domain/Entities/Adress.cs
Normal file
56
Webshop.Domain/Entities/Adress.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verwendet für Kundenadressen, Rechnungs- und Lieferadressen von Bestellungen oder Lieferanten.
|
||||
/// </summary>
|
||||
public class Address
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Customer))]
|
||||
public Guid? CustomerId { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string? AddressType { get; set; } // z.B. "Billing", "Shipping"
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Street { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? Street2 { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string City { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? State { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(20)]
|
||||
public string PostalCode { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Country { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
// Navigation Property
|
||||
public virtual Customer? Customer { get; set; }
|
||||
}
|
||||
45
Webshop.Domain/Entities/Category.cs
Normal file
45
Webshop.Domain/Entities/Category.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Zum Gruppieren und Organisieren von Produkten.
|
||||
/// </summary>
|
||||
public class Category
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
// Unique-Constraint wird typischerweise via Fluent API konfiguriert
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Slug { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ParentCategory))]
|
||||
public Guid? ParentCategoryId { get; set; }
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string? ImageUrl { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[Required]
|
||||
public int DisplayOrder { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Category? ParentCategory { get; set; }
|
||||
public virtual ICollection<Category> SubCategories { get; set; } = new List<Category>();
|
||||
public virtual ICollection<ProductCategory> ProductCategories { get; set; } = new List<ProductCategory>();
|
||||
public virtual ICollection<CategoryDiscount> CategoryDiscounts { get; set; } = new List<CategoryDiscount>();
|
||||
}
|
||||
23
Webshop.Domain/Entities/CategoryDiscount.cs
Normal file
23
Webshop.Domain/Entities/CategoryDiscount.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verknüpfungstabelle für die Viele-zu-Viele-Beziehung zwischen Category und Discount.
|
||||
/// </summary>
|
||||
public class CategoryDiscount
|
||||
{
|
||||
[Required]
|
||||
[ForeignKey(nameof(Category))]
|
||||
public Guid CategoryId { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Discount))]
|
||||
public Guid DiscountId { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Category Category { get; set; }
|
||||
public virtual Discount Discount { get; set; }
|
||||
}
|
||||
50
Webshop.Domain/Entities/Customer.cs
Normal file
50
Webshop.Domain/Entities/Customer.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Für registrierte Nutzer des Webshops. Dies ist die Schnittstelle zu ASP.NET Core Identity.
|
||||
/// </summary>
|
||||
public class Customer
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
// Unique-Constraint und Foreign Key werden via Fluent API konfiguriert
|
||||
[Required]
|
||||
[MaxLength(450)]
|
||||
public string AspNetUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
// Unique-Constraint wird von Identity verwaltet
|
||||
[Required]
|
||||
[MaxLength(256)]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
|
||||
[MaxLength(20)]
|
||||
[Phone]
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset CreatedDate { get; set; }
|
||||
|
||||
public DateTimeOffset? LastLoginDate { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual ICollection<Address> Addresses { get; set; } = new List<Address>();
|
||||
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
|
||||
public virtual ICollection<Review> Reviews { get; set; } = new List<Review>();
|
||||
}
|
||||
55
Webshop.Domain/Entities/Discount.cs
Normal file
55
Webshop.Domain/Entities/Discount.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verwaltung von Rabatten auf Produkte oder Kategorien.
|
||||
/// </summary>
|
||||
public class Discount
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string DiscountType { get; set; } // "Percentage", "FixedAmount"
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal DiscountValue { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset StartDate { get; set; }
|
||||
|
||||
public DateTimeOffset? EndDate { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool RequiresCouponCode { get; set; }
|
||||
|
||||
// Unique-Constraint wird via Fluent API konfiguriert
|
||||
[MaxLength(50)]
|
||||
public string? CouponCode { get; set; }
|
||||
|
||||
public decimal? MinimumOrderAmount { get; set; }
|
||||
|
||||
public int? MaximumUsageCount { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CurrentUsageCount { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual ICollection<ProductDiscount> ProductDiscounts { get; set; } = new List<ProductDiscount>();
|
||||
public virtual ICollection<CategoryDiscount> CategoryDiscounts { get; set; } = new List<CategoryDiscount>();
|
||||
}
|
||||
90
Webshop.Domain/Entities/Order.cs
Normal file
90
Webshop.Domain/Entities/Order.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Die Details jeder Kundenbestellung, inklusive Gastbestellungen.
|
||||
/// </summary>
|
||||
public class Order
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
// Unique-Constraint wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string OrderNumber { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Customer))]
|
||||
public Guid? CustomerId { get; set; }
|
||||
|
||||
[MaxLength(256)]
|
||||
[EmailAddress]
|
||||
public string? GuestEmail { get; set; }
|
||||
|
||||
[MaxLength(20)]
|
||||
[Phone]
|
||||
public string? GuestPhoneNumber { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset OrderDate { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string OrderStatus { get; set; }
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal OrderTotal { get; set; }
|
||||
|
||||
[Required]
|
||||
public decimal ShippingCost { get; set; }
|
||||
|
||||
[Required]
|
||||
public decimal TaxAmount { get; set; }
|
||||
|
||||
[Required]
|
||||
public decimal DiscountAmount { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string PaymentStatus { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string PaymentMethod { get; set; }
|
||||
|
||||
[ForeignKey(nameof(PaymentMethodInfo))]
|
||||
public Guid? PaymentMethodId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ShippingMethodInfo))]
|
||||
public Guid? ShippingMethodId { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? TransactionId { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(BillingAddress))]
|
||||
public Guid BillingAddressId { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(ShippingAddress))]
|
||||
public Guid ShippingAddressId { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? CustomerNotes { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? AdminNotes { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Customer? Customer { get; set; }
|
||||
public virtual Address BillingAddress { get; set; }
|
||||
public virtual Address ShippingAddress { get; set; }
|
||||
public virtual PaymentMethod? PaymentMethodInfo { get; set; }
|
||||
public virtual ShippingMethod? ShippingMethodInfo { get; set; }
|
||||
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
|
||||
}
|
||||
47
Webshop.Domain/Entities/OrderItem.cs
Normal file
47
Webshop.Domain/Entities/OrderItem.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Die einzelnen Artikel innerhalb einer Bestellung.
|
||||
/// </summary>
|
||||
public class OrderItem
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Order))]
|
||||
public Guid OrderId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid? ProductId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ProductVariant))]
|
||||
public Guid? ProductVariantId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string ProductName { get; set; } // Snapshot
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string ProductSKU { get; set; } // Snapshot
|
||||
|
||||
[Required]
|
||||
public int Quantity { get; set; }
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal UnitPrice { get; set; }
|
||||
|
||||
[Required]
|
||||
public decimal TotalPrice { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Order Order { get; set; }
|
||||
public virtual Product? Product { get; set; }
|
||||
public virtual ProductVariant? ProductVariant { get; set; }
|
||||
}
|
||||
29
Webshop.Domain/Entities/PaymentMethod.cs
Normal file
29
Webshop.Domain/Entities/PaymentMethod.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Konfigurierbare Zahlungsoptionen für den Checkout.
|
||||
/// </summary>
|
||||
public class PaymentMethod
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string PaymentGatewayType { get; set; } // "Stripe", "PayPal", etc.
|
||||
|
||||
public decimal? ProcessingFee { get; set; }
|
||||
}
|
||||
86
Webshop.Domain/Entities/Product.cs
Normal file
86
Webshop.Domain/Entities/Product.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 1. Das zentrale Modell für deine Verkaufsartikel.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
// Unique-Constraint wird typischerweise via Fluent API konfiguriert:
|
||||
// modelBuilder.Entity<Product>().HasIndex(p => p.SKU).IsUnique();
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string SKU { get; set; }
|
||||
|
||||
// Precision wird typischerweise via Fluent API konfiguriert:
|
||||
// modelBuilder.Entity<Product>().Property(p => p.Price).HasPrecision(18, 2);
|
||||
[Required]
|
||||
public decimal Price { get; set; }
|
||||
|
||||
// modelBuilder.Entity<Product>().Property(p => p.OldPrice).HasPrecision(18, 2);
|
||||
public decimal? OldPrice { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsInStock { get; set; }
|
||||
|
||||
[Required]
|
||||
public int StockQuantity { get; set; }
|
||||
|
||||
// modelBuilder.Entity<Product>().Property(p => p.Weight).HasPrecision(18, 3);
|
||||
public decimal? Weight { get; set; }
|
||||
|
||||
// modelBuilder.Entity<Product>().Property(p => p.Width).HasPrecision(18, 2);
|
||||
public decimal? Width { get; set; }
|
||||
|
||||
// modelBuilder.Entity<Product>().Property(p => p.Height).HasPrecision(18, 2);
|
||||
public decimal? Height { get; set; }
|
||||
|
||||
// modelBuilder.Entity<Product>().Property(p => p.Length).HasPrecision(18, 2);
|
||||
public decimal? Length { get; set; }
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string? ImageUrl { get; set; }
|
||||
|
||||
// Unique-Constraint wird typischerweise via Fluent API konfiguriert:
|
||||
// modelBuilder.Entity<Product>().HasIndex(p => p.Slug).IsUnique();
|
||||
[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; }
|
||||
|
||||
// modelBuilder.Entity<Product>().Property(p => p.PurchasePrice).HasPrecision(18, 2);
|
||||
public decimal? PurchasePrice { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
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<ProductCategory> ProductCategories { get; set; } = new List<ProductCategory>();
|
||||
}
|
||||
24
Webshop.Domain/Entities/ProductCategory.cs
Normal file
24
Webshop.Domain/Entities/ProductCategory.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verknüpfungstabelle für die Viele-zu-Viele-Beziehung zwischen Category und Discount.
|
||||
/// </summary>
|
||||
public class ProductCategory
|
||||
{
|
||||
// Composite Primary Key wird via Fluent API in Ihrem DbContext konfiguriert:
|
||||
// modelBuilder.Entity<ProductCategory>().HasKey(pc => new { pc.ProductId, pc.CategoryId });
|
||||
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid ProductId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Category))]
|
||||
public Guid CategoryId { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Product Product { get; set; }
|
||||
public virtual Category Category { get; set; }
|
||||
}
|
||||
23
Webshop.Domain/Entities/ProductDiscount.cs
Normal file
23
Webshop.Domain/Entities/ProductDiscount.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verknüpfungstabelle für die Viele-zu-Viele-Beziehung zwischen Product und Discount.
|
||||
/// </summary>
|
||||
public class ProductDiscount
|
||||
{
|
||||
[Required]
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid ProductId { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Discount))]
|
||||
public Guid DiscountId { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Product Product { get; set; }
|
||||
public virtual Discount Discount { get; set; }
|
||||
}
|
||||
46
Webshop.Domain/Entities/ProductVariant.cs
Normal file
46
Webshop.Domain/Entities/ProductVariant.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Für Produkte mit unterschiedlichen Attributen (z.B. Größe, Farbe) und eigenem Lagerbestand.
|
||||
/// </summary>
|
||||
public class ProductVariant
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid ProductId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; } // z.B. "Farbe", "Größe"
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Value { get; set; } // z.B. "Rot", "XL"
|
||||
|
||||
// Unique-Constraint wird typischerweise via Fluent API konfiguriert
|
||||
[MaxLength(50)]
|
||||
public string? SKU { get; set; }
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal PriceAdjustment { get; set; }
|
||||
|
||||
[Required]
|
||||
public int StockQuantity { get; set; }
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string? ImageUrl { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
// Navigation Property
|
||||
public virtual Product Product { get; set; }
|
||||
}
|
||||
41
Webshop.Domain/Entities/Review.cs
Normal file
41
Webshop.Domain/Entities/Review.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Kundenbewertungen für Produkte.
|
||||
/// </summary>
|
||||
public class Review
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid ProductId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Customer))]
|
||||
public Guid? CustomerId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, 5)]
|
||||
public int Rating { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string? Comment { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset ReviewDate { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsApproved { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Product Product { get; set; }
|
||||
public virtual Customer? Customer { get; set; }
|
||||
}
|
||||
30
Webshop.Domain/Entities/Setting.cs
Normal file
30
Webshop.Domain/Entities/Setting.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Generische Tabelle für flexible Shop-Einstellungen.
|
||||
/// </summary>
|
||||
public class Setting
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
// Unique-Constraint wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Key { get; set; }
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string? Value { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Group { get; set; } // "Shipping", "Order Processing", etc.
|
||||
}
|
||||
35
Webshop.Domain/Entities/ShippingMethod.cs
Normal file
35
Webshop.Domain/Entities/ShippingMethod.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Konfigurierbare Versandoptionen für den Checkout.
|
||||
/// </summary>
|
||||
public class ShippingMethod
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal BaseCost { get; set; }
|
||||
|
||||
public decimal? MinimumOrderAmount { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? EstimatedDeliveryTime { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool RequiresTracking { get; set; }
|
||||
}
|
||||
40
Webshop.Domain/Entities/Supplier.cs
Normal file
40
Webshop.Domain/Entities/Supplier.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Details zu den Produktlieferanten.
|
||||
/// </summary>
|
||||
public class Supplier
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? ContactPerson { get; set; }
|
||||
|
||||
[MaxLength(256)]
|
||||
[EmailAddress]
|
||||
public string? Email { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
[Phone]
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Address))]
|
||||
public Guid? AddressId { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? Notes { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Address? Address { get; set; }
|
||||
public virtual ICollection<Product> Products { get; set; } = new List<Product>();
|
||||
}
|
||||
6
Webshop.Domain/Enums/AddressType.cs
Normal file
6
Webshop.Domain/Enums/AddressType.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
public enum AddressType
|
||||
{
|
||||
Billing,
|
||||
Shipping,
|
||||
CustomerDefault
|
||||
}
|
||||
1
Webshop.Domain/Enums/DiscountType.cs
Normal file
1
Webshop.Domain/Enums/DiscountType.cs
Normal file
@@ -0,0 +1 @@
|
||||
public enum DiscountType { Percentage, FixedAmount }
|
||||
1
Webshop.Domain/Enums/OrderStatus.cs
Normal file
1
Webshop.Domain/Enums/OrderStatus.cs
Normal file
@@ -0,0 +1 @@
|
||||
public enum OrderStatus { Pending, Processing, Shipped, Delivered, Cancelled, Refunded }
|
||||
7
Webshop.Domain/Enums/PaymentGatewayType.cs
Normal file
7
Webshop.Domain/Enums/PaymentGatewayType.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
public enum PaymentGatewayType
|
||||
{
|
||||
Stripe,
|
||||
PayPal,
|
||||
Klarna,
|
||||
Manual // z.B. Vorkasse
|
||||
}
|
||||
1
Webshop.Domain/Enums/PaymentStatus.cs
Normal file
1
Webshop.Domain/Enums/PaymentStatus.cs
Normal file
@@ -0,0 +1 @@
|
||||
public enum PaymentStatus { Pending, Paid, Failed, Refunded }
|
||||
14
Webshop.Domain/Interfaces/IProductRepository.cs
Normal file
14
Webshop.Domain/Interfaces/IProductRepository.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
// src/Webshop.Domain/Interfaces/IProductRepository.cs
|
||||
using Webshop.Domain.Entities;
|
||||
|
||||
namespace Webshop.Domain.Interfaces
|
||||
{
|
||||
public interface IProductRepository
|
||||
{
|
||||
Task<Product?> GetProductByIdAsync(Guid id);
|
||||
Task<IEnumerable<Product>> GetAllProductsAsync();
|
||||
Task AddProductAsync(Product product);
|
||||
Task UpdateProductAsync(Product product);
|
||||
Task DeleteProductAsync(Guid id);
|
||||
}
|
||||
}
|
||||
9
Webshop.Domain/Webshop.Domain.csproj
Normal file
9
Webshop.Domain/Webshop.Domain.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user