source: iknow-api/DTOs/UserDTO.cs@ 9538edc

Last change on this file since 9538edc was c7d4a59, checked in by stefansaveski <stefansaveski19@…>, 11 months ago

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.

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[277bd72]1namespace iknow_api.DTOs
[5b42c8d]2{
[c7d4a59]3 // Login DTO
4 public class LoginDto
[5b42c8d]5 {
[c7d4a59]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
[5b42c8d]41 }
42}
Note: See TracBrowser for help on using the repository browser.