Files
ShopSolution-backend/CreateWebshopFiles.ps1
Tizian.Breuch ce69373adb try
2025-07-23 21:08:30 +02:00

939 lines
50 KiB
PowerShell

# Definieren des Basisverzeichnisses der Solution
$solutionRoot = Get-Location
Write-Host "Starte Dateierstellung im Verzeichnis: $solutionRoot" -ForegroundColor Green
# --- Hilfsfunktionen ---
function New-CSharpFile {
param (
[string]$ProjectName,
[string]$RelativePath, # Pfad relativ zum Projekt (z.B. "Controllers/Admin")
[string]$FileName,
[string]$Type, # "class" oder "interface"
[string]$BaseNamespace # Z.B. "Webshop.Application"
)
# Korrigierte Join-Path-Verwendung: Kein "src" hier, da Projekte direkt unter solutionRoot liegen
$projectSpecificDir = Join-Path -Path $solutionRoot -ChildPath $ProjectName
# Wenn RelativePath leer ist, ist fullDirPath gleich projectSpecificDir
if ([string]::IsNullOrEmpty($RelativePath)) {
$fullDirPath = $projectSpecificDir
} else {
$fullDirPath = Join-Path -Path $projectSpecificDir -ChildPath $RelativePath
}
$fullFilePath = Join-Path -Path $fullDirPath -ChildPath $FileName
# Sicherstellen, dass der Zielordner existiert
if (-not (Test-Path $fullDirPath)) {
New-Item -ItemType Directory -Path $fullDirPath -Force | Out-Null
Write-Host "Ordner erstellt: $fullDirPath" -ForegroundColor DarkGray
}
# Den vollständigen Namespace berechnen (z.B. Webshop.Application.Services.Admin)
$fullNamespace = $BaseNamespace
if (-not [string]::IsNullOrEmpty($RelativePath)) {
$namespaceParts = $RelativePath.Replace('/', '.')
$fullNamespace = "$BaseNamespace.$namespaceParts"
}
$nameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($FileName)
$fileContent = "" # Initialisiere als leeren String
# Standard-Usings, die fast immer benötigt werden
$commonUsings = @"
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
"@
# Spezielle Inhalte für Controller
if ($ProjectName -eq "Webshop.Api" -and $RelativePath.StartsWith("Controllers")) {
$controllerSpecificUsings = ""
# Korrektur der Route: Das letzte Segment des RelativePath wird als Basis für den Controller-Namen verwendet
$routeBaseSegment = $RelativePath.Split('/')[-1].ToLower()
# Wenn es sich um einen Top-Level Controller handelt (z.B. AuthController direkt in Controllers, nicht in Unterordner)
# AuthController wird manuell gehandhabt, da die Route `api/v1/[controller]` ist.
# Alle anderen Controller in Unterordnern haben `api/v1/subfolder/[controller]`
if ($routeBaseSegment -eq "controllers") { # Dies sollte eigentlich nicht mehr vorkommen nach der Umstrukturierung
$controllerAttributes = "[ApiController]`n [Route(`"api/v1/[controller]"")]"
} else {
$controllerAttributes = "[ApiController]`n [Route(`"api/v1/$routeBaseSegment/[controller]"")]"
}
# Autorisierungsattribute
if ($RelativePath -like "*Admin") {
$controllerSpecificUsings += "using Microsoft.AspNetCore.Authorization;`n"
$controllerAttributes += "`n [Authorize(Roles = `"Admin`")]"
} elseif ($RelativePath -like "*Customer") {
$controllerSpecificUsings += "using Microsoft.AspNetCore.Authorization;`n"
$controllerAttributes += "`n [Authorize(Roles = `"Customer`")]"
} elseif ($RelativePath -like "*Public") {
$controllerSpecificUsings += "using Microsoft.AspNetCore.Authorization;`n"
$controllerAttributes += "`n [AllowAnonymous]"
}
# Bei Auth-Controllern keine Autorisierung als Standard, und Route spezifisch
if ($RelativePath -eq "Controllers/Auth") {
$controllerAttributes = "[ApiController]`n [Route(`"api/v1/[controller]"")]" # Auth-Controller haben oft eine eigene Route
$controllerSpecificUsings += "using Microsoft.AspNetCore.Authorization;`n" # Trotzdem für AllowAnonymous
$controllerSpecificUsings += "using Webshop.Application.DTOs.Auth;`nusing Webshop.Application.Services.Auth;`n"
$controllerContentBody = @"
private readonly IAuthService _authService;
public AuthController(IAuthService authService)
{
_authService = authService;
}
[HttpPost(""register"")]
[AllowAnonymous]
public async Task<IActionResult> Register([FromBody] RegisterRequestDto request)
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var result = await _authService.RegisterUserAsync(request);
if (!result.IsAuthSuccessful) return BadRequest(new { Message = result.ErrorMessage });
return Ok(result);
}
[HttpPost(""login/customer"")]
[AllowAnonymous]
public async Task<IActionResult> LoginCustomer([FromBody] LoginRequestDto request)
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var result = await _authService.LoginUserAsync(request);
if (!result.IsAuthSuccessful) return Unauthorized(new { Message = result.ErrorMessage });
return Ok(result);
}
[HttpPost(""login/admin"")]
[AllowAnonymous]
public async Task<IActionResult> LoginAdmin([FromBody] LoginRequestDto request)
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var result = await _authService.LoginAdminAsync(request);
if (!result.IsAuthSuccessful) return Unauthorized(new { Message = result.ErrorMessage });
return Ok(result);
}
"@
} # End AuthController
elseif ($RelativePath -eq "Controllers/Public" -and $nameWithoutExtension -eq "ProductsController") {
$controllerSpecificUsings += "using Webshop.Application.DTOs;`nusing Webshop.Application.Services.Public;`n"
$controllerContentBody = @"
private readonly ProductService _productService; // ServiceName nach Ihrer Konvention beibehalten
public ProductsController(ProductService productService)
{
_productService = productService;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<ProductDto>>> GetAllProducts()
{
var products = await _productService.GetAllProductsAsync();
return Ok(products);
}
"@
} # End ProductsController (Public)
elseif ($RelativePath -eq "Controllers/Admin" -and $nameWithoutExtension -eq "AdminProductsController") {
$controllerSpecificUsings += "using Webshop.Application.DTOs;`nusing Webshop.Application.Services.Admin;`n"
$controllerContentBody = @"
private readonly AdminProductService _adminProductService;
public AdminProductsController(AdminProductService adminProductService)
{
_adminProductService = adminProductService;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<AdminProductDto>>> GetAdminProducts()
{
var products = await _adminProductService.GetAllAdminProductsAsync();
return Ok(products);
}
[HttpGet(""{id}"")]
public async Task<ActionResult<AdminProductDto>> GetAdminProduct(Guid id)
{
var product = await _adminProductService.GetAdminProductByIdAsync(id);
if (product == null) return NotFound();
return Ok(product);
}
[HttpPost]
public async Task<ActionResult<AdminProductDto>> CreateAdminProduct([FromBody] AdminProductDto productDto)
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var createdProduct = await _adminProductService.CreateAdminProductAsync(productDto);
return CreatedAtAction(nameof(GetAdminProduct), new { id = createdProduct.Id }, createdProduct);
}
[HttpPut(""{id}"")]
public async Task<IActionResult> UpdateAdminProduct(Guid id, [FromBody] AdminProductDto productDto)
{
if (id != productDto.Id) return BadRequest();
if (!ModelState.IsValid) return BadRequest(ModelState);
var success = await _adminProductService.UpdateAdminProductAsync(productDto);
if (!success) return NotFound();
return NoContent();
}
[HttpDelete(""{id}"")]
public async Task<IActionResult> DeleteAdminProduct(Guid id)
{
var success = await _adminProductService.DeleteAdminProductAsync(id);
if (!success) return NotFound();
return NoContent();
}
"@
} # End AdminProductsController
elseif ($RelativePath -eq "Controllers/Admin" -and $nameWithoutExtension -eq "AdminUsersController") {
$controllerSpecificUsings += "using Webshop.Application.DTOs.Users;`nusing Webshop.Application.Services.Admin;`n"
$controllerContentBody = @"
private readonly AdminUserService _adminUserService;
public AdminUsersController(AdminUserService adminUserService)
{
_adminUserService = adminUserService;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<UserDto>>> GetAllUsers()
{
var users = await _adminUserService.GetAllUsersAsync();
return Ok(users);
}
[HttpGet(""{userId}"")]
public async Task<ActionResult<UserDto>> GetUserById(string userId)
{
var user = await _adminUserService.GetUserByIdAsync(userId);
if (user == null) return NotFound();
return Ok(user);
}
"@
} # End AdminUsersController
elseif ($RelativePath -eq "Controllers/Admin" -and $nameWithoutExtension -eq "AdminSuppliersController") {
$controllerSpecificUsings += "using Webshop.Application.DTOs;`nusing Webshop.Application.Services.Admin;`n"
$controllerContentBody = @"
private readonly AdminSupplierService _adminSupplierService;
public AdminSuppliersController(AdminSupplierService adminSupplierService)
{
_adminSupplierService = adminSupplierService;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<SupplierDto>>> GetAllSuppliers()
{
var suppliers = await _adminSupplierService.GetAllSuppliersAsync();
return Ok(suppliers);
}
[HttpPost]
public async Task<ActionResult<SupplierDto>> CreateSupplier([FromBody] SupplierDto supplierDto)
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var createdSupplier = await _adminSupplierService.CreateSupplierAsync(supplierDto);
return CreatedAtAction(nameof(GetSupplierById), new { id = createdSupplier.Id }, createdSupplier);
}
[HttpGet(""{id}"")]
public async Task<ActionResult<SupplierDto>> GetSupplierById(Guid id)
{
var supplier = await _adminSupplierService.GetSupplierByIdAsync(id);
if (supplier == null) return NotFound();
return Ok(supplier);
}
"@
} # End AdminSuppliersController
elseif ($RelativePath -eq "Controllers/Customer" -and $nameWithoutExtension -eq "OrdersController") {
$controllerContentBody = @"
[HttpGet(""my-orders"")]
public async Task<IActionResult> GetMyOrders()
{
return Ok(new { Message = ""Dies ist Ihr persönlicher Bestellverlauf (Platzhalter)."" });
}
"@
} # End OrdersController (Customer)
# Weitere Controller-Inhalte können hier hinzugefügt werden
$fileContent = @"
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.AspNetCore.Mvc;
$controllerSpecificUsings
$commonUsings
namespace $fullNamespace
{
$controllerAttributes
public class $nameWithoutExtension : ControllerBase
{
$controllerContentBody
}
}
"@
} # Ende Controller Sektion
# Spezielle Inhalte für Repositories (Basiskonstruktor)
elseif ($ProjectName -eq "Webshop.Infrastructure" -and $RelativePath -eq "Repositories" -and $Type -eq "class") {
$interfaceName = "I" + $nameWithoutExtension
$fileContent = @"
// Auto-generiert von CreateWebshopFiles.ps1
using Microsoft.EntityFrameworkCore;
using Webshop.Domain.Entities;
using Webshop.Domain.Interfaces;
using Webshop.Infrastructure.Data;
$commonUsings
namespace $fullNamespace
{
public class $nameWithoutExtension : $interfaceName
{
private readonly ApplicationDbContext _context;
public $nameWithoutExtension(ApplicationDbContext context)
{
_context = context;
}
// Fügen Sie hier Repository-Methoden hinzu
// Beispiel:
// public async Task<IEnumerable<T>> GetAllAsync() { return await _context.Set<T>().ToListAsync(); }
// public async Task<T?> GetByIdAsync(Guid id) { return await _context.Set<T>().FindAsync(id); }
// public async Task AddAsync(T entity) { _context.Set<T>().Add(entity); await _context.SaveChangesAsync(); }
// public async Task UpdateAsync(T entity) { _context.Set<T>().Update(entity); await _context.SaveChangesAsync(); }
// public async Task DeleteAsync(Guid id) { var entity = await _context.Set<T>().FindAsync(id); if (entity != null) { _context.Set<T>().Remove(entity); await _context.SaveChangesAsync(); } }
}
}
"@
} # Ende Repositories Sektion
# Spezielle Inhalte für Services (Basiskonstruktor und Interface-Implementierung)
elseif ($ProjectName -eq "Webshop.Application" -and $RelativePath.StartsWith("Services") -and $Type -eq "class") {
$interfaceName = "I" + $nameWithoutExtension
$serviceSpecificUsings = ""
$serviceContentBody = @"
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
// public $nameWithoutExtension(IYourRepository repository) { }
// Fügen Sie hier Service-Methoden hinzu
"@
# Abhängigkeiten und spezifischer Content für AuthService
if ($nameWithoutExtension -eq "AuthService") {
$serviceSpecificUsings += "using Microsoft.AspNetCore.Identity;`nusing Microsoft.Extensions.Configuration;`nusing Microsoft.IdentityModel.Tokens;`nusing System.IdentityModel.Tokens.Jwt;`nusing System.Security.Claims;`nusing System.Text;`n"
$serviceSpecificUsings += "using Webshop.Application.DTOs.Auth;`n"
$serviceContentBody = @"
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly IConfiguration _configuration;
private readonly RoleManager<IdentityRole> _roleManager;
public AuthService(
UserManager<IdentityUser> userManager,
SignInManager<IdentityUser> signInManager,
IConfiguration configuration,
RoleManager<IdentityRole> roleManager)
{
_userManager = userManager;
_signInManager = signInManager;
_configuration = configuration;
_roleManager = roleManager;
}
// HIER KOMMT DER VORHERIGE AUTHSERVICE CODE HIN (Register, LoginUser, LoginAdmin, GenerateJwtToken)
// DIESER TEIL IST ZU LANG FÜR DIE PS1, ABER WIRD MANUELL EINGEFÜGT.
// Die Methoden Signaturen müssen mit IAuthService übereinstimmen!
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<AuthResponseDto> RegisterUserAsync(RegisterRequestDto request) { return new AuthResponseDto { IsAuthSuccessful = false, ErrorMessage = ""Not implemented"" }; }
public async Task<AuthResponseDto> LoginUserAsync(LoginRequestDto request) { return new AuthResponseDto { IsAuthSuccessful = false, ErrorMessage = ""Not implemented"" }; }
public async Task<AuthResponseDto> LoginAdminAsync(LoginRequestDto request) { return new AuthResponseDto { IsAuthSuccessful = false, ErrorMessage = ""Not implemented"" }; }
private Task<string> GenerateJwtToken(IdentityUser user, IList<string> roles) { return Task.FromResult(""""); }
"@
} # End AuthService specific content
# Abhängigkeiten und spezifischer Content für AdminProductService
elseif ($nameWithoutExtension -eq "AdminProductService") {
$serviceSpecificUsings += "using Webshop.Application.DTOs;`n" # AdminProductDto
$serviceSpecificUsings += "using Webshop.Domain.Entities;`nusing Webshop.Domain.Interfaces;`n" # Entities, IProductRepository
$serviceContentBody = @"
private readonly IProductRepository _productRepository;
public AdminProductService(IProductRepository productRepository)
{
_productRepository = productRepository;
}
// HIER KOMMT DER VORHERIGE ADMINPRODUCTSERVICE CODE HIN (GetAllAdminProductsAsync, CreateAdminProductAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<AdminProductDto>> GetAllAdminProductsAsync() { return new List<AdminProductDto>(); }
public async Task<AdminProductDto?> GetAdminProductByIdAsync(Guid id) { return null; }
public async Task<AdminProductDto> CreateAdminProductAsync(AdminProductDto productDto) { return null; }
public async Task<bool> UpdateAdminProductAsync(AdminProductDto productDto) { return false; }
public async Task<bool> DeleteAdminProductAsync(Guid id) { return false; }
"@
} # End AdminProductService specific content
# Abhängigkeiten und spezifischer Content für AdminUserService
elseif ($nameWithoutExtension -eq "AdminUserService") {
$serviceSpecificUsings += "using Webshop.Application.DTOs.Users;`n" # UserDto
$serviceSpecificUsings += "using Microsoft.AspNetCore.Identity;`nusing Microsoft.EntityFrameworkCore;`n" # UserManager, ToListAsync
$serviceContentBody = @"
private readonly UserManager<IdentityUser> _userManager;
public AdminUserService(UserManager<IdentityUser> userManager)
{
_userManager = userManager;
}
// HIER KOMMT DER VORHERIGE ADMINUSERSERVICE CODE HIN (GetAllUsersAsync, GetUserByIdAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<UserDto>> GetAllUsersAsync() { return new List<UserDto>(); }
public async Task<UserDto?> GetUserByIdAsync(string userId) { return null; }
"@
} # End AdminUserService specific content
# Abhängigkeiten und spezifischer Content für ProductService (Public)
elseif ($nameWithoutExtension -eq "ProductService" -and $RelativePath -eq "Services/Public") {
$serviceSpecificUsings += "using Webshop.Application.DTOs;`n" # ProductDto
$serviceSpecificUsings += "using Webshop.Domain.Interfaces;`n" # IProductRepository
$serviceSpecificUsings += "using Webshop.Domain.Entities;`n" # Product Entity
$serviceContentBody = @"
private readonly IProductRepository _productRepository;
public ProductService(IProductRepository productRepository)
{
_productRepository = productRepository;
}
// HIER KOMMT DER VORHERIGE PRODUCTSERVICE CODE HIN (GetAllProductsAsync, CreateProductAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<ProductDto>> GetAllProductsAsync() { return new List<ProductDto>(); }
public async Task<ProductDto> CreateProductAsync(ProductDto productDto) { return null; }
"@
} # End ProductService specific content
# Abhängigkeiten und spezifischer Content für AdminSupplierService
elseif ($nameWithoutExtension -eq "AdminSupplierService") {
$serviceSpecificUsings += "using Webshop.Application.DTOs;`n" # SupplierDto
$serviceSpecificUsings += "using Webshop.Domain.Entities;`nusing Webshop.Domain.Interfaces;`n" # Entities, ISupplierRepository
$serviceContentBody = @"
private readonly ISupplierRepository _supplierRepository;
public AdminSupplierService(ISupplierRepository supplierRepository)
{
_supplierRepository = supplierRepository;
}
// HIER KOMMT DER VORHERIGE ADMINSUPPLIERSERVICE CODE HIN (GetAllSuppliersAsync, CreateSupplierAsync etc.)
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
public async Task<IEnumerable<SupplierDto>> GetAllSuppliersAsync() { return new List<SupplierDto>(); }
public async Task<SupplierDto?> GetSupplierByIdAsync(Guid id) { return null; }
public async Task<SupplierDto> CreateSupplierAsync(SupplierDto supplierDto) { return null; }
"@
} # End AdminSupplierService specific content
$fileContent = @"
// Auto-generiert von CreateWebshopFiles.ps1
$commonUsings
$serviceSpecificUsings
namespace $fullNamespace
{
public class $nameWithoutExtension : $interfaceName
{
$serviceContentBody
}
}
"@
} # Ende Services Sektion
# Spezielle Inhalte für Interfaces (leere Implementierung)
elseif ($Type -eq "interface") {
$interfaceSpecificUsings = ""
$fileContentBody = "// Fügen Sie hier Methodensignaturen hinzu" # Standard-Inhalt für Interface
if ($ProjectName -eq "Webshop.Domain" -and $RelativePath -eq "Interfaces") {
$interfaceSpecificUsings += "using Webshop.Domain.Entities;`n"
# Beispiel für IProductRepository Methoden
if ($nameWithoutExtension -eq "IProductRepository") {
$fileContentBody = @"
Task<Product?> GetProductByIdAsync(Guid id);
Task<IEnumerable<Product>> GetAllProductsAsync();
Task AddProductAsync(Product product);
Task UpdateProductAsync(Product product);
Task DeleteProductAsync(Guid id);
"@
} elseif ($nameWithoutExtension -eq "ISupplierRepository") {
$fileContentBody = @"
Task<IEnumerable<Supplier>> GetAllSuppliersAsync();
Task<Supplier?> GetSupplierByIdAsync(Guid id);
Task AddSupplierAsync(Supplier supplier);
Task UpdateSupplierAsync(Supplier supplier);
Task DeleteSupplierAsync(Guid id);
"@
} # Weitere Repository-Interfaces hier
} elseif ($ProjectName -eq "Webshop.Application" -and $RelativePath -like "Services/*") {
$interfaceSpecificUsings += "using Webshop.Application.DTOs;`n"
$interfaceSpecificUsings += "using Webshop.Application.DTOs.Auth;`n"
$interfaceSpecificUsings += "using Webshop.Application.DTOs.Users;`n"
# Beispiel für IAuthService
if ($nameWithoutExtension -eq "IAuthService") {
$fileContentBody = @"
Task<AuthResponseDto> RegisterUserAsync(RegisterRequestDto request);
Task<AuthResponseDto> LoginUserAsync(LoginRequestDto request);
Task<AuthResponseDto> LoginAdminAsync(LoginRequestDto request);
"@
}
}
$fileContent = @"
// Auto-generiert von CreateWebshopFiles.ps1
$commonUsings
$interfaceSpecificUsings
namespace $fullNamespace
{
public interface $nameWithoutExtension
{
$fileContentBody
}
}
"@
} # Ende Interfaces Sektion
# Spezielle Inhalte für DTOs
elseif ($ProjectName -eq "Webshop.Application" -and $RelativePath.StartsWith("DTOs") -and $Type -eq "class") {
$extraUsings = ""
$properties = @"
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
// Fügen Sie hier weitere Eigenschaften hinzu
"@
if ($nameWithoutExtension -eq "ProductDto") {
$properties = @"
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string SKU { get; set; } = string.Empty;
public decimal Price { get; set; }
public bool IsActive { get; set; }
public bool IsInStock { get; set; }
public int StockQuantity { get; set; }
public string? ImageUrl { get; set; }
"@
} elseif ($nameWithoutExtension -eq "AdminProductDto") {
$properties = @"
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string SKU { get; set; } = string.Empty;
public decimal Price { get; set; }
public decimal? OldPrice { get; set; }
public bool IsActive { get; set; } = true;
public bool IsInStock { get; set; } = true;
public int StockQuantity { get; set; }
public decimal? Weight { get; set; }
public string? ImageUrl { get; set; }
public string Slug { get; set; } = string.Empty;
public DateTimeOffset CreatedDate { get; set; } = DateTimeOffset.UtcNow;
public DateTimeOffset? LastModifiedDate { get; set; }
public Guid? SupplierId { get; set; }
public decimal? PurchasePrice { get; set; }
"@
} elseif ($nameWithoutExtension -eq "SupplierDto") {
$properties = @"
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public string? ContactPerson { get; set; }
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public Guid? AddressId { get; set; }
public string? Notes { get; set; }
"@
} elseif ($nameWithoutExtension -eq "LoginRequestDto" -or $nameWithoutExtension -eq "RegisterRequestDto") {
$extraUsings += "using System.ComponentModel.DataAnnotations;`n"
if ($nameWithoutExtension -eq "LoginRequestDto") {
$properties = @"
[Required(ErrorMessage = `"E-Mail ist erforderlich.`")]
[EmailAddress(ErrorMessage = `"Ungültiges E-Mail-Format.`")]
public string Email { get; set; } = string.Empty;
[Required(ErrorMessage = `"Passwort ist erforderlich.`")]
public string Password { get; set; } = string.Empty;
"@
} elseif ($nameWithoutExtension -eq "RegisterRequestDto") {
$properties = @"
[Required(ErrorMessage = `"E-Mail ist erforderlich.`")]
[EmailAddress(ErrorMessage = `"Ungültiges E-Mail-Format.`")]
public string Email { get; set; } = string.Empty;
[Required(ErrorMessage = `"Passwort ist erforderlich.`")]
[MinLength(6, ErrorMessage = `"Passwort muss mindestens 6 Zeichen lang sein.`")]
public string Password { get; set; } = string.Empty;
[Required(ErrorMessage = `"Passwortbestätigung ist erforderlich.`")]
[Compare(`"Password`", ErrorMessage = `"Passwörter stimmen nicht überein.`")]
public string ConfirmPassword { get; set; } = string.Empty;
public string? FirstName { get; set; }
public string? LastName { get; set; }
"@
}
} elseif ($nameWithoutExtension -eq "AuthResponseDto") {
$properties = @"
public bool IsAuthSuccessful { get; set; }
public string ErrorMessage { get; set; } = string.Empty;
public string Token { get; set; } = string.Empty;
public string UserId { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public List<string> Roles { get; set; } = new List<string>();
"@
} elseif ($nameWithoutExtension -eq "UserDto") {
$properties = @"
public string Id { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string UserName { get; set; } = string.Empty;
public List<string> Roles { get; set; } = new List<string>();
public DateTimeOffset CreatedDate { get; set; }
public bool EmailConfirmed { get; set; }
"@
} elseif ($nameWithoutExtension -eq "AddressDto") {
$extraUsings += "using Webshop.Domain.Enums;`n"
$properties = @"
public Guid Id { get; set; }
public string Street { get; set; } = string.Empty;
public string HouseNumber { get; set; } = string.Empty;
public string City { get; set; } = string.Empty;
public string PostalCode { get; set; } = string.Empty;
public string Country { get; set; } = string.Empty;
public AddressType Type { get; set; }
"@
} elseif ($nameWithoutExtension -eq "CategoryDto") {
$properties = @"
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public Guid? ParentCategoryId { get; set; }
public string? ImageUrl { get; set; }
public bool IsActive { get; set; }
public int DisplayOrder { get; set; }
"@
} elseif ($nameWithoutExtension -eq "CreateCategoryDto") {
$properties = @"
public string Name { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public Guid? ParentCategoryId { get; set; }
public string? ImageUrl { get; set; }
public bool IsActive { get; set; } = true;
public int DisplayOrder { get; set; } = 0;
"@
} elseif ($nameWithoutExtension -eq "CustomerDto") {
$properties = @"
public Guid Id { get; set; }
public string UserId { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string? PhoneNumber { get; set; }
public Guid? DefaultShippingAddressId { get; set; }
public Guid? DefaultBillingAddressId { get; set; }
"@
} elseif ($nameWithoutExtension -eq "DiscountDto") {
$extraUsings += "using Webshop.Domain.Enums;`n"
$properties = @"
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public DiscountType Type { get; set; }
public decimal Value { get; set; }
public string? CouponCode { get; set; }
public DateTimeOffset StartDate { get; set; }
public DateTimeOffset EndDate { get; set; }
public bool IsActive { get; set; }
public int? MaxUses { get; set; }
public int CurrentUses { get; set; }
public string? Description { get; set; }
"@
} elseif ($nameWithoutExtension -eq "OrderSummaryDto") {
$extraUsings += "using Webshop.Domain.Enums;`n"
$properties = @"
public Guid Id { get; set; }
public string OrderNumber { get; set; } = string.Empty;
public DateTimeOffset OrderDate { get; set; }
public OrderStatus Status { get; set; }
public decimal TotalAmount { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public string PaymentMethodName { get; set; } = string.Empty;
public string ShippingMethodName { get; set; } = string.Empty;
"@
} elseif ($nameWithoutExtension -eq "OrderDetailDto") {
$extraUsings += "using Webshop.Domain.Enums;`n"
$properties = @"
public Guid Id { get; set; }
public string OrderNumber { get; set; } = string.Empty;
public Guid CustomerId { get; set; }
public DateTimeOffset OrderDate { get; set; }
public OrderStatus Status { get; set; }
public decimal TotalAmount { get; set; }
public Guid ShippingAddressId { get; set; }
public Guid BillingAddressId { get; set; }
public Guid PaymentMethodId { get; set; }
public string? ShippingTrackingNumber { get; set; }
public DateTimeOffset? ShippedDate { get; set; }
public DateTimeOffset? DeliveredDate { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public List<OrderItemDto> OrderItems { get; set; } = new List<OrderItemDto>();
"@
} elseif ($nameWithoutExtension -eq "OrderItemDto") {
$properties = @"
public Guid Id { get; set; }
public Guid OrderId { get; set; } // Foreign Key zu Order
public Guid ProductId { get; set; }
public Guid? ProductVariantId { get; set; }
public string ProductName { get; set; } = string.Empty;
public string ProductSKU { get; set; } = string.Empty;
public int Quantity { get; set; }
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
"@
} elseif ($nameWithoutExtension -eq "CreateOrderDto") {
$properties = @"
public Guid? CustomerId { get; set; } // Nullable für Gastbestellung
public string? GuestEmail { get; set; }
public string? GuestPhoneNumber { get; set; }
public Guid ShippingAddressId { get; set; }
public Guid BillingAddressId { get; set; }
public Guid PaymentMethodId { get; set; }
public Guid ShippingMethodId { get; set; }
public List<CreateOrderItemDto> Items { get; set; } = new List<CreateOrderItemDto>();
"@
} elseif ($nameWithoutExtension -eq "CreateOrderItemDto") {
$properties = @"
public Guid ProductId { get; set; }
public Guid? ProductVariantId { get; set; }
public int Quantity { get; set; }
"@
} elseif ($nameWithoutExtension -eq "ReviewDto") {
$properties = @"
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public Guid? CustomerId { get; set; }
public int Rating { get; set; }
public string? Title { get; set; }
public string Comment { get; set; } = string.Empty;
public DateTimeOffset ReviewDate { get; set; }
public bool IsApproved { get; set; }
"@
} elseif ($nameWithoutExtension -eq "CreateReviewDto") {
$properties = @"
public Guid ProductId { get; set; }
public int Rating { get; set; }
public string? Title { get; set; }
public string Comment { get; set; } = string.Empty;
"@
} elseif ($nameWithoutExtension -eq "SettingDto") {
$properties = @"
public string Key { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string? Description { get; set; }
public DateTimeOffset LastModifiedDate { get; set; }
"@
} elseif ($nameWithoutExtension -eq "PaymentMethodDto") {
$extraUsings += "using Webshop.Domain.Enums;`n"
$properties = @"
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; }
public PaymentGatewayType GatewayType { get; set; }
public decimal? ProcessingFee { get; set; }
"@
} elseif ($nameWithoutExtension -eq "ShippingMethodDto") {
$properties = @"
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public decimal Cost { get; set; }
public bool IsActive { get; set; }
public int MinDeliveryDays { get; set; }
public int MaxDeliveryDays { get; set; }
"@
} elseif ($nameWithoutExtension -eq "ProductVariantDto") {
$properties = @"
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string? SKU { get; set; }
public decimal PriceAdjustment { get; set; }
public int StockQuantity { get; set; }
public string? ImageUrl { get; set; }
public bool IsActive { get; set; }
"@
} elseif ($nameWithoutExtension -eq "SupplierDto") {
$properties = @"
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public string? ContactPerson { get; set; }
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public Guid? AddressId { get; set; }
public string? Notes { get; set; }
"@
} # End DTO specific content
$fileContent = @"
// Auto-generiert von CreateWebshopFiles.ps1
$commonUsings
$extraUsings
namespace $fullNamespace
{
public class $nameWithoutExtension
{
$properties
}
}
"@
} # Ende DTO Sektion
# Standardfall für eine Klasse, wenn keine spezielle Logik zutrifft (z.B. Domain Entities)
elseif ($Type -eq "class") {
$fileContent = @"
// Auto-generiert von CreateWebshopFiles.ps1
$commonUsings
namespace $fullNamespace
{
public class $nameWithoutExtension
{
public Guid Id { get; set; } = Guid.NewGuid();
// Fügen Sie hier weitere Eigenschaften hinzu
}
}
"@
}
Set-Content -Path $fullFilePath -Value $fileContent
Write-Host "Datei erstellt: $fullFilePath" -ForegroundColor Cyan
}
# --- Dateiliste ---
# 1. Projekt: Webshop.Domain
# Interfaces
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "ICategoryRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "ICustomerRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "IDiscountRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "IOrderRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "IReviewRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "ISettingRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "IPaymentMethodRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "IShippingMethodRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "ISupplierRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
New-CSharpFile -ProjectName "Webshop.Domain" -RelativePath "Interfaces" -FileName "IProductRepository.cs" -Type "interface" -BaseNamespace "Webshop.Domain"
# 2. Projekt: Webshop.Application
# DTOs
# Auth DTOs (bereits in Unterordnern, aber ich füge die Aufrufe hier für Konsistenz hinzu)
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs/Auth" -FileName "AuthResponseDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs/Auth" -FileName "LoginRequestDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs/Auth" -FileName "RegisterRequestDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
# User DTOs (bereits in Unterordnern)
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs/Users" -FileName "UserDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
# DTOs direkt im DTOs-Ordner
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "AddressDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "CategoryDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "CreateCategoryDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "CustomerDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "DiscountDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "OrderSummaryDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "OrderDetailDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "OrderItemDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "CreateOrderDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "CreateOrderItemDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "ReviewDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "CreateReviewDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "SettingDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "PaymentMethodDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "ShippingMethodDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "ProductVariantDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "SupplierDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "AdminProductDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "DTOs" -FileName "ProductDto.cs" -Type "class" -BaseNamespace "Webshop.Application"
# Services (Interfaces und Implementierungen)
# Admin/
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "IAdminCategoryService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminCategoryService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "IAdminOrderService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminOrderService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "IAdminDiscountService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminDiscountService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "IAdminSettingService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminSettingService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminProductService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminUserService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Admin" -FileName "AdminSupplierService.cs" -Type "class" -BaseNamespace "Webshop.Application"
# Public/
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Public" -FileName "ICategoryService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Public" -FileName "CategoryService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Public" -FileName "ProductService.cs" -Type "class" -BaseNamespace "Webshop.Application"
# Customer/
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "IOrderService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "OrderService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "ICheckoutService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "CheckoutService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "IReviewService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "ReviewService.cs" -Type "class" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "ICustomerService.cs" -Type "interface" -BaseNamespace "Webshop.Application"
New-CSharpFile -ProjectName "Webshop.Application" -RelativePath "Services/Customer" -FileName "CustomerService.cs" -Type "class" -BaseNamespace "Webshop.Application"
# 3. Projekt: Webshop.Infrastructure
# Repositories
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "CategoryRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "CustomerRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "DiscountRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "OrderRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "ReviewRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "SettingRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "PaymentMethodRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "ShippingMethodRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "SupplierRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
New-CSharpFile -ProjectName "Webshop.Infrastructure" -RelativePath "Repositories" -FileName "ProductRepository.cs" -Type "class" -BaseNamespace "Webshop.Infrastructure"
# 4. Projekt: Webshop.Api
# Controllers
# Admin/
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminCategoriesController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminDiscountsController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminSettingsController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminOrdersController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminProductsController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminUsersController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Admin" -FileName "AdminSuppliersController.cs" -Type "class" -BaseNamespace "Webshop.Api"
# Public/
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Public" -FileName "CategoriesController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Public" -FileName "ProductsController.cs" -Type "class" -BaseNamespace "Webshop.Api"
# Customer/
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Customer" -FileName "OrdersController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Customer" -FileName "CheckoutController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Customer" -FileName "ReviewsController.cs" -Type "class" -BaseNamespace "Webshop.Api"
New-CSharpFile -ProjectName "Webshop.Api" -RelativePath "Controllers/Customer" -FileName "ProfileController.cs" -Type "class" -BaseNamespace "Webshop.Api"
Write-Host "Dateierstellung abgeschlossen." -ForegroundColor Green