This commit is contained in:
Tizian.Breuch
2025-07-29 14:04:35 +02:00
parent 2d6eeb7a50
commit c1ee56c81c
19 changed files with 339 additions and 125 deletions

View File

@@ -1,13 +0,0 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
namespace Webshop.Domain.Entities
{
public class ApplicationUser : IdentityUser
{
public DateTimeOffset CreatedDate { get; set; }
public DateTimeOffset? LastActive { get; set; }
public virtual Customer Customer { get; set; }
}
}

View File

@@ -1,25 +1,40 @@
using System;
// src/Webshop.Domain/Entities/Customer.cs
using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using Webshop.Domain.Identity; // Für ApplicationUser
namespace Webshop.Domain.Entities
{
public class Customer
{
[Key]
public Guid Id { get; set; }
[Required]
public string AspNetUserId { get; set; }
[Required]
[MaxLength(100)]
public string FirstName { get; set; }
[Required]
[MaxLength(100)]
public string LastName { get; set; }
public Guid Id { get; set; } = Guid.NewGuid(); // Default-Wert setzen
public virtual ApplicationUser User { get; set; }
[Required]
public string AspNetUserId { get; set; } // Fremdschlüssel zu ApplicationUser.Id
[Required]
[MaxLength(100)]
public string FirstName { get; set; } = string.Empty;
[Required]
[MaxLength(100)]
public string LastName { get; set; } = string.Empty;
// << ENTFERNT: Email ist auf ApplicationUser >>
// << ENTFERNT: PhoneNumber ist auf ApplicationUser >>
// << ENTFERNT: CreatedDate ist auf ApplicationUser >>
public Guid? DefaultShippingAddressId { get; set; } // Fremdschlüssel zur Standardversandadresse
public Guid? DefaultBillingAddressId { get; set; } // Fremdschlüssel zur Standardrechnungsadresse
// Navigation Property zum ApplicationUser
public virtual ApplicationUser User { get; set; } = default!; // Muss auf ApplicationUser verweisen
// Navigation Properties zu Collections
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>();
}
}
}