source: iknow-api/Migrations/AppDbContextModelSnapshot.cs@ b38c39c

Last change on this file since b38c39c was b38c39c, 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.2 KB
Line 
1// <auto-generated />
2using System;
3using Microsoft.EntityFrameworkCore;
4using Microsoft.EntityFrameworkCore.Infrastructure;
5using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
7using iknow_api.Data;
8
9#nullable disable
10
11namespace iknow_api.Migrations
12{
13 [DbContext(typeof(AppDbContext))]
14 partial class AppDbContextModelSnapshot : ModelSnapshot
15 {
16 protected override void BuildModel(ModelBuilder modelBuilder)
17 {
18#pragma warning disable 612, 618
19 modelBuilder
20 .HasAnnotation("ProductVersion", "9.0.10")
21 .HasAnnotation("Relational:MaxIdentifierLength", 63);
22
23 NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
24
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 .IsUnique();
55
56 b.ToTable("ContactInfo");
57 });
58
59 modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
60 {
61 b.Property<int>("Id")
62 .ValueGeneratedOnAdd()
63 .HasColumnType("integer");
64
65 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
66
67 b.Property<int>("UserId")
68 .HasColumnType("integer");
69
70 b.Property<int>("enrollmentYear")
71 .HasColumnType("integer");
72
73 b.Property<int>("major")
74 .HasColumnType("integer");
75
76 b.HasKey("Id");
77
78 b.HasIndex("UserId")
79 .IsUnique();
80
81 b.ToTable("EnrollmentInfo");
82 });
83
84 modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
85 {
86 b.Property<int>("Id")
87 .ValueGeneratedOnAdd()
88 .HasColumnType("integer");
89
90 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
91
92 b.Property<float>("GPA")
93 .HasColumnType("real");
94
95 b.Property<int>("UserId")
96 .HasColumnType("integer");
97
98 b.Property<int>("tip")
99 .HasColumnType("integer");
100
101 b.HasKey("Id");
102
103 b.HasIndex("UserId")
104 .IsUnique();
105
106 b.ToTable("HighSchool");
107 });
108
109 modelBuilder.Entity("iknow_api.Models.User", b =>
110 {
111 b.Property<int>("Id")
112 .ValueGeneratedOnAdd()
113 .HasColumnType("integer");
114
115 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
116
117 b.Property<DateTime>("Bday")
118 .HasColumnType("timestamp with time zone");
119
120 b.Property<DateTime>("CreatedAt")
121 .HasColumnType("timestamp with time zone");
122
123 b.Property<string>("Email")
124 .HasColumnType("text");
125
126 b.Property<string>("Index")
127 .HasColumnType("text");
128
129 b.Property<string>("Name")
130 .HasColumnType("text");
131
132 b.Property<string>("PasswordHash")
133 .HasColumnType("text");
134
135 b.Property<int>("Role")
136 .HasColumnType("integer");
137
138 b.Property<string>("Surname")
139 .HasColumnType("text");
140
141 b.HasKey("Id");
142
143 b.ToTable("User");
144 });
145
146 modelBuilder.Entity("iknow_api.Models.ContactInfo", b =>
147 {
148 b.HasOne("iknow_api.Models.User", "User")
149 .WithOne("ContactInfo")
150 .HasForeignKey("iknow_api.Models.ContactInfo", "UserId")
151 .OnDelete(DeleteBehavior.Cascade)
152 .IsRequired();
153
154 b.Navigation("User");
155 });
156
157 modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
158 {
159 b.HasOne("iknow_api.Models.User", "User")
160 .WithOne("EnrollmentInfo")
161 .HasForeignKey("iknow_api.Models.EnrollmentInfo", "UserId")
162 .OnDelete(DeleteBehavior.Cascade)
163 .IsRequired();
164
165 b.Navigation("User");
166 });
167
168 modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
169 {
170 b.HasOne("iknow_api.Models.User", "User")
171 .WithOne("HighSchool")
172 .HasForeignKey("iknow_api.Models.HighSchool", "UserId")
173 .OnDelete(DeleteBehavior.Cascade)
174 .IsRequired();
175
176 b.Navigation("User");
177 });
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 });
187#pragma warning restore 612, 618
188 }
189 }
190}
Note: See TracBrowser for help on using the repository browser.