Enhance users entities 👷👷

pull/1/head
Louis LABORIE 5 months ago
parent 14247ce133
commit 0a31bd0f7d

@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Infrastructure.Base; using Infrastructure.Base;
using Shared;
namespace Infrastructure.Entities; namespace Infrastructure.Entities;
@ -22,10 +23,10 @@ public class User : EntityBase
public string? EGoal { get; set; } public string? EGoal { get; set; }
public string? ESleepLevel { get; set; } public EHealthProblem EHealthProblem { get; set; }
public ESport? ESport { get; set; }
public string? ESportLevel { get; set; } public ESleepLevel? ESleepLevel { get; set; }
public ESportLevel? ESportLevel { get; set; }
public string HashPassword { get; set; } public string HashPassword { get; set; }
public string? OAuthProvider { get; set; } public string? OAuthProvider { get; set; }

@ -0,0 +1,117 @@
// <auto-generated />
using Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(OptifitDbContext))]
[Migration("20250109094527_Second")]
partial class Second
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
modelBuilder.Entity("Infrastructure.Entities.Exercice", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<float>("Duration")
.HasColumnType("REAL");
b.Property<string>("Image")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("NbRepetitions")
.HasColumnType("INTEGER");
b.Property<int>("NbSeries")
.HasColumnType("INTEGER");
b.Property<string>("Video")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Exercices");
});
modelBuilder.Entity("Infrastructure.Entities.User", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("Age")
.HasColumnType("INTEGER");
b.Property<string>("EGoal")
.HasColumnType("TEXT");
b.Property<int>("EHealthProblem")
.HasColumnType("INTEGER");
b.Property<int?>("ESleepLevel")
.HasColumnType("INTEGER");
b.Property<int?>("ESport")
.HasColumnType("INTEGER");
b.Property<int?>("ESportLevel")
.HasColumnType("INTEGER");
b.Property<string>("HashPassword")
.IsRequired()
.HasColumnType("TEXT");
b.Property<float>("Height")
.HasColumnType("REAL");
b.Property<string>("Logo")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("NbSessionPerWeek")
.HasColumnType("INTEGER");
b.Property<string>("OAuthId")
.HasColumnType("TEXT");
b.Property<string>("OAuthProvider")
.HasColumnType("TEXT");
b.Property<bool>("Sexe")
.HasColumnType("INTEGER");
b.Property<float>("Weight")
.HasColumnType("REAL");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,75 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Second : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "ESportLevel",
table: "Users",
type: "INTEGER",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "ESleepLevel",
table: "Users",
type: "INTEGER",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AddColumn<int>(
name: "EHealthProblem",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ESport",
table: "Users",
type: "INTEGER",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EHealthProblem",
table: "Users");
migrationBuilder.DropColumn(
name: "ESport",
table: "Users");
migrationBuilder.AlterColumn<string>(
name: "ESportLevel",
table: "Users",
type: "TEXT",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ESleepLevel",
table: "Users",
type: "TEXT",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
}
}
}

@ -62,11 +62,17 @@ namespace Infrastructure.Migrations
b.Property<string>("EGoal") b.Property<string>("EGoal")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("ESleepLevel") b.Property<int>("EHealthProblem")
.HasColumnType("TEXT"); .HasColumnType("INTEGER");
b.Property<string>("ESportLevel") b.Property<int?>("ESleepLevel")
.HasColumnType("TEXT"); .HasColumnType("INTEGER");
b.Property<int?>("ESport")
.HasColumnType("INTEGER");
b.Property<int?>("ESportLevel")
.HasColumnType("INTEGER");
b.Property<string>("HashPassword") b.Property<string>("HashPassword")
.IsRequired() .IsRequired()

@ -1,5 +1,6 @@
using Infrastructure.Entities; using Infrastructure.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Shared;
namespace Infrastructure.Stub; namespace Infrastructure.Stub;
@ -31,8 +32,8 @@ public class StubbedContext : OptifitDbContext
Logo = GenerateRandomString(10), Logo = GenerateRandomString(10),
NbSessionPerWeek = GenerateRandomInt(1, 7), NbSessionPerWeek = GenerateRandomInt(1, 7),
EGoal = GenerateRandomString(10), EGoal = GenerateRandomString(10),
ESleepLevel = GenerateRandomString(10), ESleepLevel = ESleepLevel.GOOD,
ESportLevel = GenerateRandomString(10), ESportLevel = ESportLevel.BEGINNER,
HashPassword = GenerateRandomString(10), HashPassword = GenerateRandomString(10),
OAuthProvider = null, OAuthProvider = null,
OAuthId = null OAuthId = null
@ -48,8 +49,8 @@ public class StubbedContext : OptifitDbContext
Logo = GenerateRandomString(10), Logo = GenerateRandomString(10),
NbSessionPerWeek = GenerateRandomInt(1, 7), NbSessionPerWeek = GenerateRandomInt(1, 7),
EGoal = GenerateRandomString(10), EGoal = GenerateRandomString(10),
ESleepLevel = GenerateRandomString(10), ESleepLevel = ESleepLevel.GOOD,
ESportLevel = GenerateRandomString(10), ESportLevel = ESportLevel.BEGINNER,
HashPassword = GenerateRandomString(10), HashPassword = GenerateRandomString(10),
OAuthProvider = null, OAuthProvider = null,
OAuthId = null OAuthId = null

Loading…
Cancel
Save