Changeset c7d4a59 for iknow-api/DTOs


Ignore:
Timestamp:
10/22/25 23:34:14 (11 months ago)
Author:
stefansaveski <stefansaveski19@…>
Branches:
master
Children:
9538edc
Parents:
277bd72
Message:

Refactor DTOs and remove user management

Updated AuthController to use RegisterDto and LoginDto for more specific DTO usage in registration and login methods. Removed UsersController and its methods, indicating a refactor or removal of user management functionality. Replaced UserDto with LoginDto, RegisterDto, and UserResponseDto in UserDTO.cs, and introduced a UserRole enum. Updated AuthService to use new DTOs and adjusted JWT token configuration. Removed UserService and IUserService, suggesting a redesign or deprecation of user service functionality. Updated IAuthService to align with AuthService changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • iknow-api/DTOs/UserDTO.cs

    r277bd72 rc7d4a59  
    11namespace iknow_api.DTOs
    22{
    3     public class UserDto
     3    // Login DTO
     4    public class LoginDto
    45    {
    5         public string Username { get; set; } = null!;
    6         public string Password { get; set; } = null!;
     6        public string Email { get; set; } = string.Empty;
     7        public string Password { get; set; } = string.Empty;
     8    }
     9
     10    // Registration DTO
     11    public class RegisterDto
     12    {
     13        public string Name { get; set; } = string.Empty;
     14        public string Surname { get; set; } = string.Empty;
     15        public string? Index { get; set; }
     16        public string Email { get; set; } = string.Empty;
     17        public string Password { get; set; } = string.Empty;
     18        public DateTime Bday { get; set; }
     19        public UserRole Role { get; set; }
     20    }
     21
     22    // User response DTO (for returning user data without password)
     23    public class UserResponseDto
     24    {
     25        public int Id { get; set; }
     26        public string? Name { get; set; }
     27        public string? Surname { get; set; }
     28        public string? Index { get; set; }
     29        public string? Email { get; set; }
     30        public DateTime Bday { get; set; }
     31        public DateTime CreatedAt { get; set; }
     32        public UserRole Role { get; set; }
     33    }
     34
     35    // User role enum
     36    public enum UserRole
     37    {
     38        Admin,
     39        Professor,
     40        Student
    741    }
    842}
Note: See TracChangeset for help on using the changeset viewer.