diff --git a/.gitignore b/.gitignore
index 6d8621c..85546c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -498,7 +498,8 @@ fabric.properties
.LSOverride
# Icon must end with two \r
-Icon
+Icon
+
# Thumbnails
._*
@@ -548,3 +549,4 @@ xcuserdata/
*.xcscmblueprint
*.xccheckout
+Migration/
\ No newline at end of file
diff --git a/src/DbContextLib/LibraryContext.cs b/src/DbContextLib/HeartTrackContext.cs
similarity index 93%
rename from src/DbContextLib/LibraryContext.cs
rename to src/DbContextLib/HeartTrackContext.cs
index c326091..919007b 100644
--- a/src/DbContextLib/LibraryContext.cs
+++ b/src/DbContextLib/HeartTrackContext.cs
@@ -1,221 +1,221 @@
-//-----------------------------------------------------------------------
-// FILENAME: LibraryContext.cs
-// PROJECT: DbContextLib
-// SOLUTION: FitnessApp
-// DATE CREATED: 22/02/2024
-// AUTHOR: Antoine PEREDERII
-//-----------------------------------------------------------------------
-
-using Entities;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Migrations.Operations;
-
-namespace DbContextLib
-{
- ///
- /// Represents the database context for the FitnessApp.
- ///
- public class LibraryContext : DbContext
- {
- ///
- /// Gets or sets the set of athletes.
- ///
- public DbSet AthletesSet { get; set; }
-
- ///
- /// Gets or sets the set of activities.
- ///
- public DbSet ActivitiesSet { get; set; }
-
- ///
- /// Gets or sets the set of data sources.
- ///
- public DbSet DataSourcesSet { get; set; }
-
- ///
- /// Gets or sets the set of heart rates.
- ///
- public DbSet HeartRatesSet { get; set; }
-
- ///
- /// Gets or sets the set of notifications.
- ///
- public DbSet NotificationsSet { get; set; }
-
- ///
- /// Gets or sets the set of statistics.
- ///
- public DbSet StatisticsSet { get; set; }
-
- ///
- /// Gets or sets the set of trainings.
- ///
- public DbSet TrainingsSet { get; set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public LibraryContext() : base() { }
-
- ///
- /// Initializes a new instance of the class with the specified options.
- ///
- /// The options for the context.
- public LibraryContext(DbContextOptions options) : base(options) { }
-
- ///
- /// Configures the database options if they are not already configured.
- ///
- /// The options builder instance.
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- if (!optionsBuilder.IsConfigured)
- {
- optionsBuilder.UseSqlite($"Data Source=uca.HeartTrack.db");
- }
- }
-
- ///
- /// Configures the model for the library context.
- ///
- /// The model builder instance.
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
-
- modelBuilder.Entity()
- .HasKey(a => a.IdActivity);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(a => a.IdActivity)
- .ValueGeneratedOnAdd();
-
- //primary key of HeartRateEntity
- modelBuilder.Entity()
- .HasKey(h => h.IdHeartRate);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(h => h.IdHeartRate)
- .ValueGeneratedOnAdd();
-
- //primary key of DataSourceEntity
- modelBuilder.Entity()
- .HasKey(d => d.IdSource);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(d => d.IdSource)
- .ValueGeneratedOnAdd();
-
- //primary key of AthleteEntity
- modelBuilder.Entity()
- .HasKey(at => at.IdAthlete);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(at => at.IdAthlete)
- .ValueGeneratedOnAdd();
- // add image column type
- // modelBuilder.Entity()
- // .Property(at => at.ProfilPicture)
- // .HasColumnType("image");
-
-
- //primary key of StatisticEntity
- modelBuilder.Entity()
- .HasKey(s => s.IdStatistic);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(s => s.IdStatistic)
- .ValueGeneratedOnAdd();
-
- //primary key of TrainingEntity
- modelBuilder.Entity()
- .HasKey(t => t.IdTraining);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(t => t.IdTraining)
- .ValueGeneratedOnAdd();
-
- //primary key of NotificationEntity
- modelBuilder.Entity()
- .HasKey(n => n.IdNotif);
- //generation mode (at insertion)
- modelBuilder.Entity()
- .Property(n => n.IdNotif)
- .ValueGeneratedOnAdd();
-
- modelBuilder.Entity()
- .HasKey(f => new { f.FollowingId, f.FollowerId });
-
- modelBuilder.Entity()
- .HasOne(fing => fing.Following)
- .WithMany(fings => fings.Followings)
- .HasForeignKey(fing => fing.FollowingId);
-
- modelBuilder.Entity()
- .HasOne(fer => fer.Follower)
- .WithMany(fers => fers.Followers)
- .HasForeignKey(fing => fing.FollowerId);
-
- // !
- // ? Plusieurs questions sur les required ou non, différence difficile à comprendre
-
- modelBuilder.Entity()
- .HasMany(at => at.TrainingsCoach)
- .WithOne(tc => tc.Coach)
- .HasForeignKey(tc => tc.CoachId);
-
- modelBuilder.Entity()
- .HasMany(at => at.TrainingsAthlete)
- .WithMany(ta => ta.Athletes);
-
- modelBuilder.Entity()
- .HasMany(at => at.NotificationsReceived)
- .WithMany(nr => nr.Receivers);
-
- modelBuilder.Entity()
- .HasMany(at => at.NotificationsSent)
- .WithOne(ns => ns.Sender)
- .HasForeignKey(ns => ns.SenderId);
- // required car on veut toujours savoir le receveur et l'envoyeur de la notification meme admin ou systeme
-
- modelBuilder.Entity()
- .HasMany(at => at.Statistics)
- .WithOne(s => s.Athlete)
- .HasForeignKey(s => s.AthleteId)
- .IsRequired(false);
-
- modelBuilder.Entity()
- .HasMany(at => at.Activities)
- .WithOne(a => a.Athlete)
- .HasForeignKey(a => a.AthleteId)
- .IsRequired(false);
-
- modelBuilder.Entity()
- .HasMany(a => a.HeartRates)
- .WithOne(h => h.Activity)
- .HasForeignKey(h => h.ActivityId)
- .IsRequired();
-
- modelBuilder.Entity()
- .HasMany(d => d.Activities)
- .WithOne(a => a.DataSource)
- .HasForeignKey(a => a.DataSourceId)
- .IsRequired();
-
- modelBuilder.Entity()
- .HasMany(ds => ds.Activities)
- .WithOne(at => at.DataSource)
- .HasForeignKey(at => at.DataSourceId)
- .IsRequired(false);
-
- // modelBuilder.Entity()
- // .HasMany(fer => fer.Followers)
- // .WithMany(fing => fing.Followings)
- // .UsingEntity(
- // l => l.HasOne().WithMany().HasForeignKey(fer => fer.FollowerId),
- // r => r.HasOne().WithMany().HasForeignKey(fing => fing.FollowingId),
- // j => j.Property(f => f.StartDate).HasDefaultValueSql("CURRENT_TIMESTAMP")
- // );
- }
- }
+//-----------------------------------------------------------------------
+// FILENAME: HeartTrackContextLibraryContext.cs
+// PROJECT: DbContextLib
+// SOLUTION: FitnessApp
+// DATE CREATED: 22/02/2024
+// AUTHOR: Antoine PEREDERII
+//-----------------------------------------------------------------------
+
+using Entities;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Migrations.Operations;
+
+namespace DbContextLib
+{
+ ///
+ /// Represents the database context for the FitnessApp.
+ ///
+ public class HeartTrackContext : DbContext
+ {
+ ///
+ /// Gets or sets the set of athletes.
+ ///
+ public DbSet AthletesSet { get; set; }
+
+ ///
+ /// Gets or sets the set of activities.
+ ///
+ public DbSet ActivitiesSet { get; set; }
+
+ ///
+ /// Gets or sets the set of data sources.
+ ///
+ public DbSet DataSourcesSet { get; set; }
+
+ ///
+ /// Gets or sets the set of heart rates.
+ ///
+ public DbSet HeartRatesSet { get; set; }
+
+ ///
+ /// Gets or sets the set of notifications.
+ ///
+ public DbSet NotificationsSet { get; set; }
+
+ ///
+ /// Gets or sets the set of statistics.
+ ///
+ public DbSet StatisticsSet { get; set; }
+
+ ///
+ /// Gets or sets the set of trainings.
+ ///
+ public DbSet TrainingsSet { get; set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public HeartTrackContext() : base() { }
+
+ ///
+ /// Initializes a new instance of the class with the specified options.
+ ///
+ /// The options for the context.
+ public HeartTrackContext(DbContextOptions options) : base(options) { }
+
+ ///
+ /// Configures the database options if they are not already configured.
+ ///
+ /// The options builder instance.
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (!optionsBuilder.IsConfigured)
+ {
+ optionsBuilder.UseSqlite($"Data Source=uca.HeartTrack.db");
+ }
+ }
+
+ ///
+ /// Configures the model for the library context.
+ ///
+ /// The model builder instance.
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ modelBuilder.Entity()
+ .HasKey(a => a.IdActivity);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(a => a.IdActivity)
+ .ValueGeneratedOnAdd();
+
+ //primary key of HeartRateEntity
+ modelBuilder.Entity()
+ .HasKey(h => h.IdHeartRate);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(h => h.IdHeartRate)
+ .ValueGeneratedOnAdd();
+
+ //primary key of DataSourceEntity
+ modelBuilder.Entity()
+ .HasKey(d => d.IdSource);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(d => d.IdSource)
+ .ValueGeneratedOnAdd();
+
+ //primary key of AthleteEntity
+ modelBuilder.Entity()
+ .HasKey(at => at.IdAthlete);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(at => at.IdAthlete)
+ .ValueGeneratedOnAdd();
+ // add image column type
+ // modelBuilder.Entity()
+ // .Property(at => at.ProfilPicture)
+ // .HasColumnType("image");
+
+
+ //primary key of StatisticEntity
+ modelBuilder.Entity()
+ .HasKey(s => s.IdStatistic);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(s => s.IdStatistic)
+ .ValueGeneratedOnAdd();
+
+ //primary key of TrainingEntity
+ modelBuilder.Entity()
+ .HasKey(t => t.IdTraining);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(t => t.IdTraining)
+ .ValueGeneratedOnAdd();
+
+ //primary key of NotificationEntity
+ modelBuilder.Entity()
+ .HasKey(n => n.IdNotif);
+ //generation mode (at insertion)
+ modelBuilder.Entity()
+ .Property(n => n.IdNotif)
+ .ValueGeneratedOnAdd();
+
+ modelBuilder.Entity()
+ .HasKey(f => new { f.FollowingId, f.FollowerId });
+
+ modelBuilder.Entity()
+ .HasOne(fing => fing.Following)
+ .WithMany(fings => fings.Followings)
+ .HasForeignKey(fing => fing.FollowingId);
+
+ modelBuilder.Entity()
+ .HasOne(fer => fer.Follower)
+ .WithMany(fers => fers.Followers)
+ .HasForeignKey(fing => fing.FollowerId);
+
+ // !
+ // ? Plusieurs questions sur les required ou non, différence difficile à comprendre
+
+ modelBuilder.Entity()
+ .HasMany(at => at.TrainingsCoach)
+ .WithOne(tc => tc.Coach)
+ .HasForeignKey(tc => tc.CoachId);
+
+ modelBuilder.Entity()
+ .HasMany(at => at.TrainingsAthlete)
+ .WithMany(ta => ta.Athletes);
+
+ modelBuilder.Entity()
+ .HasMany(at => at.NotificationsReceived)
+ .WithMany(nr => nr.Receivers);
+
+ modelBuilder.Entity()
+ .HasMany(at => at.NotificationsSent)
+ .WithOne(ns => ns.Sender)
+ .HasForeignKey(ns => ns.SenderId);
+ // required car on veut toujours savoir le receveur et l'envoyeur de la notification meme admin ou systeme
+
+ modelBuilder.Entity()
+ .HasMany(at => at.Statistics)
+ .WithOne(s => s.Athlete)
+ .HasForeignKey(s => s.AthleteId)
+ .IsRequired(false);
+
+ modelBuilder.Entity()
+ .HasMany(at => at.Activities)
+ .WithOne(a => a.Athlete)
+ .HasForeignKey(a => a.AthleteId)
+ .IsRequired(false);
+
+ modelBuilder.Entity()
+ .HasMany(a => a.HeartRates)
+ .WithOne(h => h.Activity)
+ .HasForeignKey(h => h.ActivityId)
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .HasMany(d => d.Activities)
+ .WithOne(a => a.DataSource)
+ .HasForeignKey(a => a.DataSourceId)
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .HasMany(ds => ds.Activities)
+ .WithOne(at => at.DataSource)
+ .HasForeignKey(at => at.DataSourceId)
+ .IsRequired(false);
+
+ // modelBuilder.Entity()
+ // .HasMany(fer => fer.Followers)
+ // .WithMany(fing => fing.Followings)
+ // .UsingEntity(
+ // l => l.HasOne().WithMany().HasForeignKey(fer => fer.FollowerId),
+ // r => r.HasOne().WithMany().HasForeignKey(fing => fing.FollowingId),
+ // j => j.Property(f => f.StartDate).HasDefaultValueSql("CURRENT_TIMESTAMP")
+ // );
+ }
+ }
}
\ No newline at end of file
diff --git a/src/HeartTrack.sln b/src/HeartTrack.sln
index f0c2d3d..0ae03f5 100644
--- a/src/HeartTrack.sln
+++ b/src/HeartTrack.sln
@@ -17,6 +17,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTestRelationships",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestsEntities", "Tests\UnitTestsEntities\UnitTestsEntities.csproj", "{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedEF", "SharedEF\SharedEF.csproj", "{55478079-0AA0-47C1-97FF-A048091FD930}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model2Entities", "Model2Entities\Model2Entities.csproj", "{FA329DEF-4756-4A8B-84E9-5A625FF94CBF}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -50,6 +54,14 @@ Global
{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {55478079-0AA0-47C1-97FF-A048091FD930}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {55478079-0AA0-47C1-97FF-A048091FD930}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {55478079-0AA0-47C1-97FF-A048091FD930}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {55478079-0AA0-47C1-97FF-A048091FD930}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8} = {2B227C67-3BEC-4A83-BDA0-F3918FBC0D18}
diff --git a/src/Model2Entities/ActivityRepository.cs b/src/Model2Entities/ActivityRepository.cs
new file mode 100644
index 0000000..7d1b1a4
--- /dev/null
+++ b/src/Model2Entities/ActivityRepository.cs
@@ -0,0 +1,46 @@
+using SharedEF;
+
+namespace Model2Entities;
+
+public partial class DbDataManager
+{
+ public class ActivityRepository : IActivityRepository
+ {
+ private readonly DbDataManager _dataManager;
+
+ public ActivityRepository(DbDataManager dataManager)
+ {
+ _dataManager = dataManager;
+ }
+
+ public async Task> GetItems(int index, int count, Enum? orderingProperty = null, bool descending = false)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task GetItemById(int id)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task UpdateItem(int oldItem, Activity newItem)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task AddItem(Activity item)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task DeleteItem(Activity item)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task GetNbItems()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Model2Entities/DbDataManager.cs b/src/Model2Entities/DbDataManager.cs
new file mode 100644
index 0000000..fbecaa2
--- /dev/null
+++ b/src/Model2Entities/DbDataManager.cs
@@ -0,0 +1,28 @@
+using DbContextLib;
+using SharedEF;
+
+namespace Model2Entities;
+
+public partial class DbDataManager: IDataManager
+{
+ public IActivityRepository ActivityRepo { get; }
+ public IUserRepository UserRepo { get; }
+
+ protected HeartTrackContext DbContext { get; }
+
+
+public DbDataManager(HeartTrackContext dbContext)
+ {
+ DbContext = dbContext;
+ ActivityRepo = new ActivityRepository(this);
+ UserRepo = new UserRepository(this);
+ }
+
+ public DbDataManager()
+ {
+ DbContext = new HeartTrackContext();
+ ActivityRepo = new ActivityRepository(this);
+ UserRepo= new UserRepository(this);
+ }
+
+}
diff --git a/src/Model2Entities/Model2Entities.csproj b/src/Model2Entities/Model2Entities.csproj
new file mode 100644
index 0000000..8380302
--- /dev/null
+++ b/src/Model2Entities/Model2Entities.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/src/Model2Entities/UserRepository.cs b/src/Model2Entities/UserRepository.cs
new file mode 100644
index 0000000..3acd0da
--- /dev/null
+++ b/src/Model2Entities/UserRepository.cs
@@ -0,0 +1,46 @@
+using SharedEF;
+
+namespace Model2Entities;
+
+public partial class DbDataManager
+{
+ public class UserRepository : IUserRepository
+ {
+ private readonly DbDataManager _dataManager;
+
+ public UserRepository(DbDataManager dataManager)
+ {
+ _dataManager = dataManager;
+ }
+
+ public async Task> GetItems(int index, int count, Enum? orderingProperty = null, bool descending = false)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task GetItemById(int id)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task UpdateItem(int oldItem, User newItem)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task AddItem(User item)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task DeleteItem(User item)
+ {
+ throw new NotImplementedException();
+ }
+
+ public async Task GetNbItems()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SharedEF/Activity.cs b/src/SharedEF/Activity.cs
new file mode 100644
index 0000000..14357fb
--- /dev/null
+++ b/src/SharedEF/Activity.cs
@@ -0,0 +1,6 @@
+namespace SharedEF;
+
+public class Activity
+{
+
+}
\ No newline at end of file
diff --git a/src/SharedEF/IActivityRepository.cs b/src/SharedEF/IActivityRepository.cs
new file mode 100644
index 0000000..0842f1b
--- /dev/null
+++ b/src/SharedEF/IActivityRepository.cs
@@ -0,0 +1,6 @@
+namespace SharedEF;
+
+public interface IActivityRepository : IGenericRepository
+{
+
+}
\ No newline at end of file
diff --git a/src/SharedEF/IDataManager.cs b/src/SharedEF/IDataManager.cs
new file mode 100644
index 0000000..a1d0e35
--- /dev/null
+++ b/src/SharedEF/IDataManager.cs
@@ -0,0 +1,7 @@
+namespace SharedEF;
+
+public interface IDataManager
+{
+ IUserRepository UserRepo { get; }
+ IActivityRepository ActivityRepo { get; }
+}
diff --git a/src/SharedEF/IGenericRepository.cs b/src/SharedEF/IGenericRepository.cs
new file mode 100644
index 0000000..8849c70
--- /dev/null
+++ b/src/SharedEF/IGenericRepository.cs
@@ -0,0 +1,12 @@
+namespace SharedEF;
+
+public interface IGenericRepository
+{
+ Task> GetItems(int index, int count, Enum? orderingProperty = null, bool descending = false);
+ Task GetItemById(int id);
+ Task UpdateItem(int oldItem, T newItem);
+ Task AddItem(T item);
+ Task DeleteItem(T item);
+ Task GetNbItems();
+
+}
\ No newline at end of file
diff --git a/src/SharedEF/IUserRepository.cs b/src/SharedEF/IUserRepository.cs
new file mode 100644
index 0000000..aacc5d2
--- /dev/null
+++ b/src/SharedEF/IUserRepository.cs
@@ -0,0 +1,6 @@
+namespace SharedEF;
+
+public interface IUserRepository: IGenericRepository
+{
+
+}
\ No newline at end of file
diff --git a/src/SharedEF/SharedEF.csproj b/src/SharedEF/SharedEF.csproj
new file mode 100644
index 0000000..3a63532
--- /dev/null
+++ b/src/SharedEF/SharedEF.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/src/SharedEF/User.cs b/src/SharedEF/User.cs
new file mode 100644
index 0000000..5e92f92
--- /dev/null
+++ b/src/SharedEF/User.cs
@@ -0,0 +1,6 @@
+namespace SharedEF;
+
+public class User
+{
+
+}
\ No newline at end of file
diff --git a/src/StubbedContextLib/ActivityStubbedContext.cs b/src/StubbedContextLib/ActivityStubbedContext.cs
index e5379f6..7506778 100644
--- a/src/StubbedContextLib/ActivityStubbedContext.cs
+++ b/src/StubbedContextLib/ActivityStubbedContext.cs
@@ -15,7 +15,7 @@ namespace StubbedContextLib
///
/// Represents a stubbed context for activities.
///
- public class ActivityStubbedContext : LibraryContext
+ public class ActivityStubbedContext : HeartTrackContext
{
///
/// Initializes a new instance of the class.
@@ -26,7 +26,7 @@ namespace StubbedContextLib
/// Initializes a new instance of the class with the specified options.
///
/// The options for the context.
- public ActivityStubbedContext(DbContextOptions options) : base(options) { }
+ public ActivityStubbedContext(DbContextOptions options) : base(options) { }
///
/// Configures the model for the activity context.
diff --git a/src/StubbedContextLib/AthleteStubbedContext.cs b/src/StubbedContextLib/AthleteStubbedContext.cs
index 24cbfaf..c7890bb 100644
--- a/src/StubbedContextLib/AthleteStubbedContext.cs
+++ b/src/StubbedContextLib/AthleteStubbedContext.cs
@@ -26,7 +26,7 @@ namespace StubbedContextLib
/// Initializes a new instance of the class with the specified options.
///
/// The options for the context.
- public AthleteStubbedContext(DbContextOptions options) : base(options) { }
+ public AthleteStubbedContext(DbContextOptions options) : base(options) { }
///
/// Configures the model for the athlete stubbed context.
@@ -35,13 +35,14 @@ namespace StubbedContextLib
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
-
+ var picture = System.Text.Encoding.UTF8.GetBytes(
+ "\"UklGRtwDAABXRUJQVlA4INADAAAwEACdASoqACoAAMASJZgCdMoSCz655ndU4XXAP2yXIge5neM/Qd6WCfO8evoj2S0A/p7+f0An85cBxlLDgPC8jO/0nsl/13/O8vvzj7Af8s/p3/H4FU6td4MCwq23z1H2uzoKIXaqJniPI/bRMf8qzv0Zp+HE1RCBw5WQ1j/JovdM1FS52+QcaAAA/v/+NxU4DpPk3+xQPW7tcmURSo9vC4qc+XMxNVBzEM5E8actDz98gmwTXgD62e9EmG/ervdd2ovFFSuxYppWl/wtaX3rkn0xrt8qOql/5I2jfLOnCU0kALLcW4F/wTjU10qsxZXW9fxauC6OPVRF28sc94V9ocmoSWy+sf6jW3vYkVOh+gE/RE0L6b2d3oFyHmkRJnfYwG8o3p6fv9pivNF5aopIBzFnjzwb/VqSq3/b+MWKFmjr8T1qe4/fITo2vBWEqDyogV3ZVGnDVi2DbiEFVSUr2eXTNZQ9V/D9QC/+vCR5TGyX9QOVBgtAYtm/ZTIwzPEYB9NrV1NeO1/sAz78u0tW59r0I+SO5Jgm3B9i1toRurzHv9EZJ9yZL8nafb/T1FaoPDkuJfM+iPs0j8xnS7TaU/gEK0wCxeDYRYtJx9j4hUQq7pAu/T2yWy0vjcUHki952ZNbXnXxB8m8pV5x9E1sfLj5MZEgpU2XV8RHrVvWniCjsf6vgxmR7+KtwIbMjahitUGtHet1WdL+8MmdL29iQJC37pDXirir1NibxKKhFYRuJ3xW9O0r9+Vnh8diqbBuXqDbYR/MSoHvscOCm2t95dN5WBdRUoD7YCG/ZHWc7Ypv/x/al4fkB2lZlYhVWHxjaoeF9jEPI0gAN5XsvUI6hbzEzWMsNW/1orkNOnlskalgmpI4B2rm4Gc7LNui+MuMBrpnBvLkbYX9exe9g8tu7wLt7ScOjDcL99oOyR89Mh9L8rd4+43+JQyR6tsIfcPJo6T6FxHf11d/MGayJi+SWct/uhvvua0oOh+zXNIaUzgoBmu1XULjkpuA0Ghzctf30jbY1AOM49qbMZRYS9A+0S1HrHPnwRvpQY/Sj4xKPn0gdpv/+iTbKJb8zkPC4/9af0Jvesa+GDG0/iw3TswenMhqlh7BM9MW5txpeblsByx4WnJ/oHv6cc0dmM7tsV36lYkCTUXEf/0eKlnfivnN0g1g+j/Lk9et/uoa6TFCW0HgwFOIVFumEYdT675PfuTrYO5o8ZrWEIHtv2Ctlrv9J3TrslD/iKEwtipGHtn0Vak8B9wLL+kz+CIQ/VG4KJpXjx88CeCC4XaGitEdjAAA\"");
modelBuilder.Entity().HasData(
- new AthleteEntity { IdAthlete = 1, Username = "Doe", LastName = "Doe", FirstName = "John", Email = "john.doe@example.com", Password = "password123", Sexe = "M", Length = 1.80, Weight = 75, DateOfBirth = new DateOnly(1990, 01, 01), IsCoach = true },
- new AthleteEntity { IdAthlete = 2, Username = "Smith", LastName = "Smith", FirstName = "Jane", Email = "jane.smith@exemple.com", Password = "secure456", Sexe = "F", Length = 1.65, Weight = 60, DateOfBirth = new DateOnly(1995, 01, 01), IsCoach = false, DataSourceId = 1 },
- new AthleteEntity { IdAthlete = 3, Username = "Martin", LastName = "Martin", FirstName = "Paul", Email = "paul.martin@example.com", Password = "super789", Sexe = "M", Length = 1.75, Weight = 68, DateOfBirth = new DateOnly(1992, 01, 01), IsCoach = true },
- new AthleteEntity { IdAthlete = 4, Username = "Brown", LastName = "Brown", FirstName = "Anna", Email = "anna.brown@example.com", Password = "test000", Sexe = "F", Length = 1.70, Weight = 58, DateOfBirth = new DateOnly(1993, 01, 01), IsCoach = false },
- new AthleteEntity { IdAthlete = 5, Username = "Lee", LastName = "Lee", FirstName = "Bruce", Email = "bruce.lee@example.com", Password = "hello321", Sexe = "M", Length = 2.0, Weight = 90, DateOfBirth = new DateOnly(1991, 01, 01), IsCoach = false, DataSourceId = 3 }
+ new AthleteEntity { IdAthlete = 1, Username = "Doe",ProfilPicture = picture, LastName = "Doe", FirstName = "John", Email = "john.doe@example.com", Password = "password123", Sexe = "M", Length = 1.80, Weight = 75, DateOfBirth = new DateOnly(1990, 01, 01), IsCoach = true },
+ new AthleteEntity { IdAthlete = 2, Username = "Smith",ProfilPicture = picture, LastName = "Smith", FirstName = "Jane", Email = "jane.smith@exemple.com", Password = "secure456", Sexe = "F", Length = 1.65, Weight = 60, DateOfBirth = new DateOnly(1995, 01, 01), IsCoach = false, DataSourceId = 1 },
+ new AthleteEntity { IdAthlete = 3, Username = "Martin",ProfilPicture = picture, LastName = "Martin", FirstName = "Paul", Email = "paul.martin@example.com", Password = "super789", Sexe = "M", Length = 1.75, Weight = 68, DateOfBirth = new DateOnly(1992, 01, 01), IsCoach = true },
+ new AthleteEntity { IdAthlete = 4, Username = "Brown",ProfilPicture = picture, LastName = "Brown", FirstName = "Anna", Email = "anna.brown@example.com", Password = "test000", Sexe = "F", Length = 1.70, Weight = 58, DateOfBirth = new DateOnly(1993, 01, 01), IsCoach = false },
+ new AthleteEntity { IdAthlete = 5, Username = "Lee", ProfilPicture = picture,LastName = "Lee", FirstName = "Bruce", Email = "bruce.lee@example.com", Password = "hello321", Sexe = "M", Length = 2.0, Weight = 90, DateOfBirth = new DateOnly(1991, 01, 01), IsCoach = false, DataSourceId = 3 }
);
}
}
diff --git a/src/StubbedContextLib/DataSourceStubbedContext.cs b/src/StubbedContextLib/DataSourceStubbedContext.cs
index a34a80a..734cc5b 100644
--- a/src/StubbedContextLib/DataSourceStubbedContext.cs
+++ b/src/StubbedContextLib/DataSourceStubbedContext.cs
@@ -26,7 +26,7 @@ namespace StubbedContextLib
/// Initializes a new instance of the class with the specified options.
///
/// The options for the context.
- public DataSourceStubbedContext(DbContextOptions options) : base(options) { }
+ public DataSourceStubbedContext(DbContextOptions options) : base(options) { }
///
/// Configures the model for the data source stubbed context.
diff --git a/src/StubbedContextLib/FriendshipStubbedContext.cs b/src/StubbedContextLib/FriendshipStubbedContext.cs
index 43eff80..70eb76f 100644
--- a/src/StubbedContextLib/FriendshipStubbedContext.cs
+++ b/src/StubbedContextLib/FriendshipStubbedContext.cs
@@ -26,7 +26,7 @@ namespace StubbedContextLib
/// Initializes a new instance of the class with the specified options.
///
/// The options for the context.
- public FriendshipStubbedContext(DbContextOptions options) : base(options) { }
+ public FriendshipStubbedContext(DbContextOptions options) : base(options) { }
///
/// Configures the model for the heart rate stubbed context.
diff --git a/src/StubbedContextLib/HeartRateStubbedContext.cs b/src/StubbedContextLib/HeartRateStubbedContext.cs
index 8441665..a80ca57 100644
--- a/src/StubbedContextLib/HeartRateStubbedContext.cs
+++ b/src/StubbedContextLib/HeartRateStubbedContext.cs
@@ -26,7 +26,7 @@ namespace StubbedContextLib
/// Initializes a new instance of the class with the specified options.
///
/// The options for the context.
- public HeartRateStubbedContext(DbContextOptions options) : base(options) { }
+ public HeartRateStubbedContext(DbContextOptions options) : base(options) { }
///
/// Configures the model for the heart rate stubbed context.
diff --git a/src/StubbedContextLib/Migrations/20240307081406_MyMigrations.Designer.cs b/src/StubbedContextLib/Migrations/20240307081406_MyMigrations.Designer.cs
deleted file mode 100644
index 82a4cb8..0000000
--- a/src/StubbedContextLib/Migrations/20240307081406_MyMigrations.Designer.cs
+++ /dev/null
@@ -1,977 +0,0 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using StubbedContextLib;
-
-#nullable disable
-
-namespace StubbedContextLib.Migrations
-{
- [DbContext(typeof(TrainingStubbedContext))]
- [Migration("20240307081406_MyMigrations")]
- partial class MyMigrations
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
-
- modelBuilder.Entity("AthleteEntityNotificationEntity", b =>
- {
- b.Property("NotificationsReceivedIdNotif")
- .HasColumnType("INTEGER");
-
- b.Property("ReceiversIdAthlete")
- .HasColumnType("INTEGER");
-
- b.HasKey("NotificationsReceivedIdNotif", "ReceiversIdAthlete");
-
- b.HasIndex("ReceiversIdAthlete");
-
- b.ToTable("AthleteEntityNotificationEntity");
- });
-
- modelBuilder.Entity("AthleteEntityTrainingEntity", b =>
- {
- b.Property("AthletesIdAthlete")
- .HasColumnType("INTEGER");
-
- b.Property("TrainingsAthleteIdTraining")
- .HasColumnType("INTEGER");
-
- b.HasKey("AthletesIdAthlete", "TrainingsAthleteIdTraining");
-
- b.HasIndex("TrainingsAthleteIdTraining");
-
- b.ToTable("AthleteEntityTrainingEntity");
- });
-
- modelBuilder.Entity("Entities.ActivityEntity", b =>
- {
- b.Property("IdActivity")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("AthleteId")
- .HasColumnType("INTEGER");
-
- b.Property("Average")
- .HasColumnType("REAL");
-
- b.Property("AverageTemperature")
- .HasColumnType("REAL");
-
- b.Property("DataSourceId")
- .HasColumnType("INTEGER");
-
- b.Property("Date")
- .HasColumnType("TEXT");
-
- b.Property("EffortFelt")
- .HasColumnType("INTEGER");
-
- b.Property("EndTime")
- .HasColumnType("TEXT");
-
- b.Property("HasAutoPause")
- .HasColumnType("INTEGER");
-
- b.Property("Maximum")
- .HasColumnType("INTEGER");
-
- b.Property("Minimum")
- .HasColumnType("INTEGER");
-
- b.Property("StandardDeviation")
- .HasColumnType("REAL");
-
- b.Property("StartTime")
- .HasColumnType("TEXT");
-
- b.Property("Type")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.Property("Variability")
- .HasColumnType("REAL");
-
- b.Property("Variance")
- .HasColumnType("REAL");
-
- b.HasKey("IdActivity");
-
- b.HasIndex("AthleteId");
-
- b.HasIndex("DataSourceId");
-
- b.ToTable("Activity");
-
- b.HasData(
- new
- {
- IdActivity = 1,
- AthleteId = 1,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 1,
- Date = new DateOnly(2023, 1, 10),
- EffortFelt = 5,
- EndTime = new TimeOnly(14, 0, 22),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(13, 0, 34),
- Type = "Running",
- Variability = 0.5f,
- Variance = 0.5f
- },
- new
- {
- IdActivity = 2,
- AthleteId = 2,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 2,
- Date = new DateOnly(2023, 1, 25),
- EffortFelt = 5,
- EndTime = new TimeOnly(14, 0, 22),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(13, 4, 34),
- Type = "Cycling",
- Variability = 0.5f,
- Variance = 0.5f
- },
- new
- {
- IdActivity = 3,
- AthleteId = 1,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 1,
- Date = new DateOnly(2023, 12, 10),
- EffortFelt = 5,
- EndTime = new TimeOnly(15, 2, 22),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(13, 30, 34),
- Type = "Swimming",
- Variability = 0.5f,
- Variance = 0.5f
- },
- new
- {
- IdActivity = 4,
- AthleteId = 5,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 3,
- Date = new DateOnly(2024, 1, 2),
- EffortFelt = 5,
- EndTime = new TimeOnly(16, 1, 55),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(15, 0, 0),
- Type = "Walking",
- Variability = 0.5f,
- Variance = 0.5f
- },
- new
- {
- IdActivity = 5,
- AthleteId = 4,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 4,
- Date = new DateOnly(2024, 1, 12),
- EffortFelt = 5,
- EndTime = new TimeOnly(9, 0, 22),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(7, 45, 34),
- Type = "Hiking",
- Variability = 0.5f,
- Variance = 0.5f
- },
- new
- {
- IdActivity = 6,
- AthleteId = 4,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 4,
- Date = new DateOnly(2024, 1, 27),
- EffortFelt = 5,
- EndTime = new TimeOnly(14, 0, 22),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(13, 30, 1),
- Type = "Climbing",
- Variability = 0.5f,
- Variance = 0.5f
- },
- new
- {
- IdActivity = 7,
- AthleteId = 3,
- Average = 0.5f,
- AverageTemperature = 20f,
- DataSourceId = 5,
- Date = new DateOnly(2024, 2, 22),
- EffortFelt = 5,
- EndTime = new TimeOnly(23, 50, 58),
- HasAutoPause = false,
- Maximum = 0,
- Minimum = 0,
- StandardDeviation = 0.5f,
- StartTime = new TimeOnly(22, 0, 34),
- Type = "Yoga",
- Variability = 0.5f,
- Variance = 0.5f
- });
- });
-
- modelBuilder.Entity("Entities.AthleteEntity", b =>
- {
- b.Property("IdAthlete")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("DataSourceId")
- .HasColumnType("INTEGER");
-
- b.Property("DateOfBirth")
- .HasColumnType("TEXT");
-
- b.Property("Email")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.Property("FirstName")
- .IsRequired()
- .HasMaxLength(150)
- .HasColumnType("TEXT");
-
- b.Property("IsCoach")
- .HasColumnType("INTEGER");
-
- b.Property("LastName")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.Property("Length")
- .HasColumnType("REAL");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Sexe")
- .IsRequired()
- .HasMaxLength(1)
- .HasColumnType("TEXT");
-
- b.Property("Username")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.Property("Weight")
- .HasColumnType("REAL");
-
- b.HasKey("IdAthlete");
-
- b.HasIndex("DataSourceId");
-
- b.ToTable("Athlete");
-
- b.HasData(
- new
- {
- IdAthlete = 1,
- DateOfBirth = new DateOnly(1990, 1, 1),
- Email = "john.doe@example.com",
- FirstName = "John",
- IsCoach = true,
- LastName = "Doe",
- Length = 1.8,
- Password = "password123",
- Sexe = "M",
- Username = "Doe",
- Weight = 75f
- },
- new
- {
- IdAthlete = 2,
- DataSourceId = 1,
- DateOfBirth = new DateOnly(1995, 1, 1),
- Email = "jane.smith@exemple.com",
- FirstName = "Jane",
- IsCoach = false,
- LastName = "Smith",
- Length = 1.6499999999999999,
- Password = "secure456",
- Sexe = "F",
- Username = "Smith",
- Weight = 60f
- },
- new
- {
- IdAthlete = 3,
- DateOfBirth = new DateOnly(1992, 1, 1),
- Email = "paul.martin@example.com",
- FirstName = "Paul",
- IsCoach = true,
- LastName = "Martin",
- Length = 1.75,
- Password = "super789",
- Sexe = "M",
- Username = "Martin",
- Weight = 68f
- },
- new
- {
- IdAthlete = 4,
- DateOfBirth = new DateOnly(1993, 1, 1),
- Email = "anna.brown@example.com",
- FirstName = "Anna",
- IsCoach = false,
- LastName = "Brown",
- Length = 1.7,
- Password = "test000",
- Sexe = "F",
- Username = "Brown",
- Weight = 58f
- },
- new
- {
- IdAthlete = 5,
- DataSourceId = 3,
- DateOfBirth = new DateOnly(1991, 1, 1),
- Email = "bruce.lee@example.com",
- FirstName = "Bruce",
- IsCoach = false,
- LastName = "Lee",
- Length = 2.0,
- Password = "hello321",
- Sexe = "M",
- Username = "Lee",
- Weight = 90f
- });
- });
-
- modelBuilder.Entity("Entities.DataSourceEntity", b =>
- {
- b.Property("IdSource")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("Model")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.Property("Precision")
- .HasColumnType("REAL");
-
- b.Property("Type")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.HasKey("IdSource");
-
- b.ToTable("DataSource");
-
- b.HasData(
- new
- {
- IdSource = 1,
- Model = "Garmin",
- Precision = 0.5f,
- Type = "Smartwatch"
- },
- new
- {
- IdSource = 2,
- Model = "Polar",
- Precision = 0.5f,
- Type = "Smartwatch"
- },
- new
- {
- IdSource = 3,
- Model = "Suunto",
- Precision = 0.5f,
- Type = "Smartwatch"
- },
- new
- {
- IdSource = 4,
- Model = "Fitbit",
- Precision = 0.5f,
- Type = "Smartwatch"
- },
- new
- {
- IdSource = 5,
- Model = "Apple Watch",
- Precision = 0.5f,
- Type = "Smartwatch"
- });
- });
-
- modelBuilder.Entity("Entities.FriendshipEntity", b =>
- {
- b.Property("FollowingId")
- .HasColumnType("INTEGER");
-
- b.Property("FollowerId")
- .HasColumnType("INTEGER");
-
- b.Property("StartDate")
- .HasColumnType("TEXT");
-
- b.HasKey("FollowingId", "FollowerId");
-
- b.HasIndex("FollowerId");
-
- b.ToTable("FriendshipEntity");
-
- b.HasData(
- new
- {
- FollowingId = 2,
- FollowerId = 1,
- StartDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
- },
- new
- {
- FollowingId = 3,
- FollowerId = 1,
- StartDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
- },
- new
- {
- FollowingId = 4,
- FollowerId = 1,
- StartDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
- },
- new
- {
- FollowingId = 5,
- FollowerId = 1,
- StartDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
- },
- new
- {
- FollowingId = 1,
- FollowerId = 2,
- StartDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
- },
- new
- {
- FollowingId = 3,
- FollowerId = 2,
- StartDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
- });
- });
-
- modelBuilder.Entity("Entities.HeartRateEntity", b =>
- {
- b.Property("IdHeartRate")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("ActivityId")
- .HasColumnType("INTEGER");
-
- b.Property("Altitude")
- .HasColumnType("REAL");
-
- b.Property("Bpm")
- .HasColumnType("INTEGER");
-
- b.Property("Latitude")
- .HasColumnType("REAL");
-
- b.Property("Longitude")
- .HasColumnType("REAL");
-
- b.Property("Temperature")
- .HasColumnType("REAL");
-
- b.Property("Time")
- .HasColumnType("TEXT");
-
- b.HasKey("IdHeartRate");
-
- b.HasIndex("ActivityId");
-
- b.ToTable("HeartRate");
-
- b.HasData(
- new
- {
- IdHeartRate = 1,
- ActivityId = 1,
- Altitude = 0.0,
- Bpm = 60,
- Latitude = 66f,
- Longitude = 35f,
- Temperature = 20f,
- Time = new TimeOnly(13, 0, 30)
- },
- new
- {
- IdHeartRate = 2,
- ActivityId = 2,
- Altitude = 10.0,
- Bpm = 65,
- Latitude = 67f,
- Longitude = 35f,
- Temperature = 20.5f,
- Time = new TimeOnly(13, 0, 31)
- },
- new
- {
- IdHeartRate = 3,
- ActivityId = 1,
- Altitude = 11.0,
- Bpm = 71,
- Latitude = 66f,
- Longitude = 36f,
- Temperature = 20f,
- Time = new TimeOnly(13, 0, 32)
- },
- new
- {
- IdHeartRate = 4,
- ActivityId = 2,
- Altitude = 12.0,
- Bpm = 75,
- Latitude = 67f,
- Longitude = 36f,
- Temperature = 20.5f,
- Time = new TimeOnly(13, 0, 33)
- },
- new
- {
- IdHeartRate = 5,
- ActivityId = 4,
- Altitude = 13.0,
- Bpm = 80,
- Latitude = 66f,
- Longitude = 37f,
- Temperature = 20f,
- Time = new TimeOnly(13, 0, 34)
- });
- });
-
- modelBuilder.Entity("Entities.NotificationEntity", b =>
- {
- b.Property("IdNotif")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("Date")
- .HasColumnType("TEXT");
-
- b.Property("Message")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.Property("SenderId")
- .HasColumnType("INTEGER");
-
- b.Property("Statut")
- .HasColumnType("INTEGER");
-
- b.Property("Urgence")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("TEXT");
-
- b.HasKey("IdNotif");
-
- b.HasIndex("SenderId");
-
- b.ToTable("Notification");
-
- b.HasData(
- new
- {
- IdNotif = 1,
- Date = new DateTime(2023, 12, 25, 13, 0, 40, 0, DateTimeKind.Unspecified),
- Message = "You have a new activity to check",
- SenderId = 1,
- Statut = true,
- Urgence = "A"
- },
- new
- {
- IdNotif = 2,
- Date = new DateTime(2023, 12, 26, 13, 10, 40, 0, DateTimeKind.Unspecified),
- Message = "You have a new athlete to check",
- SenderId = 2,
- Statut = false,
- Urgence = "3"
- },
- new
- {
- IdNotif = 3,
- Date = new DateTime(2023, 12, 26, 16, 10, 4, 0, DateTimeKind.Unspecified),
- Message = "You have a new heart rate to check",
- SenderId = 3,
- Statut = true,
- Urgence = "2"
- },
- new
- {
- IdNotif = 4,
- Date = new DateTime(2024, 1, 12, 9, 30, 50, 0, DateTimeKind.Unspecified),
- Message = "You have a new data source to check",
- SenderId = 4,
- Statut = false,
- Urgence = "1"
- },
- new
- {
- IdNotif = 5,
- Date = new DateTime(2024, 2, 22, 12, 10, 0, 0, DateTimeKind.Unspecified),
- Message = "You have a new notification to check",
- SenderId = 5,
- Statut = true,
- Urgence = "3"
- });
- });
-
- modelBuilder.Entity("Entities.StatisticEntity", b =>
- {
- b.Property("IdStatistic")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("AthleteId")
- .HasColumnType("INTEGER");
-
- b.Property("AverageCaloriesBurned")
- .HasColumnType("REAL");
-
- b.Property("AverageHeartRate")
- .HasColumnType("REAL");
-
- b.Property("Date")
- .HasColumnType("TEXT");
-
- b.Property("MaximumHeartRate")
- .HasColumnType("REAL");
-
- b.Property("Weight")
- .HasColumnType("REAL");
-
- b.HasKey("IdStatistic");
-
- b.HasIndex("AthleteId");
-
- b.ToTable("Statistic");
-
- b.HasData(
- new
- {
- IdStatistic = 1,
- AthleteId = 1,
- AverageCaloriesBurned = 500.0,
- AverageHeartRate = 120.0,
- Date = new DateOnly(2021, 12, 12),
- MaximumHeartRate = 180.0,
- Weight = 75f
- },
- new
- {
- IdStatistic = 2,
- AthleteId = 2,
- AverageCaloriesBurned = 600.0,
- AverageHeartRate = 130.0,
- Date = new DateOnly(2021, 1, 11),
- MaximumHeartRate = 190.0,
- Weight = 60f
- },
- new
- {
- IdStatistic = 3,
- AthleteId = 1,
- AverageCaloriesBurned = 550.0,
- AverageHeartRate = 125.0,
- Date = new DateOnly(2022, 12, 30),
- MaximumHeartRate = 185.0,
- Weight = 68f
- },
- new
- {
- IdStatistic = 4,
- AthleteId = 3,
- AverageCaloriesBurned = 650.0,
- AverageHeartRate = 135.0,
- Date = new DateOnly(2023, 2, 20),
- MaximumHeartRate = 195.0,
- Weight = 58f
- },
- new
- {
- IdStatistic = 5,
- AthleteId = 4,
- AverageCaloriesBurned = 450.0,
- AverageHeartRate = 110.0,
- Date = new DateOnly(2024, 1, 10),
- MaximumHeartRate = 170.0,
- Weight = 90f
- });
- });
-
- modelBuilder.Entity("Entities.TrainingEntity", b =>
- {
- b.Property("IdTraining")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("CoachId")
- .HasColumnType("INTEGER");
-
- b.Property("Date")
- .HasColumnType("TEXT");
-
- b.Property("Description")
- .HasMaxLength(300)
- .HasColumnType("TEXT");
-
- b.Property("FeedBack")
- .HasMaxLength(300)
- .HasColumnType("TEXT");
-
- b.Property("Latitude")
- .HasColumnType("REAL");
-
- b.Property("Longitude")
- .HasColumnType("REAL");
-
- b.HasKey("IdTraining");
-
- b.HasIndex("CoachId");
-
- b.ToTable("Training");
-
- b.HasData(
- new
- {
- IdTraining = 1,
- CoachId = 1,
- Date = new DateOnly(2024, 1, 19),
- Description = "Running",
- FeedBack = "Good",
- Latitude = 48.8566f,
- Longitude = 2.3522f
- },
- new
- {
- IdTraining = 2,
- CoachId = 5,
- Date = new DateOnly(2024, 2, 20),
- Description = "Cycling",
- Latitude = 48.8566f,
- Longitude = 2.3522f
- },
- new
- {
- IdTraining = 3,
- CoachId = 4,
- Date = new DateOnly(2024, 2, 21),
- FeedBack = "Good",
- Latitude = 48.8566f,
- Longitude = 2.3522f
- },
- new
- {
- IdTraining = 4,
- CoachId = 3,
- Date = new DateOnly(2024, 2, 22),
- Description = "Running",
- FeedBack = "Good",
- Latitude = 48.8566f,
- Longitude = 2.3522f
- },
- new
- {
- IdTraining = 5,
- CoachId = 1,
- Date = new DateOnly(2024, 2, 23),
- Description = "Cycling",
- Latitude = 48.8566f,
- Longitude = 2.3522f
- });
- });
-
- modelBuilder.Entity("AthleteEntityNotificationEntity", b =>
- {
- b.HasOne("Entities.NotificationEntity", null)
- .WithMany()
- .HasForeignKey("NotificationsReceivedIdNotif")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("Entities.AthleteEntity", null)
- .WithMany()
- .HasForeignKey("ReceiversIdAthlete")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("AthleteEntityTrainingEntity", b =>
- {
- b.HasOne("Entities.AthleteEntity", null)
- .WithMany()
- .HasForeignKey("AthletesIdAthlete")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("Entities.TrainingEntity", null)
- .WithMany()
- .HasForeignKey("TrainingsAthleteIdTraining")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Entities.ActivityEntity", b =>
- {
- b.HasOne("Entities.AthleteEntity", "Athlete")
- .WithMany("Activities")
- .HasForeignKey("AthleteId");
-
- b.HasOne("Entities.DataSourceEntity", "DataSource")
- .WithMany("Activities")
- .HasForeignKey("DataSourceId");
-
- b.Navigation("Athlete");
-
- b.Navigation("DataSource");
- });
-
- modelBuilder.Entity("Entities.AthleteEntity", b =>
- {
- b.HasOne("Entities.DataSourceEntity", "DataSource")
- .WithMany("Athletes")
- .HasForeignKey("DataSourceId");
-
- b.Navigation("DataSource");
- });
-
- modelBuilder.Entity("Entities.FriendshipEntity", b =>
- {
- b.HasOne("Entities.AthleteEntity", "Follower")
- .WithMany("Followers")
- .HasForeignKey("FollowerId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("Entities.AthleteEntity", "Following")
- .WithMany("Followings")
- .HasForeignKey("FollowingId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Follower");
-
- b.Navigation("Following");
- });
-
- modelBuilder.Entity("Entities.HeartRateEntity", b =>
- {
- b.HasOne("Entities.ActivityEntity", "Activity")
- .WithMany("HeartRates")
- .HasForeignKey("ActivityId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Activity");
- });
-
- modelBuilder.Entity("Entities.NotificationEntity", b =>
- {
- b.HasOne("Entities.AthleteEntity", "Sender")
- .WithMany("NotificationsSent")
- .HasForeignKey("SenderId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Sender");
- });
-
- modelBuilder.Entity("Entities.StatisticEntity", b =>
- {
- b.HasOne("Entities.AthleteEntity", "Athlete")
- .WithMany("Statistics")
- .HasForeignKey("AthleteId");
-
- b.Navigation("Athlete");
- });
-
- modelBuilder.Entity("Entities.TrainingEntity", b =>
- {
- b.HasOne("Entities.AthleteEntity", "Coach")
- .WithMany("TrainingsCoach")
- .HasForeignKey("CoachId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Coach");
- });
-
- modelBuilder.Entity("Entities.ActivityEntity", b =>
- {
- b.Navigation("HeartRates");
- });
-
- modelBuilder.Entity("Entities.AthleteEntity", b =>
- {
- b.Navigation("Activities");
-
- b.Navigation("Followers");
-
- b.Navigation("Followings");
-
- b.Navigation("NotificationsSent");
-
- b.Navigation("Statistics");
-
- b.Navigation("TrainingsCoach");
- });
-
- modelBuilder.Entity("Entities.DataSourceEntity", b =>
- {
- b.Navigation("Activities");
-
- b.Navigation("Athletes");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/StubbedContextLib/Migrations/20240307081406_MyMigrations.cs b/src/StubbedContextLib/Migrations/20240307081406_MyMigrations.cs
deleted file mode 100644
index c4ebbca..0000000
--- a/src/StubbedContextLib/Migrations/20240307081406_MyMigrations.cs
+++ /dev/null
@@ -1,491 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
-
-namespace StubbedContextLib.Migrations
-{
- ///
- public partial class MyMigrations : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "DataSource",
- columns: table => new
- {
- IdSource = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Type = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- Model = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- Precision = table.Column(type: "REAL", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_DataSource", x => x.IdSource);
- });
-
- migrationBuilder.CreateTable(
- name: "Athlete",
- columns: table => new
- {
- IdAthlete = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Username = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- LastName = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- FirstName = table.Column(type: "TEXT", maxLength: 150, nullable: false),
- Email = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- Sexe = table.Column(type: "TEXT", maxLength: 1, nullable: false),
- Length = table.Column(type: "REAL", nullable: false),
- Weight = table.Column(type: "REAL", nullable: false),
- Password = table.Column(type: "TEXT", nullable: false),
- DateOfBirth = table.Column(type: "TEXT", nullable: false),
- IsCoach = table.Column(type: "INTEGER", nullable: false),
- DataSourceId = table.Column(type: "INTEGER", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Athlete", x => x.IdAthlete);
- table.ForeignKey(
- name: "FK_Athlete_DataSource_DataSourceId",
- column: x => x.DataSourceId,
- principalTable: "DataSource",
- principalColumn: "IdSource");
- });
-
- migrationBuilder.CreateTable(
- name: "Activity",
- columns: table => new
- {
- IdActivity = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Type = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- Date = table.Column(type: "TEXT", nullable: false),
- StartTime = table.Column(type: "TEXT", nullable: false),
- EndTime = table.Column(type: "TEXT", nullable: false),
- EffortFelt = table.Column(type: "INTEGER", nullable: false),
- Variability = table.Column(type: "REAL", nullable: false),
- Variance = table.Column(type: "REAL", nullable: false),
- StandardDeviation = table.Column(type: "REAL", nullable: false),
- Average = table.Column(type: "REAL", nullable: false),
- Maximum = table.Column(type: "INTEGER", nullable: false),
- Minimum = table.Column(type: "INTEGER", nullable: false),
- AverageTemperature = table.Column(type: "REAL", nullable: false),
- HasAutoPause = table.Column(type: "INTEGER", nullable: false),
- DataSourceId = table.Column(type: "INTEGER", nullable: false),
- AthleteId = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Activity", x => x.IdActivity);
- table.ForeignKey(
- name: "FK_Activity_Athlete_AthleteId",
- column: x => x.AthleteId,
- principalTable: "Athlete",
- principalColumn: "IdAthlete");
- table.ForeignKey(
- name: "FK_Activity_DataSource_DataSourceId",
- column: x => x.DataSourceId,
- principalTable: "DataSource",
- principalColumn: "IdSource");
- });
-
- migrationBuilder.CreateTable(
- name: "FriendshipEntity",
- columns: table => new
- {
- FollowingId = table.Column(type: "INTEGER", nullable: false),
- FollowerId = table.Column(type: "INTEGER", nullable: false),
- StartDate = table.Column(type: "TEXT", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_FriendshipEntity", x => new { x.FollowingId, x.FollowerId });
- table.ForeignKey(
- name: "FK_FriendshipEntity_Athlete_FollowerId",
- column: x => x.FollowerId,
- principalTable: "Athlete",
- principalColumn: "IdAthlete",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_FriendshipEntity_Athlete_FollowingId",
- column: x => x.FollowingId,
- principalTable: "Athlete",
- principalColumn: "IdAthlete",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Notification",
- columns: table => new
- {
- IdNotif = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Message = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- Date = table.Column(type: "TEXT", nullable: false),
- Statut = table.Column(type: "INTEGER", nullable: false),
- Urgence = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- SenderId = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Notification", x => x.IdNotif);
- table.ForeignKey(
- name: "FK_Notification_Athlete_SenderId",
- column: x => x.SenderId,
- principalTable: "Athlete",
- principalColumn: "IdAthlete",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Statistic",
- columns: table => new
- {
- IdStatistic = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Weight = table.Column(type: "REAL", nullable: false),
- AverageHeartRate = table.Column(type: "REAL", nullable: false),
- MaximumHeartRate = table.Column(type: "REAL", nullable: false),
- AverageCaloriesBurned = table.Column(type: "REAL", nullable: false),
- Date = table.Column(type: "TEXT", nullable: false),
- AthleteId = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Statistic", x => x.IdStatistic);
- table.ForeignKey(
- name: "FK_Statistic_Athlete_AthleteId",
- column: x => x.AthleteId,
- principalTable: "Athlete",
- principalColumn: "IdAthlete");
- });
-
- migrationBuilder.CreateTable(
- name: "Training",
- columns: table => new
- {
- IdTraining = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Date = table.Column(type: "TEXT", nullable: false),
- Description = table.Column(type: "TEXT", maxLength: 300, nullable: true),
- Latitude = table.Column(type: "REAL", nullable: false),
- Longitude = table.Column(type: "REAL", nullable: false),
- FeedBack = table.Column(type: "TEXT", maxLength: 300, nullable: true),
- CoachId = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Training", x => x.IdTraining);
- table.ForeignKey(
- name: "FK_Training_Athlete_CoachId",
- column: x => x.CoachId,
- principalTable: "Athlete",
- principalColumn: "IdAthlete",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "HeartRate",
- columns: table => new
- {
- IdHeartRate = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Altitude = table.Column(type: "REAL", nullable: false),
- Time = table.Column(type: "TEXT", nullable: false),
- Temperature = table.Column(type: "REAL", nullable: false),
- Bpm = table.Column(type: "INTEGER", nullable: false),
- Longitude = table.Column(type: "REAL", nullable: false),
- Latitude = table.Column(type: "REAL", nullable: false),
- ActivityId = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_HeartRate", x => x.IdHeartRate);
- table.ForeignKey(
- name: "FK_HeartRate_Activity_ActivityId",
- column: x => x.ActivityId,
- principalTable: "Activity",
- principalColumn: "IdActivity",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AthleteEntityNotificationEntity",
- columns: table => new
- {
- NotificationsReceivedIdNotif = table.Column(type: "INTEGER", nullable: false),
- ReceiversIdAthlete = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AthleteEntityNotificationEntity", x => new { x.NotificationsReceivedIdNotif, x.ReceiversIdAthlete });
- table.ForeignKey(
- name: "FK_AthleteEntityNotificationEntity_Athlete_ReceiversIdAthlete",
- column: x => x.ReceiversIdAthlete,
- principalTable: "Athlete",
- principalColumn: "IdAthlete",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AthleteEntityNotificationEntity_Notification_NotificationsReceivedIdNotif",
- column: x => x.NotificationsReceivedIdNotif,
- principalTable: "Notification",
- principalColumn: "IdNotif",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AthleteEntityTrainingEntity",
- columns: table => new
- {
- AthletesIdAthlete = table.Column(type: "INTEGER", nullable: false),
- TrainingsAthleteIdTraining = table.Column(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AthleteEntityTrainingEntity", x => new { x.AthletesIdAthlete, x.TrainingsAthleteIdTraining });
- table.ForeignKey(
- name: "FK_AthleteEntityTrainingEntity_Athlete_AthletesIdAthlete",
- column: x => x.AthletesIdAthlete,
- principalTable: "Athlete",
- principalColumn: "IdAthlete",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AthleteEntityTrainingEntity_Training_TrainingsAthleteIdTraining",
- column: x => x.TrainingsAthleteIdTraining,
- principalTable: "Training",
- principalColumn: "IdTraining",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.InsertData(
- table: "Athlete",
- columns: new[] { "IdAthlete", "DataSourceId", "DateOfBirth", "Email", "FirstName", "IsCoach", "LastName", "Length", "Password", "Sexe", "Username", "Weight" },
- values: new object[,]
- {
- { 1, null, new DateOnly(1990, 1, 1), "john.doe@example.com", "John", true, "Doe", 1.8, "password123", "M", "Doe", 75f },
- { 3, null, new DateOnly(1992, 1, 1), "paul.martin@example.com", "Paul", true, "Martin", 1.75, "super789", "M", "Martin", 68f },
- { 4, null, new DateOnly(1993, 1, 1), "anna.brown@example.com", "Anna", false, "Brown", 1.7, "test000", "F", "Brown", 58f }
- });
-
- migrationBuilder.InsertData(
- table: "DataSource",
- columns: new[] { "IdSource", "Model", "Precision", "Type" },
- values: new object[,]
- {
- { 1, "Garmin", 0.5f, "Smartwatch" },
- { 2, "Polar", 0.5f, "Smartwatch" },
- { 3, "Suunto", 0.5f, "Smartwatch" },
- { 4, "Fitbit", 0.5f, "Smartwatch" },
- { 5, "Apple Watch", 0.5f, "Smartwatch" }
- });
-
- migrationBuilder.InsertData(
- table: "Activity",
- columns: new[] { "IdActivity", "AthleteId", "Average", "AverageTemperature", "DataSourceId", "Date", "EffortFelt", "EndTime", "HasAutoPause", "Maximum", "Minimum", "StandardDeviation", "StartTime", "Type", "Variability", "Variance" },
- values: new object[,]
- {
- { 1, 1, 0.5f, 20f, 1, new DateOnly(2023, 1, 10), 5, new TimeOnly(14, 0, 22), false, 0, 0, 0.5f, new TimeOnly(13, 0, 34), "Running", 0.5f, 0.5f },
- { 3, 1, 0.5f, 20f, 1, new DateOnly(2023, 12, 10), 5, new TimeOnly(15, 2, 22), false, 0, 0, 0.5f, new TimeOnly(13, 30, 34), "Swimming", 0.5f, 0.5f },
- { 5, 4, 0.5f, 20f, 4, new DateOnly(2024, 1, 12), 5, new TimeOnly(9, 0, 22), false, 0, 0, 0.5f, new TimeOnly(7, 45, 34), "Hiking", 0.5f, 0.5f },
- { 6, 4, 0.5f, 20f, 4, new DateOnly(2024, 1, 27), 5, new TimeOnly(14, 0, 22), false, 0, 0, 0.5f, new TimeOnly(13, 30, 1), "Climbing", 0.5f, 0.5f },
- { 7, 3, 0.5f, 20f, 5, new DateOnly(2024, 2, 22), 5, new TimeOnly(23, 50, 58), false, 0, 0, 0.5f, new TimeOnly(22, 0, 34), "Yoga", 0.5f, 0.5f }
- });
-
- migrationBuilder.InsertData(
- table: "Athlete",
- columns: new[] { "IdAthlete", "DataSourceId", "DateOfBirth", "Email", "FirstName", "IsCoach", "LastName", "Length", "Password", "Sexe", "Username", "Weight" },
- values: new object[,]
- {
- { 2, 1, new DateOnly(1995, 1, 1), "jane.smith@exemple.com", "Jane", false, "Smith", 1.6499999999999999, "secure456", "F", "Smith", 60f },
- { 5, 3, new DateOnly(1991, 1, 1), "bruce.lee@example.com", "Bruce", false, "Lee", 2.0, "hello321", "M", "Lee", 90f }
- });
-
- migrationBuilder.InsertData(
- table: "FriendshipEntity",
- columns: new[] { "FollowerId", "FollowingId", "StartDate" },
- values: new object[,]
- {
- { 1, 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
- { 1, 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }
- });
-
- migrationBuilder.InsertData(
- table: "Notification",
- columns: new[] { "IdNotif", "Date", "Message", "SenderId", "Statut", "Urgence" },
- values: new object[,]
- {
- { 1, new DateTime(2023, 12, 25, 13, 0, 40, 0, DateTimeKind.Unspecified), "You have a new activity to check", 1, true, "A" },
- { 3, new DateTime(2023, 12, 26, 16, 10, 4, 0, DateTimeKind.Unspecified), "You have a new heart rate to check", 3, true, "2" },
- { 4, new DateTime(2024, 1, 12, 9, 30, 50, 0, DateTimeKind.Unspecified), "You have a new data source to check", 4, false, "1" }
- });
-
- migrationBuilder.InsertData(
- table: "Statistic",
- columns: new[] { "IdStatistic", "AthleteId", "AverageCaloriesBurned", "AverageHeartRate", "Date", "MaximumHeartRate", "Weight" },
- values: new object[,]
- {
- { 1, 1, 500.0, 120.0, new DateOnly(2021, 12, 12), 180.0, 75f },
- { 3, 1, 550.0, 125.0, new DateOnly(2022, 12, 30), 185.0, 68f },
- { 4, 3, 650.0, 135.0, new DateOnly(2023, 2, 20), 195.0, 58f },
- { 5, 4, 450.0, 110.0, new DateOnly(2024, 1, 10), 170.0, 90f }
- });
-
- migrationBuilder.InsertData(
- table: "Training",
- columns: new[] { "IdTraining", "CoachId", "Date", "Description", "FeedBack", "Latitude", "Longitude" },
- values: new object[,]
- {
- { 1, 1, new DateOnly(2024, 1, 19), "Running", "Good", 48.8566f, 2.3522f },
- { 3, 4, new DateOnly(2024, 2, 21), null, "Good", 48.8566f, 2.3522f },
- { 4, 3, new DateOnly(2024, 2, 22), "Running", "Good", 48.8566f, 2.3522f },
- { 5, 1, new DateOnly(2024, 2, 23), "Cycling", null, 48.8566f, 2.3522f }
- });
-
- migrationBuilder.InsertData(
- table: "Activity",
- columns: new[] { "IdActivity", "AthleteId", "Average", "AverageTemperature", "DataSourceId", "Date", "EffortFelt", "EndTime", "HasAutoPause", "Maximum", "Minimum", "StandardDeviation", "StartTime", "Type", "Variability", "Variance" },
- values: new object[,]
- {
- { 2, 2, 0.5f, 20f, 2, new DateOnly(2023, 1, 25), 5, new TimeOnly(14, 0, 22), false, 0, 0, 0.5f, new TimeOnly(13, 4, 34), "Cycling", 0.5f, 0.5f },
- { 4, 5, 0.5f, 20f, 3, new DateOnly(2024, 1, 2), 5, new TimeOnly(16, 1, 55), false, 0, 0, 0.5f, new TimeOnly(15, 0, 0), "Walking", 0.5f, 0.5f }
- });
-
- migrationBuilder.InsertData(
- table: "FriendshipEntity",
- columns: new[] { "FollowerId", "FollowingId", "StartDate" },
- values: new object[,]
- {
- { 2, 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
- { 1, 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
- { 2, 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
- { 1, 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }
- });
-
- migrationBuilder.InsertData(
- table: "HeartRate",
- columns: new[] { "IdHeartRate", "ActivityId", "Altitude", "Bpm", "Latitude", "Longitude", "Temperature", "Time" },
- values: new object[,]
- {
- { 1, 1, 0.0, 60, 66f, 35f, 20f, new TimeOnly(13, 0, 30) },
- { 3, 1, 11.0, 71, 66f, 36f, 20f, new TimeOnly(13, 0, 32) }
- });
-
- migrationBuilder.InsertData(
- table: "Notification",
- columns: new[] { "IdNotif", "Date", "Message", "SenderId", "Statut", "Urgence" },
- values: new object[,]
- {
- { 2, new DateTime(2023, 12, 26, 13, 10, 40, 0, DateTimeKind.Unspecified), "You have a new athlete to check", 2, false, "3" },
- { 5, new DateTime(2024, 2, 22, 12, 10, 0, 0, DateTimeKind.Unspecified), "You have a new notification to check", 5, true, "3" }
- });
-
- migrationBuilder.InsertData(
- table: "Statistic",
- columns: new[] { "IdStatistic", "AthleteId", "AverageCaloriesBurned", "AverageHeartRate", "Date", "MaximumHeartRate", "Weight" },
- values: new object[] { 2, 2, 600.0, 130.0, new DateOnly(2021, 1, 11), 190.0, 60f });
-
- migrationBuilder.InsertData(
- table: "Training",
- columns: new[] { "IdTraining", "CoachId", "Date", "Description", "FeedBack", "Latitude", "Longitude" },
- values: new object[] { 2, 5, new DateOnly(2024, 2, 20), "Cycling", null, 48.8566f, 2.3522f });
-
- migrationBuilder.InsertData(
- table: "HeartRate",
- columns: new[] { "IdHeartRate", "ActivityId", "Altitude", "Bpm", "Latitude", "Longitude", "Temperature", "Time" },
- values: new object[,]
- {
- { 2, 2, 10.0, 65, 67f, 35f, 20.5f, new TimeOnly(13, 0, 31) },
- { 4, 2, 12.0, 75, 67f, 36f, 20.5f, new TimeOnly(13, 0, 33) },
- { 5, 4, 13.0, 80, 66f, 37f, 20f, new TimeOnly(13, 0, 34) }
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_Activity_AthleteId",
- table: "Activity",
- column: "AthleteId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Activity_DataSourceId",
- table: "Activity",
- column: "DataSourceId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Athlete_DataSourceId",
- table: "Athlete",
- column: "DataSourceId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AthleteEntityNotificationEntity_ReceiversIdAthlete",
- table: "AthleteEntityNotificationEntity",
- column: "ReceiversIdAthlete");
-
- migrationBuilder.CreateIndex(
- name: "IX_AthleteEntityTrainingEntity_TrainingsAthleteIdTraining",
- table: "AthleteEntityTrainingEntity",
- column: "TrainingsAthleteIdTraining");
-
- migrationBuilder.CreateIndex(
- name: "IX_FriendshipEntity_FollowerId",
- table: "FriendshipEntity",
- column: "FollowerId");
-
- migrationBuilder.CreateIndex(
- name: "IX_HeartRate_ActivityId",
- table: "HeartRate",
- column: "ActivityId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Notification_SenderId",
- table: "Notification",
- column: "SenderId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Statistic_AthleteId",
- table: "Statistic",
- column: "AthleteId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Training_CoachId",
- table: "Training",
- column: "CoachId");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "AthleteEntityNotificationEntity");
-
- migrationBuilder.DropTable(
- name: "AthleteEntityTrainingEntity");
-
- migrationBuilder.DropTable(
- name: "FriendshipEntity");
-
- migrationBuilder.DropTable(
- name: "HeartRate");
-
- migrationBuilder.DropTable(
- name: "Statistic");
-
- migrationBuilder.DropTable(
- name: "Notification");
-
- migrationBuilder.DropTable(
- name: "Training");
-
- migrationBuilder.DropTable(
- name: "Activity");
-
- migrationBuilder.DropTable(
- name: "Athlete");
-
- migrationBuilder.DropTable(
- name: "DataSource");
- }
- }
-}
diff --git a/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs b/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs
deleted file mode 100644
index 93bd1a3..0000000
--- a/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs
+++ /dev/null
@@ -1,974 +0,0 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using StubbedContextLib;
-
-#nullable disable
-
-namespace StubbedContextLib.Migrations
-{
- [DbContext(typeof(TrainingStubbedContext))]
- partial class TrainingStubbedContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
-
- modelBuilder.Entity("AthleteEntityNotificationEntity", b =>
- {
- b.Property("NotificationsReceivedIdNotif")
- .HasColumnType("INTEGER");
-
- b.Property("ReceiversIdAthlete")
- .HasColumnType("INTEGER");
-
- b.HasKey("NotificationsReceivedIdNotif", "ReceiversIdAthlete");
-
- b.HasIndex("ReceiversIdAthlete");
-
- b.ToTable("AthleteEntityNotificationEntity");
- });
-
- modelBuilder.Entity("AthleteEntityTrainingEntity", b =>
- {
- b.Property("AthletesIdAthlete")
- .HasColumnType("INTEGER");
-
- b.Property("TrainingsAthleteIdTraining")
- .HasColumnType("INTEGER");
-
- b.HasKey("AthletesIdAthlete", "TrainingsAthleteIdTraining");
-
- b.HasIndex("TrainingsAthleteIdTraining");
-
- b.ToTable("AthleteEntityTrainingEntity");
- });
-
- modelBuilder.Entity("Entities.ActivityEntity", b =>
- {
- b.Property("IdActivity")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("AthleteId")
- .HasColumnType("INTEGER");
-
- b.Property("Average")
- .HasColumnType("REAL");
-
- b.Property("AverageTemperature")
- .HasColumnType("REAL");
-
- b.Property("DataSourceId")
- .HasColumnType("INTEGER");
-
- b.Property("Date")
- .HasColumnType("TEXT");
-
- b.Property