diff --git a/Infrastructure/Migrations/20250109081041_Initialize.Designer.cs b/Infrastructure/Migrations/20250109081041_Initialize.Designer.cs deleted file mode 100644 index 7e1b7e7..0000000 --- a/Infrastructure/Migrations/20250109081041_Initialize.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -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 deleted file mode 100644 index 71d0170..0000000 --- a/Infrastructure/Migrations/20250109081041_Initialize.cs +++ /dev/null @@ -1,66 +0,0 @@ -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/20250109094119_TrainingProgram.Designer.cs b/Infrastructure/Migrations/20250109094119_TrainingProgram.Designer.cs deleted file mode 100644 index 6e63217..0000000 --- a/Infrastructure/Migrations/20250109094119_TrainingProgram.Designer.cs +++ /dev/null @@ -1,191 +0,0 @@ -// -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 deleted file mode 100644 index 3237c77..0000000 --- a/Infrastructure/Migrations/20250109094119_TrainingProgram.cs +++ /dev/null @@ -1,94 +0,0 @@ -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/20250109094527_Second.Designer.cs b/Infrastructure/Migrations/20250109094527_Second.Designer.cs deleted file mode 100644 index 5ec8b39..0000000 --- a/Infrastructure/Migrations/20250109094527_Second.Designer.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -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 - { - /// - 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("EHealthProblem") - .HasColumnType("INTEGER"); - - b.Property("ESleepLevel") - .HasColumnType("INTEGER"); - - b.Property("ESport") - .HasColumnType("INTEGER"); - - b.Property("ESportLevel") - .HasColumnType("INTEGER"); - - 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/20250109094527_Second.cs b/Infrastructure/Migrations/20250109094527_Second.cs deleted file mode 100644 index a09eabd..0000000 --- a/Infrastructure/Migrations/20250109094527_Second.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Migrations -{ - /// - public partial class Second : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ESportLevel", - table: "Users", - type: "INTEGER", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ESleepLevel", - table: "Users", - type: "INTEGER", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "EHealthProblem", - table: "Users", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "ESport", - table: "Users", - type: "INTEGER", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "EHealthProblem", - table: "Users"); - - migrationBuilder.DropColumn( - name: "ESport", - table: "Users"); - - migrationBuilder.AlterColumn( - name: "ESportLevel", - table: "Users", - type: "TEXT", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ESleepLevel", - table: "Users", - type: "TEXT", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - } - } -} diff --git a/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs b/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs deleted file mode 100644 index c8283ee..0000000 --- a/Infrastructure/Migrations/OptifitDbContextModelSnapshot.cs +++ /dev/null @@ -1,194 +0,0 @@ -// -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("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("EHealthProblem") - .HasColumnType("INTEGER"); - - b.Property("ESleepLevel") - .HasColumnType("INTEGER"); - - b.Property("ESport") - .HasColumnType("INTEGER"); - - b.Property("ESportLevel") - .HasColumnType("INTEGER"); - - 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/Server/FirstTest.db b/Server/FirstTest.db deleted file mode 100644 index 10fd111..0000000 Binary files a/Server/FirstTest.db and /dev/null differ diff --git a/Server/Mappers/TrainingProgramProfile.cs b/Server/Mappers/TrainingProgramProfile.cs index 3eb1a08..2932038 100644 --- a/Server/Mappers/TrainingProgramProfile.cs +++ b/Server/Mappers/TrainingProgramProfile.cs @@ -3,17 +3,23 @@ using Infrastructure.Entities; using Server.Dto.Request; using Server.Dto.Response; -namespace Server.Mappers +namespace Server.Mappers; + +public class TrainingProgramProfile : Profile { - public class TrainingProgramProfile : Profile + public TrainingProgramProfile() { - public TrainingProgramProfile() - { - CreateMap() - .ForMember(dest => dest.Sessions, opt => opt.MapFrom(src => src.Sessions)); + CreateMap() + .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id)) + .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)) + .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description)) + .ForMember(dest => dest.WeekDuration, opt => opt.MapFrom(src => src.WeekDuration)) + .ForMember(dest => dest.Sessions, opt => opt.MapFrom(src => src.Sessions)); - CreateMap() - .ForMember(dest => dest, opt => opt.Ignore()); - } + CreateMap() + .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)) + .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description)) + .ForMember(dest => dest.WeekDuration, opt => opt.MapFrom(src => src.WeekDuration)) + .ForMember(dest => dest.Sessions, opt => opt.MapFrom(src => src.Sessions)); } } \ No newline at end of file