-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
110 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...odels/Measurements/Units/DistanceUnits.cs → ...odels/Measurements/Units/DistanceUnits.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/Models/Measurements/Units/TimeUnits.cs → ...on/Models/Measurements/Units/TimeUnits.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../Models/Measurements/Units/WeightUnits.cs → .../Models/Measurements/Units/WeightUnits.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace GainsTracker.Common.Models.Workouts.Dto; | ||
|
||
public class CreateWorkoutDto | ||
{ | ||
public string GainsAccountId { get; set; } = string.Empty; | ||
public WorkoutType WorkoutType { get; set; } | ||
} |
4 changes: 2 additions & 2 deletions
4
...s/Workouts/Services/Dto/MeasurementDto.cs → ...mon/Models/Workouts/Dto/MeasurementDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace GainsTracker.Common.Models.Workouts.Dto; | ||
|
||
public class WorkoutDto | ||
{ | ||
public WorkoutDto(string gainsAccountId) | ||
{ | ||
GainsAccountId = gainsAccountId; | ||
} | ||
|
||
public string Id { get; set; } = ""; | ||
public string GainsAccountId { get; set; } | ||
public WorkoutType WorkoutType { get; set; } | ||
public MeasurementDto? PersonalBest { get; set; } | ||
} |
9 changes: 9 additions & 0 deletions
9
GainsTracker.Common/Models/Workouts/Dto/WorkoutMeasurementsDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace GainsTracker.Common.Models.Workouts.Dto; | ||
|
||
public class WorkoutMeasurementsDto | ||
{ | ||
public string Id { get; set; } = ""; | ||
public List<MeasurementDto> Measurements { get; set; } = new(); | ||
|
||
|
||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...s/Workouts/Models/Workouts/WorkoutType.cs → ...ker.Common/Models/Workouts/WorkoutType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GainsTracker.CoreAPI/Components/Workouts/Controllers/Examples/GainsExampleController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GainsTracker.CoreAPI/Components/Workouts/Controllers/GainsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
GainsTracker.CoreAPI/Components/Workouts/Controllers/WorkoutCatalogController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GainsTracker.CoreAPI/Components/Workouts/Models/Measurements/Measurement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
GainsTracker.CoreAPI/Components/Workouts/Models/Workouts/Workout.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
GainsTracker.CoreAPI/Components/Workouts/Models/Workouts/WorkoutUtils.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
GainsTracker.CoreAPI/Components/Workouts/Services/Dto/CreateWorkoutDto.cs
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
GainsTracker.CoreAPI/Components/Workouts/Services/Dto/WorkoutDto.cs
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
GainsTracker.CoreAPI/Components/Workouts/Services/Dto/WorkoutMeasurementsDto.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
GainsTracker.CoreAPI/Components/Workouts/Services/IGainsService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
GainsTracker.CoreAPI/Components/Workouts/WorkoutExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using GainsTracker.Common.Models.Workouts.Dto; | ||
using GainsTracker.CoreAPI.Components.Workouts.Models.Measurements; | ||
using GainsTracker.CoreAPI.Components.Workouts.Models.Workouts; | ||
|
||
namespace GainsTracker.CoreAPI.Components.Workouts; | ||
|
||
public static class WorkoutExtensions | ||
{ | ||
public static WorkoutDto ToDto(this Workout workout) | ||
{ | ||
MeasurementDto? bestMeasurement = null; | ||
|
||
if (workout.PersonalBest != null) | ||
bestMeasurement = new MeasurementDto | ||
{ | ||
WorkoutId = workout.PersonalBest.WorkoutId, | ||
TimeOfRecord = workout.PersonalBest.TimeOfRecord, | ||
Category = workout.PersonalBest.Category, | ||
Data = MeasurementFactory.SerializeMeasurementToJson(workout.PersonalBest) | ||
}; | ||
|
||
return new WorkoutDto(workout.GainsAccountId) | ||
{ | ||
Id = workout.Id, | ||
WorkoutType = workout.WorkoutType, | ||
PersonalBest = bestMeasurement | ||
}; | ||
} | ||
|
||
public static WorkoutMeasurementsDto ToMeasurementsListDto(this Workout workout) | ||
{ | ||
return new WorkoutMeasurementsDto | ||
{ | ||
Id = workout.Id, | ||
Measurements = workout.Measurements | ||
.Select(m => new MeasurementDto | ||
{ | ||
WorkoutId = m.WorkoutId, | ||
Category = m.Category, | ||
TimeOfRecord = m.TimeOfRecord, | ||
Data = MeasurementFactory.SerializeMeasurementToJson(m) | ||
}).ToList() | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters