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

@@ -1,12 +1,12 @@
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Webshop.Application.DTOs;
using Webshop.Application.Services.Admin;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Products;
using Webshop.Application.Services.Admin.Interfaces;
namespace Webshop.Api.Controllers.Admin
{

View File

@@ -1,11 +1,11 @@
// src/Webshop.Api/Controllers/Admin/AdminSuppliersController.cs
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Webshop.Application.DTOs;
using Webshop.Application.Services.Admin; // Wichtig f<>r IAdminSupplierService
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Suppliers;
using Webshop.Application.Services.Admin.Interfaces;
namespace Webshop.Api.Controllers.Admin
{

View File

@@ -2,11 +2,11 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Webshop.Application.DTOs.Users;
using Webshop.Application.Services.Admin;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.Services.Admin.Interfaces;
namespace Webshop.Api.Controllers.Admin
{

View File

@@ -1,18 +0,0 @@
// 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.Customer
{
[ApiController]
[Route("api/v1/customer/[controller]")]
[Authorize(Roles = "Customer")]
public class ProfileController : ControllerBase
{
}
}

View File

@@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Api.Controllers.Customer
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/[controller]")]

View File

@@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Api.Controllers.Customer
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/[controller]")]

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

@@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Webshop.Api.Controllers.Customer
namespace Webshop.Api.Controllers.Customers
{
[ApiController]
[Route("api/v1/customer/[controller]")]

View File

@@ -1,12 +1,12 @@
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Webshop.Application.DTOs;
using Webshop.Application.Services.Public;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Products;
namespace Webshop.Api.Controllers.Public
{