aufrüumen
This commit is contained in:
@@ -1,22 +1,13 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Webshop.Domain.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Erweitert die Standard-Identity-Klasse, um anwendungsspezifische
|
||||
/// Eigenschaften für einen Benutzer zu speichern.
|
||||
/// </summary>
|
||||
public class ApplicationUser : IdentityUser
|
||||
{
|
||||
// Hinzugefügtes Feld, das in der Standard-IdentityUser-Klasse fehlt.
|
||||
// Wird benötigt, um die Anforderung Ihrer UserDto zu erfüllen.
|
||||
public DateTimeOffset CreatedDate { get; set; }
|
||||
|
||||
// BEISPIELE FÜR WEITERE NÜTZLICHE FELDER (können bei Bedarf einkommentiert werden):
|
||||
// public string? FirstName { get; set; }
|
||||
// public string? LastName { get; set; }
|
||||
// public byte[]? ProfilePicture { get; set; }
|
||||
// public DateTimeOffset? LastLoginDate { get; set; }
|
||||
public DateTimeOffset? LastActive { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,25 @@
|
||||
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
|
||||
namespace Webshop.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
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; }
|
||||
|
||||
// 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>();
|
||||
}
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
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>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Domain.Entities;
|
||||
|
||||
|
||||
namespace Webshop.Domain.Interfaces
|
||||
{
|
||||
public interface ICustomerRepository
|
||||
{
|
||||
// Fügen Sie hier Methodensignaturen hinzu
|
||||
Task<Customer?> GetByUserIdAsync(string userId);
|
||||
Task UpdateAsync(Customer customer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.18" />
|
||||
<!-- Die Version kann leicht abweichen -->
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user