Ignore:
Timestamp:
10/27/25 15:20:33 (11 months ago)
Author:
stefansaveski <stefansaveski19@…>
Branches:
master
Children:
b38c39c
Parents:
e49c3ed
Message:

Add user-related models, services, and JWT validation

Added ContactInfo, EnrollmentInfo, and HighSchool models with relationships to the User entity. Updated AppDbContext and migrations to reflect these changes. Introduced UserService and IUserService for handling user data retrieval via JWT validation. Added UserController with a getUser endpoint to fetch user data based on JWT.

Enhanced IUserRepository and UserRepository with a method to fetch users by ID. Registered UserService in the DI container. Defined enums for EnrollmentInfo and HighSchool. Removed outdated migration files and performed general refactoring and cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • iknow-api/Migrations/AppDbContextModelSnapshot.cs

    re49c3ed rcab02ad  
    2323            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
    2424
    25             modelBuilder.Entity("iknow_api.Core.Models.User", b =>
     25            modelBuilder.Entity("iknow_api.Models.ContactInfo", b =>
     26                {
     27                    b.Property<int>("Id")
     28                        .ValueGeneratedOnAdd()
     29                        .HasColumnType("integer");
     30
     31                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
     32
     33                    b.Property<int>("UserId")
     34                        .HasColumnType("integer");
     35
     36                    b.Property<string>("address")
     37                        .HasColumnType("text");
     38
     39                    b.Property<string>("city")
     40                        .HasColumnType("text");
     41
     42                    b.Property<string>("microsoftEmail")
     43                        .HasColumnType("text");
     44
     45                    b.Property<string>("municipality")
     46                        .HasColumnType("text");
     47
     48                    b.Property<string>("phoneNumber")
     49                        .HasColumnType("text");
     50
     51                    b.HasKey("Id");
     52
     53                    b.HasIndex("UserId");
     54
     55                    b.ToTable("ContactInfo");
     56                });
     57
     58            modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
     59                {
     60                    b.Property<int>("Id")
     61                        .ValueGeneratedOnAdd()
     62                        .HasColumnType("integer");
     63
     64                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
     65
     66                    b.Property<int>("UserId")
     67                        .HasColumnType("integer");
     68
     69                    b.Property<int>("enrollmentYear")
     70                        .HasColumnType("integer");
     71
     72                    b.Property<int>("major")
     73                        .HasColumnType("integer");
     74
     75                    b.HasKey("Id");
     76
     77                    b.HasIndex("UserId");
     78
     79                    b.ToTable("EnrollmentInfo");
     80                });
     81
     82            modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
     83                {
     84                    b.Property<int>("Id")
     85                        .ValueGeneratedOnAdd()
     86                        .HasColumnType("integer");
     87
     88                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
     89
     90                    b.Property<float>("GPA")
     91                        .HasColumnType("real");
     92
     93                    b.Property<int>("UserId")
     94                        .HasColumnType("integer");
     95
     96                    b.Property<int>("tip")
     97                        .HasColumnType("integer");
     98
     99                    b.HasKey("Id");
     100
     101                    b.HasIndex("UserId");
     102
     103                    b.ToTable("HighSchool");
     104                });
     105
     106            modelBuilder.Entity("iknow_api.Models.User", b =>
    26107                {
    27108                    b.Property<int>("Id")
     
    59140                    b.ToTable("User");
    60141                });
     142
     143            modelBuilder.Entity("iknow_api.Models.ContactInfo", b =>
     144                {
     145                    b.HasOne("iknow_api.Models.User", "User")
     146                        .WithMany()
     147                        .HasForeignKey("UserId")
     148                        .OnDelete(DeleteBehavior.Cascade)
     149                        .IsRequired();
     150
     151                    b.Navigation("User");
     152                });
     153
     154            modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
     155                {
     156                    b.HasOne("iknow_api.Models.User", "User")
     157                        .WithMany()
     158                        .HasForeignKey("UserId")
     159                        .OnDelete(DeleteBehavior.Cascade)
     160                        .IsRequired();
     161
     162                    b.Navigation("User");
     163                });
     164
     165            modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
     166                {
     167                    b.HasOne("iknow_api.Models.User", "User")
     168                        .WithMany()
     169                        .HasForeignKey("UserId")
     170                        .OnDelete(DeleteBehavior.Cascade)
     171                        .IsRequired();
     172
     173                    b.Navigation("User");
     174                });
    61175#pragma warning restore 612, 618
    62176        }
Note: See TracChangeset for help on using the changeset viewer.