Initial commit

This commit is contained in:
2026-06-04 06:24:56 +02:00
commit 282f4864c4
111 changed files with 8083 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace MealPlan.Api.DTOs.Auth;
/// <summary>Credentials submitted to <c>POST /api/auth/login</c>.</summary>
public class LoginRequestDto
{
[Required]
[EmailAddress]
[MaxLength(256)]
public string Email { get; set; } = string.Empty;
[Required]
[MaxLength(256)]
public string Password { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
namespace MealPlan.Api.DTOs.Auth;
/// <summary>Body for <c>POST /api/auth/refresh</c> and <c>POST /api/auth/logout</c>.</summary>
public class RefreshRequestDto
{
[Required]
public string RefreshToken { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace MealPlan.Api.DTOs.Auth;
/// <summary>Payload for <c>POST /api/auth/register</c>.</summary>
public class RegisterRequestDto
{
[Required]
[EmailAddress]
[MaxLength(256)]
public string Email { get; set; } = string.Empty;
[MaxLength(256)]
public string? UserName { get; set; }
[Required]
[MinLength(8)]
[MaxLength(256)]
public string Password { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,13 @@
namespace MealPlan.Api.DTOs.Auth;
/// <summary>Token pair returned by login and refresh.</summary>
public class TokenResponseDto
{
public string AccessToken { get; set; } = string.Empty;
public string RefreshToken { get; set; } = string.Empty;
/// <summary>Access-token lifetime in seconds (clients use it to schedule silent refresh).</summary>
public int ExpiresInSeconds { get; set; }
public string TokenType { get; set; } = "Bearer";
}

View File

@@ -0,0 +1,9 @@
namespace MealPlan.Api.DTOs.Auth;
/// <summary>Current-user payload returned by <c>GET /api/auth/me</c>.</summary>
public class UserInfoDto
{
public string Id { get; set; } = string.Empty;
public string? UserName { get; set; }
public string? Email { get; set; }
}