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

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

Add user-related entities and enforce one-to-one mappings

Enhanced the User model with new entities: ContactInfo,
EnrollmentInfo, and HighSchool, establishing one-to-one
relationships. Updated UserDTO with additional fields and
introduced enums for type, quota, and major. Modified
UserRepository and AuthService to handle new entities.

Updated database schema with unique constraints on UserId
for related tables and added EF Core migration
20251027191028_dbRelations. Adjusted JSON serialization
to prevent circular references.

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