source: iknow-api/Migrations/20251027140655_InitialCreate.Designer.cs@ 4f5d8fd

Last change on this file since 4f5d8fd was 4f5d8fd, checked in by stefansaveski <stefansaveski19@…>, 11 months ago

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.

  • Property mode set to 100644
File size: 5.9 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("20251027140655_InitialCreate")]
16 partial class InitialCreate
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
58 b.ToTable("ContactInfo");
59 });
60
61 modelBuilder.Entity("iknow_api.Models.EnrollmentInfo", b =>
62 {
63 b.Property<int>("Id")
64 .ValueGeneratedOnAdd()
65 .HasColumnType("integer");
66
67 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
68
69 b.Property<int>("UserId")
70 .HasColumnType("integer");
71
72 b.Property<int>("enrollmentYear")
73 .HasColumnType("integer");
74
75 b.Property<int>("major")
76 .HasColumnType("integer");
77
78 b.HasKey("Id");
79
80 b.HasIndex("UserId");
81
82 b.ToTable("EnrollmentInfo");
83 });
84
85 modelBuilder.Entity("iknow_api.Models.HighSchool", b =>
86 {
87 b.Property<int>("Id")
88 .ValueGeneratedOnAdd()
89 .HasColumnType("integer");
90
91 NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
92
93 b.Property<float>("GPA")
94 .HasColumnType("real");
95
96 b.Property<int>("UserId")
97 .HasColumnType("integer");
98
99 b.Property<int>("tip")
100 .HasColumnType("integer");
101
102 b.HasKey("Id");
103
104 b.HasIndex("UserId");
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 .WithMany()
150 .HasForeignKey("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 .WithMany()
161 .HasForeignKey("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 .WithMany()
172 .HasForeignKey("UserId")
173 .OnDelete(DeleteBehavior.Cascade)
174 .IsRequired();
175
176 b.Navigation("User");
177 });
178#pragma warning restore 612, 618
179 }
180 }
181}
Note: See TracBrowser for help on using the repository browser.