diff --git a/Infrastructure/Entities/Program.cs b/Infrastructure/Entities/TrainingProgram.cs
similarity index 91%
rename from Infrastructure/Entities/Program.cs
rename to Infrastructure/Entities/TrainingProgram.cs
index 82398fe..6df8f45 100644
--- a/Infrastructure/Entities/Program.cs
+++ b/Infrastructure/Entities/TrainingProgram.cs
@@ -4,7 +4,7 @@ using Infrastructure.Base;
namespace Infrastructure.Entities;
-public class Program : EntityBase
+public class TrainingProgram : EntityBase
{
[Required]
public string Name { get; set; }
diff --git a/Infrastructure/Migrations/20250109094119_TrainingProgram.Designer.cs b/Infrastructure/Migrations/20250109094119_TrainingProgram.Designer.cs
new file mode 100644
index 0000000..6e63217
--- /dev/null
+++ b/Infrastructure/Migrations/20250109094119_TrainingProgram.Designer.cs
@@ -0,0 +1,191 @@
+//
+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("20250109094119_TrainingProgram")]
+ partial class TrainingProgram
+ {
+ ///
+ 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("SessionId")
+ .HasColumnType("TEXT");
+
+ b.Property("Video")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SessionId");
+
+ b.ToTable("Exercices");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Program", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Difficulty")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("WeekDuration")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Programs");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Session", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Duration")
+ .HasColumnType("REAL");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ProgramId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProgramId");
+
+ b.ToTable("Sessions");
+ });
+
+ 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");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Exercice", b =>
+ {
+ b.HasOne("Infrastructure.Entities.Session", null)
+ .WithMany("Exercices")
+ .HasForeignKey("SessionId");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Session", b =>
+ {
+ b.HasOne("Infrastructure.Entities.Program", null)
+ .WithMany("Sessions")
+ .HasForeignKey("ProgramId");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Program", b =>
+ {
+ b.Navigation("Sessions");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Session", b =>
+ {
+ b.Navigation("Exercices");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Infrastructure/Migrations/20250109094119_TrainingProgram.cs b/Infrastructure/Migrations/20250109094119_TrainingProgram.cs
new file mode 100644
index 0000000..3237c77
--- /dev/null
+++ b/Infrastructure/Migrations/20250109094119_TrainingProgram.cs
@@ -0,0 +1,94 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Infrastructure.Migrations
+{
+ ///
+ public partial class TrainingProgram : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "SessionId",
+ table: "Exercices",
+ type: "TEXT",
+ nullable: true);
+
+ migrationBuilder.CreateTable(
+ name: "Programs",
+ columns: table => new
+ {
+ Id = table.Column(type: "TEXT", nullable: false),
+ Name = table.Column(type: "TEXT", nullable: false),
+ WeekDuration = table.Column(type: "INTEGER", nullable: false),
+ Description = table.Column(type: "TEXT", nullable: false),
+ Difficulty = table.Column(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Programs", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Sessions",
+ 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),
+ ProgramId = table.Column(type: "TEXT", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Sessions", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Sessions_Programs_ProgramId",
+ column: x => x.ProgramId,
+ principalTable: "Programs",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Exercices_SessionId",
+ table: "Exercices",
+ column: "SessionId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Sessions_ProgramId",
+ table: "Sessions",
+ column: "ProgramId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Exercices_Sessions_SessionId",
+ table: "Exercices",
+ column: "SessionId",
+ principalTable: "Sessions",
+ principalColumn: "Id");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Exercices_Sessions_SessionId",
+ table: "Exercices");
+
+ migrationBuilder.DropTable(
+ name: "Sessions");
+
+ migrationBuilder.DropTable(
+ name: "Programs");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Exercices_SessionId",
+ table: "Exercices");
+
+ migrationBuilder.DropColumn(
+ name: "SessionId",
+ table: "Exercices");
+ }
+ }
+}
diff --git a/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs b/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs
index 5361f59..a053e3e 100644
--- a/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs
+++ b/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs
@@ -42,15 +42,71 @@ namespace Infrastructure.Migrations
b.Property("NbSeries")
.HasColumnType("INTEGER");
+ b.Property("SessionId")
+ .HasColumnType("TEXT");
+
b.Property("Video")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
+ b.HasIndex("SessionId");
+
b.ToTable("Exercices");
});
+ modelBuilder.Entity("Infrastructure.Entities.Program", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Difficulty")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("WeekDuration")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Programs");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Session", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Duration")
+ .HasColumnType("REAL");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ProgramId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProgramId");
+
+ b.ToTable("Sessions");
+ });
+
modelBuilder.Entity("Infrastructure.Entities.User", b =>
{
b.Property("Id")
@@ -102,6 +158,30 @@ namespace Infrastructure.Migrations
b.ToTable("Users");
});
+
+ modelBuilder.Entity("Infrastructure.Entities.Exercice", b =>
+ {
+ b.HasOne("Infrastructure.Entities.Session", null)
+ .WithMany("Exercices")
+ .HasForeignKey("SessionId");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Session", b =>
+ {
+ b.HasOne("Infrastructure.Entities.Program", null)
+ .WithMany("Sessions")
+ .HasForeignKey("ProgramId");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Program", b =>
+ {
+ b.Navigation("Sessions");
+ });
+
+ modelBuilder.Entity("Infrastructure.Entities.Session", b =>
+ {
+ b.Navigation("Exercices");
+ });
#pragma warning restore 612, 618
}
}
diff --git a/Infrastructure/OptifitDbContext.cs b/Infrastructure/OptifitDbContext.cs
index b39b5b5..a8c454c 100644
--- a/Infrastructure/OptifitDbContext.cs
+++ b/Infrastructure/OptifitDbContext.cs
@@ -7,6 +7,8 @@ namespace Infrastructure
{
public virtual DbSet Users { get; set; }
public virtual DbSet Exercices { get; set; }
+ public virtual DbSet Sessions { get; set; }
+ public virtual DbSet Programs { get; set; }
public OptifitDbContext()
{
diff --git a/Infrastructure/Repositories/ITrainingProgramRepository.cs b/Infrastructure/Repositories/ITrainingProgramRepository.cs
new file mode 100644
index 0000000..24a14d7
--- /dev/null
+++ b/Infrastructure/Repositories/ITrainingProgramRepository.cs
@@ -0,0 +1,7 @@
+using Infrastructure.Entities;
+
+namespace Infrastructure.Repositories;
+
+public interface ITrainingProgramRepository : IRepository
+{
+}
diff --git a/Infrastructure/Repositories/TrainingProgramRepository.cs b/Infrastructure/Repositories/TrainingProgramRepository.cs
new file mode 100644
index 0000000..c742a6b
--- /dev/null
+++ b/Infrastructure/Repositories/TrainingProgramRepository.cs
@@ -0,0 +1,10 @@
+using Infrastructure.Entities;
+
+namespace Infrastructure.Repositories;
+
+public class TrainingProgramRepository : GenericRepository, ITrainingProgramRepository
+{
+ public TrainingProgramRepository(OptifitDbContext context) : base(context)
+ {
+ }
+}
\ No newline at end of file
diff --git a/Server/Controller/v1/TrainingProgramController.cs b/Server/Controller/v1/TrainingProgramController.cs
new file mode 100644
index 0000000..83d978e
--- /dev/null
+++ b/Server/Controller/v1/TrainingProgramController.cs
@@ -0,0 +1,6 @@
+namespace Server.Controller.v1;
+
+public class TrainingProgramController
+{
+
+}
\ No newline at end of file
diff --git a/Server/Dto/Request/RequestProgramDto.cs b/Server/Dto/Request/RequestTrainingProgramDto.cs
similarity index 90%
rename from Server/Dto/Request/RequestProgramDto.cs
rename to Server/Dto/Request/RequestTrainingProgramDto.cs
index 2fd5c59..bbc4b89 100644
--- a/Server/Dto/Request/RequestProgramDto.cs
+++ b/Server/Dto/Request/RequestTrainingProgramDto.cs
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace Server.Dto.Request
{
- public class RequestProgramDto
+ public class RequestTrainingProgramDto
{
[Required]
public string Name { get; set; }
diff --git a/Server/Dto/Response/ResponseProgramDto.cs b/Server/Dto/Response/ResponseTrainingProgramDto.cs
similarity index 89%
rename from Server/Dto/Response/ResponseProgramDto.cs
rename to Server/Dto/Response/ResponseTrainingProgramDto.cs
index 39c8998..ac1ec81 100644
--- a/Server/Dto/Response/ResponseProgramDto.cs
+++ b/Server/Dto/Response/ResponseTrainingProgramDto.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
namespace Server.Dto.Response
{
- public class ResponseProgramDto
+ public class ResponseTrainingProgramDto
{
public string Id { get; set; }
diff --git a/Server/IServices/ITrainingProgramService.cs b/Server/IServices/ITrainingProgramService.cs
new file mode 100644
index 0000000..4137677
--- /dev/null
+++ b/Server/IServices/ITrainingProgramService.cs
@@ -0,0 +1,6 @@
+namespace Server.IServices;
+
+public class ITrainingProgramService
+{
+
+}
\ No newline at end of file
diff --git a/Server/Mappers/TrainingProgramProfile.cs b/Server/Mappers/TrainingProgramProfile.cs
new file mode 100644
index 0000000..c9c241a
--- /dev/null
+++ b/Server/Mappers/TrainingProgramProfile.cs
@@ -0,0 +1,6 @@
+namespace Server.Mappers;
+
+public class TrainingProgramProfile
+{
+
+}
\ No newline at end of file
diff --git a/Server/Services/TrainingProgramService.cs b/Server/Services/TrainingProgramService.cs
new file mode 100644
index 0000000..33c8a68
--- /dev/null
+++ b/Server/Services/TrainingProgramService.cs
@@ -0,0 +1,6 @@
+namespace Server.Services;
+
+public class TrainingProgramService
+{
+
+}
\ No newline at end of file