Ignore:
Timestamp:
10/27/25 21:50:02 (11 months ago)
Author:
stefansaveski <stefansaveski19@…>
Branches:
master
Children:
ff202cf
Parents:
cab02ad
Message:

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.

Location:
iknow-api/Migrations
Files:
2 added
1 edited

Legend:

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

    rcab02ad rb38c39c  
    5151                    b.HasKey("Id");
    5252
    53                     b.HasIndex("UserId");
     53                    b.HasIndex("UserId")
     54                        .IsUnique();
    5455
    5556                    b.ToTable("ContactInfo");
     
    7576                    b.HasKey("Id");
    7677
    77                     b.HasIndex("UserId");
     78                    b.HasIndex("UserId")
     79                        .IsUnique();
    7880
    7981                    b.ToTable("EnrollmentInfo");
     
    99101                    b.HasKey("Id");
    100102
    101                     b.HasIndex("UserId");
     103                    b.HasIndex("UserId")
     104                        .IsUnique();
    102105
    103106                    b.ToTable("HighSchool");
     
    144147                {
    145148                    b.HasOne("iknow_api.Models.User", "User")
    146                         .WithMany()
    147                         .HasForeignKey("UserId")
     149                        .WithOne("ContactInfo")
     150                        .HasForeignKey("iknow_api.Models.ContactInfo", "UserId")
    148151                        .OnDelete(DeleteBehavior.Cascade)
    149152                        .IsRequired();
     
    155158                {
    156159                    b.HasOne("iknow_api.Models.User", "User")
    157                         .WithMany()
    158                         .HasForeignKey("UserId")
     160                        .WithOne("EnrollmentInfo")
     161                        .HasForeignKey("iknow_api.Models.EnrollmentInfo", "UserId")
    159162                        .OnDelete(DeleteBehavior.Cascade)
    160163                        .IsRequired();
     
    166169                {
    167170                    b.HasOne("iknow_api.Models.User", "User")
    168                         .WithMany()
    169                         .HasForeignKey("UserId")
     171                        .WithOne("HighSchool")
     172                        .HasForeignKey("iknow_api.Models.HighSchool", "UserId")
    170173                        .OnDelete(DeleteBehavior.Cascade)
    171174                        .IsRequired();
     
    173176                    b.Navigation("User");
    174177                });
     178
     179            modelBuilder.Entity("iknow_api.Models.User", b =>
     180                {
     181                    b.Navigation("ContactInfo");
     182
     183                    b.Navigation("EnrollmentInfo");
     184
     185                    b.Navigation("HighSchool");
     186                });
    175187#pragma warning restore 612, 618
    176188        }
Note: See TracChangeset for help on using the changeset viewer.