diff --git a/Back/skydiveLogs-api.Domain/StatsByAircraft.cs b/Back/skydiveLogs-api.Domain/StatsByAircraft.cs new file mode 100644 index 0000000..c957e48 --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsByAircraft.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsByAircraft + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsByDz.cs b/Back/skydiveLogs-api.Domain/StatsByDz.cs new file mode 100644 index 0000000..ec22e6f --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsByDz.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsByDz + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsByGear.cs b/Back/skydiveLogs-api.Domain/StatsByGear.cs new file mode 100644 index 0000000..5219ab1 --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsByGear.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsByGear + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsByJumpType.cs b/Back/skydiveLogs-api.Domain/StatsByJumpType.cs new file mode 100644 index 0000000..a1ffc5f --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsByJumpType.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsByJumpType + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsByYear.cs b/Back/skydiveLogs-api.Domain/StatsByYear.cs new file mode 100644 index 0000000..3fe078e --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsByYear.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsByYear + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsByYearByJumpType.cs b/Back/skydiveLogs-api.Domain/StatsByYearByJumpType.cs new file mode 100644 index 0000000..0fc8461 --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsByYearByJumpType.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsByYearByJumpType + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsForLastMonthByDz.cs b/Back/skydiveLogs-api.Domain/StatsForLastMonthByDz.cs new file mode 100644 index 0000000..77e21a2 --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsForLastMonthByDz.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsForLastMonthByDz + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsForLastMonthByJumpType.cs b/Back/skydiveLogs-api.Domain/StatsForLastMonthByJumpType.cs new file mode 100644 index 0000000..c6feffb --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsForLastMonthByJumpType.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsForLastMonthByJumpType + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsForLastYearByDz.cs b/Back/skydiveLogs-api.Domain/StatsForLastYearByDz.cs new file mode 100644 index 0000000..546792d --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsForLastYearByDz.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsForLastYearByDz + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/StatsForLastYearByJumpType.cs b/Back/skydiveLogs-api.Domain/StatsForLastYearByJumpType.cs new file mode 100644 index 0000000..1f41ee1 --- /dev/null +++ b/Back/skydiveLogs-api.Domain/StatsForLastYearByJumpType.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class StatsForLastYearByJumpType + { + public string Label { get; set; } + + public string Label2 { get; set; } + + public int Nb { get; set; } + + public int Id { get; set; } + + public User User { get; set; } + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsByDzRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByDzRepository.cs new file mode 100644 index 0000000..b5af2c3 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByDzRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsByDzRepository : IRepository + { + #region Public Methods + + StatsByDz GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsByGearRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByGearRepository.cs new file mode 100644 index 0000000..02ac751 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByGearRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsByGearRepository : IRepository + { + #region Public Methods + + StatsByGear GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsByJumpTypeRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByJumpTypeRepository.cs new file mode 100644 index 0000000..555a76e --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByJumpTypeRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsByJumpTypeRepository : IRepository + { + #region Public Methods + + StatsByJumpType GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsByYearByJumpTypeRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByYearByJumpTypeRepository.cs new file mode 100644 index 0000000..0da9de6 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByYearByJumpTypeRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsByYearByJumpTypeRepository : IRepository + { + #region Public Methods + + StatsByYearByJumpType GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsByYearRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByYearRepository.cs new file mode 100644 index 0000000..0f12ea3 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsByYearRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsByYearRepository : IRepository + { + #region Public Methods + + StatsByYear GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastMonthByDzRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastMonthByDzRepository.cs new file mode 100644 index 0000000..9efdf24 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastMonthByDzRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsForLastMonthByDzRepository : IRepository + { + #region Public Methods + + StatsForLastMonthByDz GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastMonthByJumpTypeRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastMonthByJumpTypeRepository.cs new file mode 100644 index 0000000..c548b41 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastMonthByJumpTypeRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsForLastMonthByJumpTypeRepository : IRepository + { + #region Public Methods + + StatsForLastMonthByJumpType GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastYearByDzRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastYearByDzRepository.cs new file mode 100644 index 0000000..84712e8 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastYearByDzRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsForLastYearByDzRepository : IRepository + { + #region Public Methods + + StatsForLastYearByDz GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastYearByJumpTypeRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastYearByJumpTypeRepository.cs new file mode 100644 index 0000000..25b176e --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IStatsForLastYearByJumpTypeRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IStatsForLastYearByJumpTypeRepository : IRepository + { + #region Public Methods + + StatsForLastYearByJumpType GetAll(User user); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/Interfaces/IDataProvider.cs b/Back/skydiveLogs-api.Infrastructure/Interfaces/IDataProvider.cs index 9590cbe..cf934e2 100644 --- a/Back/skydiveLogs-api.Infrastructure/Interfaces/IDataProvider.cs +++ b/Back/skydiveLogs-api.Infrastructure/Interfaces/IDataProvider.cs @@ -30,12 +30,30 @@ namespace skydiveLogs_api.Infrastructure.Interfaces ILiteCollection CollOfJumpType { get; } - ILiteCollection CollOfStats { get; } - ILiteCollection CollOfUser { get; } - + ILiteCollection CollOfTunnelFlight { get; } + ILiteCollection CollOfStatsByAircraft { get; } + + ILiteCollection CollOfStatsByDz { get; } + + ILiteCollection CollOfStatsByGear { get; } + + ILiteCollection CollOfStatsByJumpType { get; } + + ILiteCollection CollOfStatsByYear { get; } + + ILiteCollection CollOfStatsForLastMonthByDz { get; } + + ILiteCollection CollOfStatsForLastMonthByJumpType { get; } + + ILiteCollection CollOfStatsForLastYearByDz { get; } + + ILiteCollection CollOfStatsForLastYearByJumpType { get; } + + ILiteCollection CollOfStatsByYearByJumpType { get; } + #endregion Public Properties } } \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs b/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs index 4cd74b6..3376856 100644 --- a/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs +++ b/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs @@ -21,8 +21,6 @@ namespace skydiveLogs_api.Infrastructure BsonMapper.Global.Entity().DbRef(x => x.User, "User"); - BsonMapper.Global.Entity().DbRef(x => x.User, "User"); - BsonMapper.Global.Entity().DbRef(x => x.User, "User"); BsonMapper.Global.Entity().DbRef(x => x.User, "User"); @@ -31,6 +29,17 @@ namespace skydiveLogs_api.Infrastructure BsonMapper.Global.Entity().DbRef(x => x.Tunnel, "DropZone"); BsonMapper.Global.Entity().DbRef(x => x.JumpType, "JumpType"); BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); + BsonMapper.Global.Entity().DbRef(x => x.User, "User"); } #endregion Public Constructors @@ -58,10 +67,18 @@ namespace skydiveLogs_api.Infrastructure public ILiteCollection CollOfImage => _db.GetCollection(); public ILiteCollection CollOfJump => _db.GetCollection(); public ILiteCollection CollOfJumpType => _db.GetCollection(); - public ILiteCollection CollOfStats => _db.GetCollection(); public ILiteCollection CollOfUser => _db.GetCollection(); public ILiteCollection CollOfTunnelFlight => _db.GetCollection(); - + public ILiteCollection CollOfStatsByAircraft => _db.GetCollection(); + public ILiteCollection CollOfStatsByDz => _db.GetCollection(); + public ILiteCollection CollOfStatsByGear => _db.GetCollection(); + public ILiteCollection CollOfStatsByJumpType => _db.GetCollection(); + public ILiteCollection CollOfStatsByYear => _db.GetCollection(); + public ILiteCollection CollOfStatsForLastMonthByDz => _db.GetCollection(); + public ILiteCollection CollOfStatsForLastMonthByJumpType => _db.GetCollection(); + public ILiteCollection CollOfStatsForLastYearByDz => _db.GetCollection(); + public ILiteCollection CollOfStatsForLastYearByJumpType => _db.GetCollection(); + public ILiteCollection CollOfStatsByYearByJumpType => _db.GetCollection(); #endregion Public Properties #region Private Fields diff --git a/Back/skydiveLogs-api.Infrastructure/UserStatsRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsByDzRepository.cs similarity index 74% rename from Back/skydiveLogs-api.Infrastructure/UserStatsRepository.cs rename to Back/skydiveLogs-api.Infrastructure/StatsByDzRepository.cs index dbe9305..0771146 100644 --- a/Back/skydiveLogs-api.Infrastructure/UserStatsRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/StatsByDzRepository.cs @@ -1,4 +1,4 @@ -using LiteDB; +using LiteDB; using skydiveLogs_api.Domain; using skydiveLogs_api.DomainService.Repositories; using skydiveLogs_api.Infrastructure.Interfaces; @@ -6,21 +6,21 @@ using System.Collections.Generic; namespace skydiveLogs_api.Infrastructure { - public class UserStatsRepository : IUserStatsRepository + public class StatsByDzRepository : IStatsByDzRepository { #region Public Constructors - public UserStatsRepository(IDataProvider dataProvider) + public StatsByDzRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; - _col = _dataProvider.CollOfStats; + _col = _dataProvider.CollOfStatsByDz; } #endregion Public Constructors #region Public Methods - public int Add(UserStats newStats) + public int Add(StatsByDz newStats) { int result; @@ -37,12 +37,12 @@ namespace skydiveLogs_api.Infrastructure return result; } - public IEnumerable GetAll() + public IEnumerable GetAll() { throw new System.NotImplementedException(); } - public UserStats GetAll(User user) + public StatsByDz GetAll(User user) { return _col.Include(x => x.User) .Query() @@ -50,7 +50,7 @@ namespace skydiveLogs_api.Infrastructure .SingleOrDefault(); } - public UserStats GetById(int id) + public StatsByDz GetById(int id) { throw new System.NotImplementedException(); } @@ -60,7 +60,7 @@ namespace skydiveLogs_api.Infrastructure throw new System.NotImplementedException(); } - public bool Update(UserStats stats) + public bool Update(StatsByDz stats) { return _col.Update(stats); } @@ -69,7 +69,7 @@ namespace skydiveLogs_api.Infrastructure #region Private Fields - private readonly ILiteCollection _col; + private readonly ILiteCollection _col; private readonly IDataProvider _dataProvider; #endregion Private Fields diff --git a/Back/skydiveLogs-api.Infrastructure/StatsByGearRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsByGearRepository.cs new file mode 100644 index 0000000..6f65985 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsByGearRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsByGearRepository : IStatsByGearRepository + { + #region Public Constructors + + public StatsByGearRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsByGear; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsByGear newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsByGear GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsByGear GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsByGear stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsByJumpTypeRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsByJumpTypeRepository.cs new file mode 100644 index 0000000..0ee2f21 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsByJumpTypeRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsByJumpTypeRepository : IStatsByJumpTypeRepository + { + #region Public Constructors + + public StatsByJumpTypeRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsByJumpType; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsByJumpType newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsByJumpType GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsByJumpType GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsByJumpType stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsByYearByJumpTypeRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsByYearByJumpTypeRepository.cs new file mode 100644 index 0000000..c35e296 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsByYearByJumpTypeRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsByYearByJumpTypeRepository : IStatsByYearByJumpTypeRepository + { + #region Public Constructors + + public StatsByYearByJumpTypeRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsByYearByJumpType; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsByYearByJumpType newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsByYearByJumpType GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsByYearByJumpType GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsByYearByJumpType stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsByYearRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsByYearRepository.cs new file mode 100644 index 0000000..085b96a --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsByYearRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsByYearRepository : IStatsByYearRepository + { + #region Public Constructors + + public StatsByYearRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsByYear; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsByYear newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsByYear GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsByYear GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsByYear stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsForLastMonthByDzRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsForLastMonthByDzRepository.cs new file mode 100644 index 0000000..b68cdd6 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsForLastMonthByDzRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsForLastMonthByDzRepository : IStatsForLastMonthByDzRepository + { + #region Public Constructors + + public StatsForLastMonthByDzRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsForLastMonthByDz; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsForLastMonthByDz newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsForLastMonthByDz GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsForLastMonthByDz GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsForLastMonthByDz stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsForLastMonthByJumpTypeRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsForLastMonthByJumpTypeRepository.cs new file mode 100644 index 0000000..4416306 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsForLastMonthByJumpTypeRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsForLastMonthByJumpTypeRepository : IStatsForLastMonthByJumpTypeRepository + { + #region Public Constructors + + public StatsForLastMonthByJumpTypeRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsForLastMonthByJumpType; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsForLastMonthByJumpType newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsForLastMonthByJumpType GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsForLastMonthByJumpType GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsForLastMonthByJumpType stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsForLastYearByDzRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsForLastYearByDzRepository.cs new file mode 100644 index 0000000..38dd2c3 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsForLastYearByDzRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsForLastYearByDzRepository : IStatsForLastYearByDzRepository + { + #region Public Constructors + + public StatsForLastYearByDzRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsForLastYearByDz; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsForLastYearByDz newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsForLastYearByDz GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsForLastYearByDz GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsForLastYearByDz stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Infrastructure/StatsForLastYearByJumpTypeRepository.cs b/Back/skydiveLogs-api.Infrastructure/StatsForLastYearByJumpTypeRepository.cs new file mode 100644 index 0000000..fd7ae3f --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/StatsForLastYearByJumpTypeRepository.cs @@ -0,0 +1,77 @@ +using LiteDB; +using skydiveLogs_api.Domain; +using skydiveLogs_api.DomainService.Repositories; +using skydiveLogs_api.Infrastructure.Interfaces; +using System.Collections.Generic; + +namespace skydiveLogs_api.Infrastructure +{ + public class StatsForLastYearByJumpTypeRepository : IStatsForLastYearByJumpTypeRepository + { + #region Public Constructors + + public StatsForLastYearByJumpTypeRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStatsForLastYearByJumpType; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(StatsForLastYearByJumpType newStats) + { + int result; + + try + { + var tmp = _col.Insert(newStats); + result = tmp.AsInt32; + } + catch + { + result = 0; + } + + return result; + } + + public IEnumerable GetAll() + { + throw new System.NotImplementedException(); + } + + public StatsForLastYearByJumpType GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public StatsForLastYearByJumpType GetById(int id) + { + throw new System.NotImplementedException(); + } + + public int GetCount() + { + throw new System.NotImplementedException(); + } + + public bool Update(StatsForLastYearByJumpType stats) + { + return _col.Update(stats); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ILiteCollection _col; + private readonly IDataProvider _dataProvider; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Ioc/IocService.cs b/Back/skydiveLogs-api.Ioc/IocService.cs index a08586b..82c4435 100644 --- a/Back/skydiveLogs-api.Ioc/IocService.cs +++ b/Back/skydiveLogs-api.Ioc/IocService.cs @@ -52,9 +52,18 @@ namespace skydiveLogs_api.Ioc _services.AddScoped(); _services.AddScoped(); _services.AddScoped(); - _services.AddScoped(); _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + _services.AddScoped(); + string connectionString = _configuration.GetConnectionString("DefaultConnection"); _services.AddSingleton(c => new LiteDbProvider(connectionString)); }