source: iknow-api/Migrations/20251022202014_InitialCreate.cs@ 41e4f9f

Last change on this file since 41e4f9f was 5b42c8d, checked in by stefansaveski <stefansaveski19@…>, 11 months ago

Implement JWT Authentication and Update User Schema

Replaced repository interface with FinXaccesApi.Repositories in UsersControllers.cs. Updated database schema to use PasswordHash instead of Password. Added new migration files reflecting these changes. Updated service registration in Program.cs to include IAuthService and IUserRepository. Refactored UserRepository.cs and IUserRepository.cs with new methods and namespace changes. Commented out UserService.cs. Updated appsettings with new connection strings and JWT settings. Added BCrypt.Net-Next and System.IdentityModel.Tokens.Jwt packages. Introduced AuthController, UserDTO, AuthService, and IAuthService for handling authentication and user management.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1using System;
2using Microsoft.EntityFrameworkCore.Migrations;
3using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
4
5#nullable disable
6
7namespace iknow_api.Migrations
8{
9 /// <inheritdoc />
10 public partial class InitialCreate : Migration
11 {
12 /// <inheritdoc />
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 migrationBuilder.CreateTable(
16 name: "User",
17 columns: table => new
18 {
19 Id = table.Column<int>(type: "integer", nullable: false)
20 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
21 Name = table.Column<string>(type: "text", nullable: true),
22 Surname = table.Column<string>(type: "text", nullable: true),
23 Index = table.Column<string>(type: "text", nullable: true),
24 Email = table.Column<string>(type: "text", nullable: true),
25 PasswordHash = table.Column<string>(type: "text", nullable: true),
26 Bday = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
27 CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
28 Role = table.Column<int>(type: "integer", nullable: false)
29 },
30 constraints: table =>
31 {
32 table.PrimaryKey("PK_User", x => x.Id);
33 });
34 }
35
36 /// <inheritdoc />
37 protected override void Down(MigrationBuilder migrationBuilder)
38 {
39 migrationBuilder.DropTable(
40 name: "User");
41 }
42 }
43}
Note: See TracBrowser for help on using the repository browser.