source: iknow-api/Migrations/20251027191028_dbRelations.Designer.cs@ 1d32d5c

Last change on this file since 1d32d5c was c0256f3, 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: 6.3 KB
Line 
1// <auto-generated />
2using System;
3using Microsoft.EntityFrameworkCore;
4using Microsoft.EntityFrameworkCore.Infrastructure;
5using Microsoft.EntityFrameworkCore.Migrations;
6using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
8using iknow_api.Data;
9
10#nullable disable
11
12namespace iknow_api.Migrations
13{
14 [DbContext(typeof(AppDbContext))]
15 [Migration("20251027191028_dbRelations")]
16 partial class dbRelations
17 {
18 /// <inheritdoc />
19 protected override void BuildTargetModel(ModelBuilder modelBuilder)
20 {
21#pragma warning disable 612, 618
22 modelBuilder
23 .HasAnnotation("ProductVersion", "9.0.10")
24 .HasAnnotation("Relational:MaxIdentifierLength", 63);
25
26 NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
27
28 modelBuilder.Entity("iknow_api.Models.ContactInfo", b =>
29 {
30 b.Property<int>("Id")
31 .ValueGeneratedOnAdd()
32 .HasColumnType("integer");
33
34 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
35
36 b.Property<int>("UserId")
37 .HasColumnType("integer");
38
39 b.Property<string>("address")
40 .HasColumnType("text");
41
42 b.Property<string>("city")
43 .HasColumnType("text");
44
45 b.Property<string>("microsoftEmail")
46 .HasColumnType("text");
47
48 b.Property<string>("municipality")
49 .HasColumnType("text");
50
51 b.Property<string>("phoneNumber")
52 .HasColumnType("text");
53
54 b.HasKey("Id");
55
56 b.HasIndex("UserId")
57 .IsUnique();
58
59 b.ToTable("ContactInfo");
60 });
61
62 modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
63 {
64 b.Property<int>("Id")
65 .ValueGeneratedOnAdd()
66 .HasColumnType("integer");
67
68 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
69
70 b.Property<int>("UserId")
71 .HasColumnType("integer");
72
73 b.Property<int>("enrollmentYear")
74 .HasColumnType("integer");
75
76 b.Property<int>("major")
77 .HasColumnType("integer");
78
79 b.HasKey("Id");
80
81 b.HasIndex("UserId")
82 .IsUnique();
83
84 b.ToTable("EnrollmentInfo");
85 });
86
87 modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
88 {
89 b.Property<int>("Id")
90 .ValueGeneratedOnAdd()
91 .HasColumnType("integer");
92
93 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
94
95 b.Property<float>("GPA")
96 .HasColumnType("real");
97
98 b.Property<int>("UserId")
99 .HasColumnType("integer");
100
101 b.Property<int>("tip")
102 .HasColumnType("integer");
103
104 b.HasKey("Id");
105
106 b.HasIndex("UserId")
107 .IsUnique();
108
109 b.ToTable("HighSchool");
110 });
111
112 modelBuilder.Entity("iknow_api.Models.User", 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>("Bday")
121 .HasColumnType("timestamp with time zone");
122
123 b.Property<DateTime>("CreatedAt")
124 .HasColumnType("timestamp with time zone");
125
126 b.Property<string>("Email")
127 .HasColumnType("text");
128
129 b.Property<string>("Index")
130 .HasColumnType("text");
131
132 b.Property<string>("Name")
133 .HasColumnType("text");
134
135 b.Property<string>("PasswordHash")
136 .HasColumnType("text");
137
138 b.Property<int>("Role")
139 .HasColumnType("integer");
140
141 b.Property<string>("Surname")
142 .HasColumnType("text");
143
144 b.HasKey("Id");
145
146 b.ToTable("User");
147 });
148
149 modelBuilder.Entity("iknow_api.Models.ContactInfo", b =>
150 {
151 b.HasOne("iknow_api.Models.User", "User")
152 .WithOne("ContactInfo")
153 .HasForeignKey("iknow_api.Models.ContactInfo", "UserId")
154 .OnDelete(DeleteBehavior.Cascade)
155 .IsRequired();
156
157 b.Navigation("User");
158 });
159
160 modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
161 {
162 b.HasOne("iknow_api.Models.User", "User")
163 .WithOne("EnrollmentInfo")
164 .HasForeignKey("iknow_api.Models.EnrollmentInfo", "UserId")
165 .OnDelete(DeleteBehavior.Cascade)
166 .IsRequired();
167
168 b.Navigation("User");
169 });
170
171 modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
172 {
173 b.HasOne("iknow_api.Models.User", "User")
174 .WithOne("HighSchool")
175 .HasForeignKey("iknow_api.Models.HighSchool", "UserId")
176 .OnDelete(DeleteBehavior.Cascade)
177 .IsRequired();
178
179 b.Navigation("User");
180 });
181
182 modelBuilder.Entity("iknow_api.Models.User", b =>
183 {
184 b.Navigation("ContactInfo");
185
186 b.Navigation("EnrollmentInfo");
187
188 b.Navigation("HighSchool");
189 });
190#pragma warning restore 612, 618
191 }
192 }
193}
Note: See TracBrowser for help on using the repository browser.