-
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.
Added Goals and abstract Trackable goals, that any metric class can e…
…xtend. Refactored big parts to adhere to naming scheme of singular entities. Oh yea also added some tests
- Loading branch information
Showing
57 changed files
with
297 additions
and
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace GainsTracker.Common.Models; | ||
|
||
public class Goal<T> | ||
{ | ||
public Goal(T target) | ||
{ | ||
Target = target; | ||
} | ||
|
||
public T Target { get; } | ||
} |
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,19 @@ | ||
namespace GainsTracker.Common.Models.Interfaces; | ||
|
||
public abstract class TrackableGoal<T> | ||
{ | ||
private bool _isInGoal { get; set; } | ||
protected T? Target { get; init; } | ||
|
||
public Goal<T> CreateAsGoal() | ||
{ | ||
if (_isInGoal) | ||
throw new ArgumentException("Already in goal"); | ||
|
||
_isInGoal = true; | ||
|
||
if (Target == null) | ||
throw new ArgumentNullException(); | ||
return new Goal<T>(Target); | ||
} | ||
} |
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
16 changes: 8 additions & 8 deletions
16
...omponents/Friends/Data/BigBrainFriends.cs → .../Components/Friend/Data/BigBrainFriend.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
...els/Exceptions/AlreadyFriendsException.cs → ...els/Exceptions/AlreadyFriendsException.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
...ions/FriendRequestAlreadySentException.cs → ...ions/FriendRequestAlreadySentException.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: 2 additions & 2 deletions
4
...reAPI/Components/Friends/Models/Friend.cs → ...oreAPI/Components/Friend/Models/Friend.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: 2 additions & 2 deletions
4
...omponents/Friends/Models/FriendRequest.cs → ...Components/Friend/Models/FriendRequest.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
...nts/Friends/Models/FriendRequestStatus.cs → ...ents/Friend/Models/FriendRequestStatus.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: 2 additions & 2 deletions
4
...ponents/Friends/Services/Dto/FriendDto.cs → ...mponents/Friend/Services/Dto/FriendDto.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: 2 additions & 2 deletions
4
.../Friends/Services/Dto/FriendRequestDto.cs → ...s/Friend/Services/Dto/FriendRequestDto.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
.../Services/Dto/FriendRequestOverviewDto.cs → .../Services/Dto/FriendRequestOverviewDto.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
7 changes: 3 additions & 4 deletions
7
...onents/Friends/Services/IFriendService.cs → ...ponents/Friend/Services/IFriendService.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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
using GainsTracker.CoreAPI.Components.Friends.Models; | ||
using GainsTracker.CoreAPI.Components.Friends.Services.Dto; | ||
using GainsTracker.CoreAPI.Components.Friend.Services.Dto; | ||
|
||
namespace GainsTracker.CoreAPI.Components.Friends.Services; | ||
namespace GainsTracker.CoreAPI.Components.Friend.Services; | ||
|
||
public interface IFriendService | ||
{ | ||
public void SendFriendRequest(string username, string friendName); | ||
public void HandleFriendRequestState(string username, string requestId, bool accept = true); | ||
public List<Friend> GetFriends(string username); | ||
public List<Models.Friend> GetFriends(string username); | ||
public FriendRequestOverviewDto GetFriendRequests(string username); | ||
} |
5 changes: 0 additions & 5 deletions
5
GainsTracker.CoreAPI/Components/Gains/Controllers/Examples/GainsExamplesController.cs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
GainsTracker.CoreAPI/Components/Gains/Models/Measurements/Units/DistanceUnits.cs
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
GainsTracker.CoreAPI/Components/Gains/Models/Measurements/Units/TimeUnits.cs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
GainsTracker.CoreAPI/Components/Gains/Models/Measurements/Units/WeightUnits.cs
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
GainsTracker.CoreAPI/Components/Gains/Services/IMeasurementService.cs
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
GainsTracker.CoreAPI/Components/HealthMetric/Controllers/HealthMetricController.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,12 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace GainsTracker.CoreAPI.Components.HealthMetric.Controllers; | ||
|
||
[ApiController] | ||
[Authorize] | ||
[Route("gains/health-metric")] | ||
public class HealthMetricController : ControllerBase | ||
{ | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
GainsTracker.CoreAPI/Components/HealthMetric/Data/BigBrainHealthMetric.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,12 @@ | ||
using GainsTracker.CoreAPI.Configurations.Database; | ||
|
||
namespace GainsTracker.CoreAPI.Components.HealthMetric.Data; | ||
|
||
public class BigBrainHealthMetric : BigBrain | ||
{ | ||
public BigBrainHealthMetric(AppDbContext context) : base(context) | ||
{ | ||
} | ||
|
||
|
||
} |
16 changes: 16 additions & 0 deletions
16
GainsTracker.CoreAPI/Components/HealthMetric/Models/ProteinMetric.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,16 @@ | ||
using GainsTracker.Common.Models.Interfaces; | ||
|
||
namespace GainsTracker.CoreAPI.Components.HealthMetric.Models; | ||
|
||
public class ProteinMetric : TrackableGoal<ProteinMetric> | ||
{ | ||
public DateTime Date { get; init; } | ||
public long TotalProteinIntake { get; set; } | ||
|
||
public ProteinMetric() | ||
{ | ||
Date = DateTime.UtcNow; | ||
Target = this; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
GainsTracker.CoreAPI/Components/HealthMetric/Services/HealthMetricService.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,6 @@ | ||
namespace GainsTracker.CoreAPI.Components.HealthMetric.Services; | ||
|
||
public class HealthMetricService | ||
{ | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
GainsTracker.CoreAPI/Components/UserProfile/Controllers/UserProfileController.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
5 changes: 5 additions & 0 deletions
5
GainsTracker.CoreAPI/Components/Workout/Controllers/Examples/GainsExamplesController.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,5 @@ | ||
namespace GainsTracker.CoreAPI.Components.Workout.Controllers.Examples; | ||
|
||
public class GainsExamplesController | ||
{ | ||
} |
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
Oops, something went wrong.