Changeset 586825e


Ignore:
Timestamp:
10/30/25 14:24:10 (11 months ago)
Author:
imbrsk <boris696boris@…>
Branches:
master
Children:
5e22720
Parents:
f844b7e
Message:

Refactored enums

Location:
iknow-api
Files:
5 edited
2 moved

Legend:

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

    rf844b7e r586825e  
    1010    public class GetUserDataDto
    1111    {
    12         public string JWT { get; set; }
     12        public string? JWT { get; set; }
    1313    }
    1414
     
    2525        public UserRole Role { get; set; }
    2626        public float gpa { get; set; }
    27         public type tip { get; set; }
     27        public Type tip { get; set; }
    2828        public string city { get; set; } = string.Empty;
    2929        public string address { get; set; } = string.Empty;
     
    3232        public string microsoftEmail { get; set; } = string.Empty;
    3333        public int enrollmentYear { get; set; }
    34         public quota quotaType { get; set; }
    35         public major majorType { get; set; }
     34        public Quota quotaType { get; set; }
     35        public Major majorType { get; set; }
    3636
    3737    }
     
    5757        Student
    5858    }
    59     public enum type
     59    public enum Type
    6060    {
    6161        strucen, gimnazija
    6262    }
    63     public enum quota
     63    public enum Quota
    6464    {
    6565        drzavna, privatna, stipendija
    6666    }
    67     public enum major
     67    public enum Major
    6868    {
    6969        SIIS, PIT, KN, KI, IMB, IE, SSP, SEIS
  • iknow-api/Migrations/20251030124902_new.Designer.cs

    rf844b7e r586825e  
    1313{
    1414    [DbContext(typeof(AppDbContext))]
    15     [Migration("20251029131316_InitialCreate")]
    16     partial class InitialCreate
     15    [Migration("20251030124902_new")]
     16    partial class @new
    1717    {
    1818        /// <inheritdoc />
     
    151151                        .HasColumnType("timestamp with time zone");
    152152
     153                    b.Property<string>("EMBG")
     154                        .HasColumnType("text");
     155
    153156                    b.Property<string>("Email")
    154157                        .HasColumnType("text");
  • iknow-api/Migrations/20251030124902_new.cs

    rf844b7e r586825e  
    88{
    99    /// <inheritdoc />
    10     public partial class InitialCreate : Migration
     10    public partial class @new : Migration
    1111    {
    1212        /// <inheritdoc />
     
    2020                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    2121                    Name = table.Column<string>(type: "text", nullable: true),
     22                    EMBG = table.Column<string>(type: "text", nullable: true),
    2223                    Surname = table.Column<string>(type: "text", nullable: true),
    2324                    Index = table.Column<string>(type: "text", nullable: true),
  • iknow-api/Migrations/AppDbContextModelSnapshot.cs

    rf844b7e r586825e  
    148148                        .HasColumnType("timestamp with time zone");
    149149
     150                    b.Property<string>("EMBG")
     151                        .HasColumnType("text");
     152
    150153                    b.Property<string>("Email")
    151154                        .HasColumnType("text");
  • iknow-api/Models/ContactInfo.cs

    rf844b7e r586825e  
    1313       
    1414        public int UserId { get; set; }
    15         public User User { get; set; }
     15        public User? User { get; set; }
    1616    }
    1717}
  • iknow-api/Models/EnrollmentInfo.cs

    rf844b7e r586825e  
    33namespace iknow_api.Models
    44{
    5     public enum quota
     5    public enum Quota
    66    {
    77        drzavna, privatna, stipendija
    88    }
    9     public enum major
     9    public enum Major
    1010    {
    1111        SIIS, PIT, KN, KI, IMB, IE, SSP, SEIS
     
    1515        public int Id { get; set; }
    1616        public int enrollmentYear { get; set; }
    17         public quota quota;
    18         public major major { get; set; }
     17        public Quota quota;
     18        public Major major { get; set; }
    1919        public int UserId { get; set; }
    20         public User User { get; set; }
     20        public User? User { get; set; }
    2121    }
    2222}
  • iknow-api/Services/Implementations/AuthService.cs

    rf844b7e r586825e  
    4141                Bday = DateTime.SpecifyKind(registerDto.Bday, DateTimeKind.Utc),
    4242                CreatedAt = DateTime.UtcNow,
    43                 Role = (Models.UserRole)registerDto.Role
     43                Role = (Models.UserRole)registerDto.Role,
     44                EMBG = registerDto.EMBG
    4445            };
    4546
     
    6061                UserId = userId,
    6162                enrollmentYear = registerDto.enrollmentYear,
    62                 quota = (Models.quota)registerDto.quotaType,
    63                 major = (Models.major)registerDto.majorType
     63                quota = (Models.Quota)registerDto.quotaType,
     64                major = (Models.Major)registerDto.majorType
    6465            };
    6566            await _userRepository.AddEnrollmentAsync(enrollmentInfo);
     
    101102        {
    102103            int userid = await _refreshTokenRepository.GetUserId(token.token) ?? 0;
    103             User user = await _userRepository.GetOnlyUserByIdAsync(userid);
     104            User ?user = await _userRepository.GetOnlyUserByIdAsync(userid);
    104105
    105106            var result = new AuthResultDto
    106107            {
    107                 AccessToken = CreateToken(user)
     108                AccessToken = CreateToken(user) 
    108109            };
    109110           
Note: See TracChangeset for help on using the changeset viewer.