Changeset f844b7e


Ignore:
Timestamp:
10/29/25 15:41:48 (11 months ago)
Author:
stefansaveski <stefansaveski19@…>
Branches:
master
Children:
586825e
Parents:
1d32d5c
Message:

Add EMBG property and consolidate migrations

Added EMBG property to User and RegisterDto classes to store unique user identifiers. Removed outdated migration files and introduced a new consolidated migration (20251029131316_InitialCreate) to define the database schema, including User, ContactInfo, EnrollmentInfo, HighSchool, and RefreshToken tables with appropriate relationships. Updated AppDbContextModelSnapshot to reflect the new schema. Changed the development database connection string in appsettings.Development.json for improved configuration.

Location:
iknow-api
Files:
4 deleted
3 edited
2 moved

Legend:

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

    r1d32d5c rf844b7e  
    1818        public string Name { get; set; } = string.Empty;
    1919        public string Surname { get; set; } = string.Empty;
     20        public string EMBG { get; set; } = string.Empty;
    2021        public string? Index { get; set; }
    2122        public string Email { get; set; } = string.Empty;
  • iknow-api/Migrations/20251029131316_InitialCreate.Designer.cs

    r1d32d5c rf844b7e  
    1313{
    1414    [DbContext(typeof(AppDbContext))]
    15     [Migration("20251027191028_dbRelations")]
    16     partial class dbRelations
     15    [Migration("20251029131316_InitialCreate")]
     16    partial class InitialCreate
    1717    {
    1818        /// <inheritdoc />
     
    110110                });
    111111
     112            modelBuilder.Entity("iknow_api.Models.RefreshToken", b =>
     113                {
     114                    b.Property<int>("Id")
     115                        .ValueGeneratedOnAdd()
     116                        .HasColumnType("integer");
     117
     118                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
     119
     120                    b.Property<DateTime>("ExpiresAt")
     121                        .HasColumnType("timestamp with time zone");
     122
     123                    b.Property<bool>("IsValid")
     124                        .HasColumnType("boolean");
     125
     126                    b.Property<string>("Token")
     127                        .HasColumnType("text");
     128
     129                    b.Property<int>("UserId")
     130                        .HasColumnType("integer");
     131
     132                    b.HasKey("Id");
     133
     134                    b.HasIndex("UserId");
     135
     136                    b.ToTable("RefreshToken");
     137                });
     138
    112139            modelBuilder.Entity("iknow_api.Models.User", b =>
    113140                {
     
    174201                        .WithOne("HighSchool")
    175202                        .HasForeignKey("iknow_api.Models.HighSchool", "UserId")
     203                        .OnDelete(DeleteBehavior.Cascade)
     204                        .IsRequired();
     205
     206                    b.Navigation("User");
     207                });
     208
     209            modelBuilder.Entity("iknow_api.Models.RefreshToken", b =>
     210                {
     211                    b.HasOne("iknow_api.Models.User", "User")
     212                        .WithMany()
     213                        .HasForeignKey("UserId")
    176214                        .OnDelete(DeleteBehavior.Cascade)
    177215                        .IsRequired();
  • iknow-api/Migrations/20251029131316_InitialCreate.cs

    r1d32d5c rf844b7e  
    9999                });
    100100
     101            migrationBuilder.CreateTable(
     102                name: "RefreshToken",
     103                columns: table => new
     104                {
     105                    Id = table.Column<int>(type: "integer", nullable: false)
     106                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
     107                    UserId = table.Column<int>(type: "integer", nullable: false),
     108                    Token = table.Column<string>(type: "text", nullable: true),
     109                    ExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
     110                    IsValid = table.Column<bool>(type: "boolean", nullable: false)
     111                },
     112                constraints: table =>
     113                {
     114                    table.PrimaryKey("PK_RefreshToken", x => x.Id);
     115                    table.ForeignKey(
     116                        name: "FK_RefreshToken_User_UserId",
     117                        column: x => x.UserId,
     118                        principalTable: "User",
     119                        principalColumn: "Id",
     120                        onDelete: ReferentialAction.Cascade);
     121                });
     122
    101123            migrationBuilder.CreateIndex(
    102124                name: "IX_ContactInfo_UserId",
    103125                table: "ContactInfo",
    104                 column: "UserId");
     126                column: "UserId",
     127                unique: true);
    105128
    106129            migrationBuilder.CreateIndex(
    107130                name: "IX_EnrollmentInfo_UserId",
    108131                table: "EnrollmentInfo",
    109                 column: "UserId");
     132                column: "UserId",
     133                unique: true);
    110134
    111135            migrationBuilder.CreateIndex(
    112136                name: "IX_HighSchool_UserId",
    113137                table: "HighSchool",
     138                column: "UserId",
     139                unique: true);
     140
     141            migrationBuilder.CreateIndex(
     142                name: "IX_RefreshToken_UserId",
     143                table: "RefreshToken",
    114144                column: "UserId");
    115145        }
     
    128158
    129159            migrationBuilder.DropTable(
     160                name: "RefreshToken");
     161
     162            migrationBuilder.DropTable(
    130163                name: "User");
    131164        }
  • iknow-api/Migrations/AppDbContextModelSnapshot.cs

    r1d32d5c rf844b7e  
    2424
    2525            modelBuilder.Entity("iknow_api.Models.ContactInfo", b =>
    26             modelBuilder.Entity("iknow_api.Models.RefreshToken", b =>
    2726                {
    2827                    b.Property<int>("Id")
     
    106105
    107106                    b.ToTable("HighSchool");
     107                });
     108
     109            modelBuilder.Entity("iknow_api.Models.RefreshToken", b =>
     110                {
     111                    b.Property<int>("Id")
     112                        .ValueGeneratedOnAdd()
     113                        .HasColumnType("integer");
     114
     115                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
     116
    108117                    b.Property<DateTime>("ExpiresAt")
    109118                        .HasColumnType("timestamp with time zone");
     
    113122
    114123                    b.Property<string>("Token")
    115                         .IsRequired()
    116124                        .HasColumnType("text");
    117125
     
    168176                        .WithOne("ContactInfo")
    169177                        .HasForeignKey("iknow_api.Models.ContactInfo", "UserId")
     178                        .OnDelete(DeleteBehavior.Cascade)
     179                        .IsRequired();
     180
     181                    b.Navigation("User");
     182                });
     183
     184            modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
     185                {
     186                    b.HasOne("iknow_api.Models.User", "User")
     187                        .WithOne("EnrollmentInfo")
     188                        .HasForeignKey("iknow_api.Models.EnrollmentInfo", "UserId")
     189                        .OnDelete(DeleteBehavior.Cascade)
     190                        .IsRequired();
     191
     192                    b.Navigation("User");
     193                });
     194
     195            modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
     196                {
     197                    b.HasOne("iknow_api.Models.User", "User")
     198                        .WithOne("HighSchool")
     199                        .HasForeignKey("iknow_api.Models.HighSchool", "UserId")
     200                        .OnDelete(DeleteBehavior.Cascade)
     201                        .IsRequired();
     202
     203                    b.Navigation("User");
     204                });
     205
    170206            modelBuilder.Entity("iknow_api.Models.RefreshToken", b =>
    171207                {
     
    173209                        .WithMany()
    174210                        .HasForeignKey("UserId")
    175                         .OnDelete(DeleteBehavior.Cascade)
    176                         .IsRequired();
    177 
    178                     b.Navigation("User");
    179                 });
    180 
    181             modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
    182                 {
    183                     b.HasOne("iknow_api.Models.User", "User")
    184                         .WithOne("EnrollmentInfo")
    185                         .HasForeignKey("iknow_api.Models.EnrollmentInfo", "UserId")
    186                         .OnDelete(DeleteBehavior.Cascade)
    187                         .IsRequired();
    188 
    189                     b.Navigation("User");
    190                 });
    191 
    192             modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
    193                 {
    194                     b.HasOne("iknow_api.Models.User", "User")
    195                         .WithOne("HighSchool")
    196                         .HasForeignKey("iknow_api.Models.HighSchool", "UserId")
    197211                        .OnDelete(DeleteBehavior.Cascade)
    198212                        .IsRequired();
  • iknow-api/Models/User.cs

    r1d32d5c rf844b7e  
    1414        public int Id { get; set; }
    1515        public string? Name { get; set; }
     16        public string? EMBG {get; set; }
    1617        public string? Surname { get; set; }
    1718        public string? Index { get; set; }
Note: See TracChangeset for help on using the changeset viewer.