From b335867b3014c6396ed2d5c5e3e2ef27fe71f8d7 Mon Sep 17 00:00:00 2001 From: Chris Chen Date: Mon, 25 May 2026 19:07:36 -0700 Subject: [PATCH] feat: add LoginRequest and LoginResponse DTOs --- API/ROLAC.API/DTOs/Auth/LoginRequest.cs | 16 ++++++++++++++++ API/ROLAC.API/DTOs/Auth/LoginResponse.cs | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 API/ROLAC.API/DTOs/Auth/LoginRequest.cs create mode 100644 API/ROLAC.API/DTOs/Auth/LoginResponse.cs diff --git a/API/ROLAC.API/DTOs/Auth/LoginRequest.cs b/API/ROLAC.API/DTOs/Auth/LoginRequest.cs new file mode 100644 index 0000000..d33aeb2 --- /dev/null +++ b/API/ROLAC.API/DTOs/Auth/LoginRequest.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace ROLAC.API.DTOs.Auth; + +public class LoginRequest +{ + [Required] + [EmailAddress] + [MaxLength(256)] + public string Email { get; set; } = null!; + + [Required] + [MinLength(8)] + [MaxLength(128)] + public string Password { get; set; } = null!; +} diff --git a/API/ROLAC.API/DTOs/Auth/LoginResponse.cs b/API/ROLAC.API/DTOs/Auth/LoginResponse.cs new file mode 100644 index 0000000..d7a83bc --- /dev/null +++ b/API/ROLAC.API/DTOs/Auth/LoginResponse.cs @@ -0,0 +1,20 @@ +namespace ROLAC.API.DTOs.Auth; + +public class LoginResponse +{ + /// Short-lived JWT (15 min). Store in memory — never in localStorage. + public string AccessToken { get; set; } = null!; + + /// Seconds until the access token expires. Always 900 (15 × 60). + public int ExpiresIn { get; set; } + + public UserInfo User { get; set; } = null!; +} + +public class UserInfo +{ + public string Id { get; set; } = null!; + public string Email { get; set; } = null!; + public IList Roles { get; set; } = []; + public string LanguagePreference { get; set; } = "en"; +}