aufrüumen

This commit is contained in:
Tizian.Breuch
2025-07-25 15:46:31 +02:00
parent 8218b860ca
commit 9e298a0458
74 changed files with 453 additions and 3557 deletions

View File

@@ -0,0 +1,18 @@
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/[controller]")]
[Authorize(Roles = "Customer")]
public class CheckoutController : ControllerBase
{
}
}

View File

@@ -0,0 +1,22 @@
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/[controller]")]
[Authorize(Roles = "Customer")]
public class OrdersController : ControllerBase
{
[HttpGet("my-orders")]
public async Task<IActionResult> GetMyOrders()
{
return Ok(new { Message = "Dies ist Ihr persönlicher Bestellverlauf (Platzhalter)." });
}
}
}

View File

@@ -0,0 +1,51 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Customers;
using Webshop.Application.Services.Customers.Interfaces;
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/profile")] // Eindeutige Route f<>r das Profil
[Authorize(Roles = "Customer")] // Nur f<>r eingeloggte Kunden!
public class ProfileController : ControllerBase
{
private readonly ICustomerService _customerService;
public ProfileController(ICustomerService customerService)
{
_customerService = customerService;
}
// Hilfsmethode, um die ID des eingeloggten Benutzers aus dem Token zu holen
private string GetUserId() => User.FindFirstValue(ClaimTypes.NameIdentifier)!;
[HttpGet("me")] // GET /api/v1/customer/profile/me
public async Task<ActionResult<CustomerDto>> GetMyProfile()
{
var userId = GetUserId();
var profile = await _customerService.GetMyProfileAsync(userId);
if (profile == null)
{
return NotFound("Kundenprofil nicht gefunden.");
}
return Ok(profile);
}
[HttpPut("me")] // PUT /api/v1/customer/profile/me
public async Task<IActionResult> UpdateMyProfile([FromBody] UpdateCustomerProfileDto profileDto)
{
var userId = GetUserId();
var success = await _customerService.UpdateMyProfileAsync(userId, profileDto);
if (!success)
{
return NotFound("Kundenprofil nicht gefunden.");
}
return NoContent(); // Standardantwort f<>r ein erfolgreiches Update
}
}
}

View File

@@ -0,0 +1,18 @@
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/[controller]")]
[Authorize(Roles = "Customer")]
public class ReviewsController : ControllerBase
{
}
}