Initial commit
This commit is contained in:
16
MealPlan.Api/DTOs/Auth/LoginRequestDto.cs
Normal file
16
MealPlan.Api/DTOs/Auth/LoginRequestDto.cs
Normal 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;
|
||||
}
|
||||
10
MealPlan.Api/DTOs/Auth/RefreshRequestDto.cs
Normal file
10
MealPlan.Api/DTOs/Auth/RefreshRequestDto.cs
Normal 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;
|
||||
}
|
||||
20
MealPlan.Api/DTOs/Auth/RegisterRequestDto.cs
Normal file
20
MealPlan.Api/DTOs/Auth/RegisterRequestDto.cs
Normal 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;
|
||||
}
|
||||
13
MealPlan.Api/DTOs/Auth/TokenResponseDto.cs
Normal file
13
MealPlan.Api/DTOs/Auth/TokenResponseDto.cs
Normal 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";
|
||||
}
|
||||
9
MealPlan.Api/DTOs/Auth/UserInfoDto.cs
Normal file
9
MealPlan.Api/DTOs/Auth/UserInfoDto.cs
Normal 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; }
|
||||
}
|
||||
9
MealPlan.Api/DTOs/Recipe/CategoryCountDto.cs
Normal file
9
MealPlan.Api/DTOs/Recipe/CategoryCountDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MealPlan.Api.DTOs.Recipe;
|
||||
|
||||
/// <summary>Category metadata with the number of active recipes it contains.</summary>
|
||||
public class CategoryCountDto
|
||||
{
|
||||
public int Category { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int Count { get; set; }
|
||||
}
|
||||
33
MealPlan.Api/DTOs/Recipe/RecipeDetailDto.cs
Normal file
33
MealPlan.Api/DTOs/Recipe/RecipeDetailDto.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace MealPlan.Api.DTOs.Recipe;
|
||||
|
||||
/// <summary>Full recipe detail including ingredients and ordered preparation steps.</summary>
|
||||
public class RecipeDetailDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int MealCategory { get; set; }
|
||||
public int? Calories { get; set; }
|
||||
public decimal? Protein { get; set; }
|
||||
public decimal? Fat { get; set; }
|
||||
public decimal? Carbs { get; set; }
|
||||
public int? PrepTimeMinutes { get; set; }
|
||||
|
||||
public List<IngredientDto> Ingredients { get; set; } = new();
|
||||
public List<RecipeStepDto> Steps { get; set; } = new();
|
||||
}
|
||||
|
||||
public class IngredientDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public decimal? AmountGrams { get; set; }
|
||||
public string? Unit { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
|
||||
public class RecipeStepDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int StepNumber { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
11
MealPlan.Api/DTOs/Recipe/RecipeListItemDto.cs
Normal file
11
MealPlan.Api/DTOs/Recipe/RecipeListItemDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MealPlan.Api.DTOs.Recipe;
|
||||
|
||||
/// <summary>Lightweight recipe projection used by list/grid views.</summary>
|
||||
public class RecipeListItemDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int MealCategory { get; set; }
|
||||
public int? Calories { get; set; }
|
||||
public int? PrepTimeMinutes { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user