Add exercices fix route + migrations

pull/1/head
Leo TUAILLON 5 months ago
parent f574a6b4cb
commit 14247ce133

@ -0,0 +1,111 @@
// <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("20250109081041_Initialize")]
partial class Initialize
{
/// <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<string>("ESleepLevel")
.HasColumnType("TEXT");
b.Property<string>("ESportLevel")
.HasColumnType("TEXT");
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,66 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Initialize : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Exercices",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Duration = table.Column<float>(type: "REAL", nullable: false),
Image = table.Column<string>(type: "TEXT", nullable: false),
Video = table.Column<string>(type: "TEXT", nullable: false),
NbSeries = table.Column<int>(type: "INTEGER", nullable: false),
NbRepetitions = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Exercices", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Age = table.Column<int>(type: "INTEGER", nullable: false),
Height = table.Column<float>(type: "REAL", nullable: false),
Weight = table.Column<float>(type: "REAL", nullable: false),
Sexe = table.Column<bool>(type: "INTEGER", nullable: false),
Logo = table.Column<string>(type: "TEXT", nullable: false),
NbSessionPerWeek = table.Column<int>(type: "INTEGER", nullable: false),
EGoal = table.Column<string>(type: "TEXT", nullable: true),
ESleepLevel = table.Column<string>(type: "TEXT", nullable: true),
ESportLevel = table.Column<string>(type: "TEXT", nullable: true),
HashPassword = table.Column<string>(type: "TEXT", nullable: false),
OAuthProvider = table.Column<string>(type: "TEXT", nullable: true),
OAuthId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Exercices");
migrationBuilder.DropTable(
name: "Users");
}
}
}

@ -0,0 +1,108 @@
// <auto-generated />
using Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(OptifitDbContext))]
partial class OptifitDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(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<string>("ESleepLevel")
.HasColumnType("TEXT");
b.Property<string>("ESportLevel")
.HasColumnType("TEXT");
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
}
}
}

@ -1,32 +1,34 @@
using Infrastructure.Entities;
using Microsoft.EntityFrameworkCore;
namespace Infrastructure;
public class OptifitDbContext : DbContext
namespace Infrastructure
{
public virtual DbSet<User> Users { get; set; }
public OptifitDbContext()
public class OptifitDbContext : DbContext
{
}
public virtual DbSet<User> Users { get; set; }
public virtual DbSet<Exercice> Exercices { get; set; }
public OptifitDbContext(DbContextOptions<OptifitDbContext> options)
: base(options)
{
}
public OptifitDbContext()
{
}
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
public OptifitDbContext(DbContextOptions<OptifitDbContext> options)
: base(options)
{
options.UseSqlite("Data Source=InMemoryDb.db");
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().Property(a => a.Name).IsRequired();
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
{
options.UseSqlite("Data Source=../Server/FirstTest.db");
}
}
base.OnModelCreating(modelBuilder);
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().Property(a => a.Name).IsRequired();
base.OnModelCreating(modelBuilder);
}
}
}

@ -0,0 +1,7 @@
using Infrastructure.Entities;
namespace Infrastructure.Repositories;
public interface ISessionRepository : IRepository<Session>
{
}

@ -0,0 +1,10 @@
using Infrastructure.Entities;
namespace Infrastructure.Repositories;
public class SessionRepository : GenericRepository<Session>, ISessionRepository
{
public SessionRepository(OptifitDbContext context) : base(context)
{
}
}

@ -0,0 +1,6 @@
namespace Server.Controller.v1;
public class SessionsController
{
}

Binary file not shown.

@ -0,0 +1,6 @@
namespace Server.IServices;
public class ISessionService
{
}

@ -0,0 +1,6 @@
namespace Server.Mappers;
public class PaginatedResultProfile
{
}

@ -0,0 +1,6 @@
namespace Server.Mappers;
public class SessionProfile
{
}

@ -0,0 +1,6 @@
namespace Server.Services;
public class SessionService
{
}
Loading…
Cancel
Save