// Auto-generiert von CreateWebshopFiles.ps1 using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; using Webshop.Application.DTOs.Users; using System; using System.Collections.Generic; using System.Threading.Tasks; using Webshop.Application.Services.Admin.Interfaces; namespace Webshop.Api.Controllers.Admin { [ApiController] [Route("api/v1/admin/[controller]")] [Authorize(Roles = "Admin")] public class AdminUsersController : ControllerBase { private readonly IAdminUserService _adminUserService; public AdminUsersController(IAdminUserService adminUserService) { _adminUserService = adminUserService; } [HttpGet] public async Task>> GetAllUsers() { var users = await _adminUserService.GetAllUsersAsync(); return Ok(users); } [HttpGet("{userId}")] public async Task> GetUserById(string userId) { var user = await _adminUserService.GetUserByIdAsync(userId); if (user == null) return NotFound(); return Ok(user); } } }