naming
This commit is contained in:
@@ -14,11 +14,11 @@ namespace Webshop.Api.Controllers.Customer
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/v1/customer/[controller]")] // z.B. /api/v1/customer/profile
|
[Route("api/v1/customer/[controller]")] // z.B. /api/v1/customer/profile
|
||||||
[Authorize(Roles = "Customer")]
|
[Authorize(Roles = "Customer")]
|
||||||
public class ProfileController : ControllerBase
|
public class CustomerController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ICustomerService _customerService;
|
private readonly ICustomerService _customerService;
|
||||||
|
|
||||||
public ProfileController(ICustomerService customerService)
|
public CustomerController(ICustomerService customerService)
|
||||||
{
|
{
|
||||||
_customerService = customerService;
|
_customerService = customerService;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ namespace Webshop.Api.Controllers.Customer
|
|||||||
|
|
||||||
// << NEUER/AKTUALISIERTER ENDPUNKT FÜR PROFIL-AKTUALISIERUNG >>
|
// << NEUER/AKTUALISIERTER ENDPUNKT FÜR PROFIL-AKTUALISIERUNG >>
|
||||||
[HttpPost("update-profile")] // /api/v1/customer/profile/update-profile
|
[HttpPost("update-profile")] // /api/v1/customer/profile/update-profile
|
||||||
public async Task<IActionResult> UpdateProfile([FromBody] UpdateCustomerProfileDto request)
|
public async Task<IActionResult> UpdateProfile([FromBody] UpdateCustomerDto request)
|
||||||
{
|
{
|
||||||
if (!ModelState.IsValid) return BadRequest(ModelState);
|
if (!ModelState.IsValid) return BadRequest(ModelState);
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace Webshop.Application.DTOs.Customers
|
namespace Webshop.Application.DTOs.Customers
|
||||||
{
|
{
|
||||||
public class UpdateCustomerProfileDto
|
public class UpdateCustomerDto
|
||||||
{
|
{
|
||||||
[Required(ErrorMessage = "Vorname ist erforderlich.")]
|
[Required(ErrorMessage = "Vorname ist erforderlich.")]
|
||||||
[StringLength(100)]
|
[StringLength(100)]
|
||||||
@@ -62,7 +62,7 @@ namespace Webshop.Application.Services.Customers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// << NEUE IMPLEMENTIERUNG: UpdateMyProfileAsync verarbeitet alle Felder >>
|
// << NEUE IMPLEMENTIERUNG: UpdateMyProfileAsync verarbeitet alle Felder >>
|
||||||
public async Task<(bool Success, string ErrorMessage)> UpdateMyProfileAsync(string userId, UpdateCustomerProfileDto profileDto)
|
public async Task<(bool Success, string ErrorMessage)> UpdateMyProfileAsync(string userId, UpdateCustomerDto profileDto)
|
||||||
{
|
{
|
||||||
var customer = await _customerRepository.GetByUserIdAsync(userId);
|
var customer = await _customerRepository.GetByUserIdAsync(userId);
|
||||||
if (customer == null) return (false, "Kundenprofil nicht gefunden.");
|
if (customer == null) return (false, "Kundenprofil nicht gefunden.");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Webshop.Application.Services.Customers
|
|||||||
{
|
{
|
||||||
Task<CustomerDto?> GetMyProfileAsync(string userId);
|
Task<CustomerDto?> GetMyProfileAsync(string userId);
|
||||||
Task<(bool Success, string ErrorMessage)> ChangePasswordAsync(string userId, ChangePasswordRequestDto request);
|
Task<(bool Success, string ErrorMessage)> ChangePasswordAsync(string userId, ChangePasswordRequestDto request);
|
||||||
Task<(bool Success, string ErrorMessage)> UpdateMyProfileAsync(string userId, UpdateCustomerProfileDto profileDto);
|
Task<(bool Success, string ErrorMessage)> UpdateMyProfileAsync(string userId, UpdateCustomerDto profileDto);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user