source: iknow-api/DTOs/UserDTO.cs@ c2f79d7

Last change on this file since c2f79d7 was c2f79d7, checked in by Stefan-Saveski <stefan@…>, 10 months ago

Refactor and enhance application structure

Enhanced error handling in AuthController with detailed exception handling for user registration. Updated UserDTO to improve JSON serialization and renamed enums for clarity. Introduced new entities (Major, PassedSubject, etc.) and seeded initial data in AppDbContext.

Replaced legacy migrations with 20251208203846_InitialCreate, reflecting the updated schema. Fixed typographical errors and improved JSON serialization in Program.cs with case-insensitive property matching and enum handling.

Refactored repository interfaces for better null safety. Improved debugging in AuthService and updated connection strings. Added the PassedSubject entity and cleaned up redundant code and unused imports for better maintainability.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1using System.Text.Json.Serialization;
2
3namespace iknow_api.DTOs
4{
5 // Login DTO
6 public class LoginDto
7 {
8 public string Email { get; set; } = string.Empty;
9 public string Password { get; set; } = string.Empty;
10 public bool GenerateRefreshToken { get; set; }
11 }
12 public class GetUserDataDto
13 {
14 public string? JWT { get; set; }
15 }
16
17 // Registration DTO
18 public class RegisterDto
19 {
20 public string Name { get; set; } = string.Empty;
21 public string Surname { get; set; } = string.Empty;
22 public string EMBG { get; set; } = string.Empty;
23 public string? Index { get; set; }
24 public string Email { get; set; } = string.Empty;
25 public string Password { get; set; } = string.Empty;
26 public DateTime Bday { get; set; }
27 public UserRole Role { get; set; }
28 public float gpa { get; set; }
29 public HighSchoolType tip { get; set; }
30 public string city { get; set; } = string.Empty;
31 public string address { get; set; } = string.Empty;
32 public string municipality { get; set; } = string.Empty;
33 public string phoneNumber { get; set; } = string.Empty;
34 public string microsoftEmail { get; set; } = string.Empty;
35 public int enrollmentYear { get; set; }
36 public Quota quotaType { get; set; }
37 public int majorType { get; set; }
38
39 }
40
41 // User response DTO (for returning user data without password)
42 public class UserResponseDto
43 {
44 public int Id { get; set; }
45 public string? Name { get; set; }
46 public string? Surname { get; set; }
47 public string? Index { get; set; }
48 public string? Email { get; set; }
49 public DateTime Bday { get; set; }
50 public DateTime CreatedAt { get; set; }
51 public UserRole Role { get; set; }
52 }
53
54 // User role enum
55 public enum UserRole
56 {
57 Admin,
58 Professor,
59 Student
60 }
61 public enum HighSchoolType
62 {
63 strucen, gimnazija
64 }
65 public enum Quota
66 {
67 drzavna, privatna, stipendija
68 }
69}
Note: See TracBrowser for help on using the repository browser.