This commit is contained in:
Tizian.Breuch
2025-07-29 14:14:51 +02:00
parent 2cf73a2aac
commit deab93855e
4 changed files with 6 additions and 6 deletions

View File

@@ -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);

View File

@@ -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)]

View File

@@ -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.");

View File

@@ -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);
} }
} }