diff --git a/Infrastructure/Migrations/20250109081041_Initialize.Designer.cs b/Infrastructure/Migrations/20250109081041_Initialize.Designer.cs new file mode 100644 index 0000000..7e1b7e7 --- /dev/null +++ b/Infrastructure/Migrations/20250109081041_Initialize.Designer.cs @@ -0,0 +1,111 @@ +// +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 + { + /// + 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("Id") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Duration") + .HasColumnType("REAL"); + + b.Property("Image") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NbRepetitions") + .HasColumnType("INTEGER"); + + b.Property("NbSeries") + .HasColumnType("INTEGER"); + + b.Property("Video") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Exercices"); + }); + + modelBuilder.Entity("Infrastructure.Entities.User", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Age") + .HasColumnType("INTEGER"); + + b.Property("EGoal") + .HasColumnType("TEXT"); + + b.Property("ESleepLevel") + .HasColumnType("TEXT"); + + b.Property("ESportLevel") + .HasColumnType("TEXT"); + + b.Property("HashPassword") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Height") + .HasColumnType("REAL"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NbSessionPerWeek") + .HasColumnType("INTEGER"); + + b.Property("OAuthId") + .HasColumnType("TEXT"); + + b.Property("OAuthProvider") + .HasColumnType("TEXT"); + + b.Property("Sexe") + .HasColumnType("INTEGER"); + + b.Property("Weight") + .HasColumnType("REAL"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/Migrations/20250109081041_Initialize.cs b/Infrastructure/Migrations/20250109081041_Initialize.cs new file mode 100644 index 0000000..71d0170 --- /dev/null +++ b/Infrastructure/Migrations/20250109081041_Initialize.cs @@ -0,0 +1,66 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Infrastructure.Migrations +{ + /// + public partial class Initialize : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Exercices", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: false), + Duration = table.Column(type: "REAL", nullable: false), + Image = table.Column(type: "TEXT", nullable: false), + Video = table.Column(type: "TEXT", nullable: false), + NbSeries = table.Column(type: "INTEGER", nullable: false), + NbRepetitions = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Exercices", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Age = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "REAL", nullable: false), + Weight = table.Column(type: "REAL", nullable: false), + Sexe = table.Column(type: "INTEGER", nullable: false), + Logo = table.Column(type: "TEXT", nullable: false), + NbSessionPerWeek = table.Column(type: "INTEGER", nullable: false), + EGoal = table.Column(type: "TEXT", nullable: true), + ESleepLevel = table.Column(type: "TEXT", nullable: true), + ESportLevel = table.Column(type: "TEXT", nullable: true), + HashPassword = table.Column(type: "TEXT", nullable: false), + OAuthProvider = table.Column(type: "TEXT", nullable: true), + OAuthId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Exercices"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs b/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs new file mode 100644 index 0000000..5361f59 --- /dev/null +++ b/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs @@ -0,0 +1,108 @@ +// +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("Id") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Duration") + .HasColumnType("REAL"); + + b.Property("Image") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NbRepetitions") + .HasColumnType("INTEGER"); + + b.Property("NbSeries") + .HasColumnType("INTEGER"); + + b.Property("Video") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Exercices"); + }); + + modelBuilder.Entity("Infrastructure.Entities.User", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Age") + .HasColumnType("INTEGER"); + + b.Property("EGoal") + .HasColumnType("TEXT"); + + b.Property("ESleepLevel") + .HasColumnType("TEXT"); + + b.Property("ESportLevel") + .HasColumnType("TEXT"); + + b.Property("HashPassword") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Height") + .HasColumnType("REAL"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NbSessionPerWeek") + .HasColumnType("INTEGER"); + + b.Property("OAuthId") + .HasColumnType("TEXT"); + + b.Property("OAuthProvider") + .HasColumnType("TEXT"); + + b.Property("Sexe") + .HasColumnType("INTEGER"); + + b.Property("Weight") + .HasColumnType("REAL"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/OptifitDbContext.cs b/Infrastructure/OptifitDbContext.cs index e45df74..b39b5b5 100644 --- a/Infrastructure/OptifitDbContext.cs +++ b/Infrastructure/OptifitDbContext.cs @@ -1,32 +1,34 @@ using Infrastructure.Entities; using Microsoft.EntityFrameworkCore; -namespace Infrastructure; - -public class OptifitDbContext : DbContext +namespace Infrastructure { - public virtual DbSet Users { get; set; } - public OptifitDbContext() - { - } - - public OptifitDbContext(DbContextOptions options) - : base(options) - { - } - - protected override void OnConfiguring(DbContextOptionsBuilder options) + public class OptifitDbContext : DbContext { - if (!options.IsConfigured) + public virtual DbSet Users { get; set; } + public virtual DbSet Exercices { get; set; } + + public OptifitDbContext() { - options.UseSqlite("Data Source=InMemoryDb.db"); } - } - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity().Property(a => a.Name).IsRequired(); - - base.OnModelCreating(modelBuilder); + public OptifitDbContext(DbContextOptions options) + : base(options) + { + } + + protected override void OnConfiguring(DbContextOptionsBuilder options) + { + if (!options.IsConfigured) + { + options.UseSqlite("Data Source=../Server/FirstTest.db"); + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity().Property(a => a.Name).IsRequired(); + base.OnModelCreating(modelBuilder); + } } } \ No newline at end of file diff --git a/Infrastructure/Repositories/ISessionRepository.cs b/Infrastructure/Repositories/ISessionRepository.cs new file mode 100644 index 0000000..04e610d --- /dev/null +++ b/Infrastructure/Repositories/ISessionRepository.cs @@ -0,0 +1,7 @@ +using Infrastructure.Entities; + +namespace Infrastructure.Repositories; + +public interface ISessionRepository : IRepository +{ +} \ No newline at end of file diff --git a/Infrastructure/Repositories/SessionRepository.cs b/Infrastructure/Repositories/SessionRepository.cs new file mode 100644 index 0000000..f85abd5 --- /dev/null +++ b/Infrastructure/Repositories/SessionRepository.cs @@ -0,0 +1,10 @@ +using Infrastructure.Entities; + +namespace Infrastructure.Repositories; + +public class SessionRepository : GenericRepository, ISessionRepository +{ + public SessionRepository(OptifitDbContext context) : base(context) + { + } +} \ No newline at end of file diff --git a/Server/Controller/v1/SessionsController.cs b/Server/Controller/v1/SessionsController.cs new file mode 100644 index 0000000..b7b348d --- /dev/null +++ b/Server/Controller/v1/SessionsController.cs @@ -0,0 +1,6 @@ +namespace Server.Controller.v1; + +public class SessionsController +{ + +} \ No newline at end of file diff --git a/Server/FirstTest.db b/Server/FirstTest.db deleted file mode 100644 index 41e1a65..0000000 Binary files a/Server/FirstTest.db and /dev/null differ diff --git a/Server/IServices/ISessionService.cs b/Server/IServices/ISessionService.cs new file mode 100644 index 0000000..7975f0c --- /dev/null +++ b/Server/IServices/ISessionService.cs @@ -0,0 +1,6 @@ +namespace Server.IServices; + +public class ISessionService +{ + +} \ No newline at end of file diff --git a/Server/Mappers/PaginatedResultProfile.cs b/Server/Mappers/PaginatedResultProfile.cs new file mode 100644 index 0000000..3f1ec90 --- /dev/null +++ b/Server/Mappers/PaginatedResultProfile.cs @@ -0,0 +1,6 @@ +namespace Server.Mappers; + +public class PaginatedResultProfile +{ + +} \ No newline at end of file diff --git a/Server/Mappers/SessionProfile.cs b/Server/Mappers/SessionProfile.cs new file mode 100644 index 0000000..16d5291 --- /dev/null +++ b/Server/Mappers/SessionProfile.cs @@ -0,0 +1,6 @@ +namespace Server.Mappers; + +public class SessionProfile +{ + +} \ No newline at end of file diff --git a/Server/Services/SessionService.cs b/Server/Services/SessionService.cs new file mode 100644 index 0000000..eb953b5 --- /dev/null +++ b/Server/Services/SessionService.cs @@ -0,0 +1,6 @@ +namespace Server.Services; + +public class SessionService +{ + +} \ No newline at end of file