diff --git a/Back/skydiveLogs-api.Business/AircraftService.cs b/Back/skydiveLogs-api.Business/AircraftService.cs deleted file mode 100644 index 15d7ea9..0000000 --- a/Back/skydiveLogs-api.Business/AircraftService.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class AircraftService : IAircraftService - { - public AircraftService(IAircraftRepository aircraftRepository) - { - _aircraftRepository = aircraftRepository; - } - - public void AddNewAircraft(Aircraft newAircraft) - { - _aircraftRepository.Add(newAircraft); - } - - public void DeleteAircraftById(int id) - { - throw new NotImplementedException(); - } - - public Aircraft GetAircraftById(int id) - { - return _aircraftRepository.GetById(id); - } - - public IEnumerable GetAllAircrafts() - { - return _aircraftRepository.GetAll(); - } - - public void UpdateAircraft(int id, Aircraft aircraft) - { - throw new NotImplementedException(); - } - - private readonly IAircraftRepository _aircraftRepository; - } -} diff --git a/Back/skydiveLogs-api.Business/DropZoneService.cs b/Back/skydiveLogs-api.Business/DropZoneService.cs deleted file mode 100644 index a236899..0000000 --- a/Back/skydiveLogs-api.Business/DropZoneService.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class DropZoneService : IDropZoneService - { - public DropZoneService(IDropZoneRepository dropZoneRepository) - { - _dropZoneRepository = dropZoneRepository; - } - - public void AddNewDz(DropZone newdropZone) - { - _dropZoneRepository.Add(newdropZone); - } - - public void DeleteDzById(int id) - { - throw new NotImplementedException(); - } - - public IEnumerable GetAllDzs() - { - return _dropZoneRepository.GetAll(); - } - - public DropZone GetDzById(int id) - { - return _dropZoneRepository.GetById(id); - } - - public bool UpdateDz(int id, DropZone dropZone) - { - dropZone.Id = id; - - return _dropZoneRepository.Update(dropZone); - } - - private readonly IDropZoneRepository _dropZoneRepository; - } -} diff --git a/Back/skydiveLogs-api.Business/GearService.cs b/Back/skydiveLogs-api.Business/GearService.cs deleted file mode 100644 index 2866b1a..0000000 --- a/Back/skydiveLogs-api.Business/GearService.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class GearService : IGearService - { - public GearService(IGearRepository gearRepository) - { - _gearRepository = gearRepository; - } - - public void AddNewGear(Gear newGear, - User connectedUser) - { - newGear.User = connectedUser; - _gearRepository.Add(newGear); - } - - public void DeleteGearById(int id) - { - throw new NotImplementedException(); - } - - public Gear GetGearById(int id) - { - return _gearRepository.GetById(id); - } - - public IEnumerable GetAllGears(User connectedUser) - { - return _gearRepository.GetAll(connectedUser); - } - - public void UpdateGear(int id, Gear Gear) - { - throw new NotImplementedException(); - } - - private readonly IGearRepository _gearRepository; - } -} diff --git a/Back/skydiveLogs-api.Business/InitDbService.cs b/Back/skydiveLogs-api.Business/InitDbService.cs deleted file mode 100644 index 5b45a7a..0000000 --- a/Back/skydiveLogs-api.Business/InitDbService.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Text.Json; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class InitDbService : IInitDbService - { - public InitDbService(IAircraftService aircraftService, - IJumpTypeService jumpTypeService, - IDropZoneService dropZoneService) - { - _aircraftService = aircraftService; - _jumpTypeService = jumpTypeService; - _dropZoneService = dropZoneService; - } - - public void GenerateDb() - { - LoadAircrafts(); - LoadDropZones(); - LoadJumpTypes(); - } - - private void LoadDropZones() - { - var jsonString = File.ReadAllText("Init/dropZone.json"); - var options = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - WriteIndented = true - }; - var jsonModel = JsonSerializer.Deserialize>(jsonString, options); - - foreach (var item in jsonModel) - { - _dropZoneService.AddNewDz(item); - } - } - - private void LoadJumpTypes() - { - var jsonString = File.ReadAllText("Init/jumpType.json"); - var options = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - WriteIndented = true - }; - var jsonModel = JsonSerializer.Deserialize>(jsonString, options); - - foreach (var item in jsonModel) - { - _jumpTypeService.AddNewJumpType(item); - } - } - - private void LoadAircrafts() - { - var jsonString = File.ReadAllText("Init/aircraft.json"); - var options = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - WriteIndented = true - }; - var jsonModel = JsonSerializer.Deserialize>(jsonString, options); - - foreach (var item in jsonModel) - { - _aircraftService.AddNewAircraft(item); - } - } - - private readonly IAircraftService _aircraftService; - - private readonly IJumpTypeService _jumpTypeService; - - private readonly IDropZoneService _dropZoneService; - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IAircraftService.cs b/Back/skydiveLogs-api.Business/Interfaces/IAircraftService.cs deleted file mode 100644 index a0e4365..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IAircraftService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IAircraftService - { - IEnumerable GetAllAircrafts(); - - Aircraft GetAircraftById(int id); - - void AddNewAircraft(Aircraft aircraft); - - void UpdateAircraft(int id, Aircraft aircraft); - - void DeleteAircraftById(int id); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IDropZoneService.cs b/Back/skydiveLogs-api.Business/Interfaces/IDropZoneService.cs deleted file mode 100644 index 20c33ec..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IDropZoneService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IDropZoneService - { - IEnumerable GetAllDzs(); - - DropZone GetDzById(int id); - - void DeleteDzById(int id); - - bool UpdateDz(int id, DropZone dropZone); - - void AddNewDz(DropZone dropZone); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IGearService.cs b/Back/skydiveLogs-api.Business/Interfaces/IGearService.cs deleted file mode 100644 index 6b1d872..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IGearService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IGearService - { - IEnumerable GetAllGears(User connectedUser); - - Gear GetGearById(int id); - - void DeleteGearById(int id); - - void UpdateGear(int id, Gear gear); - - void AddNewGear(Gear gear, User connectedUser); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IInitDbService.cs b/Back/skydiveLogs-api.Business/Interfaces/IInitDbService.cs deleted file mode 100644 index 5262378..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IInitDbService.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IInitDbService - { - public void GenerateDb(); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IJumpService.cs b/Back/skydiveLogs-api.Business/Interfaces/IJumpService.cs deleted file mode 100644 index 80e171d..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IJumpService.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IJumpService - { - IEnumerable GetAllJumps(User connectedUser); - - Jump GetJumpById(int id); - - void AddNewJump(int aircraftId, - int dzId, - int jumpTypeId, - int gearId, - Jump jump, - User connectedUser); - - void UpdateJump(int id, Jump jump); - - void DeleteJumpById(int id); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IJumpTypeService.cs b/Back/skydiveLogs-api.Business/Interfaces/IJumpTypeService.cs deleted file mode 100644 index 319056b..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IJumpTypeService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IJumpTypeService - { - IEnumerable GetAllJumpTypes(); - - JumpType GetJumpTypeById(int id); - - void AddNewJumpType(JumpType value); - - void UpdateJumpType(int id, JumpType value); - - void DeleteJumpTypeById(int id); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IStatsService.cs b/Back/skydiveLogs-api.Business/Interfaces/IStatsService.cs deleted file mode 100644 index fe2d8eb..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IStatsService.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IStatsService - { - IEnumerable GetStatsByDz(User connectedUser); - - IEnumerable GetStatsByAircraft(User connectedUser); - - IEnumerable GetStatsByJumpType(User connectedUser); - - IEnumerable GetStatsByGear(User connectedUser); - - IEnumerable GetStatsByYear(User connectedUser); - - IEnumerable GetStatsForLastYearByDz(User connectedUser); - - IEnumerable GetStatsForLastYearByJumpType(User connectedUser); - - IEnumerable GetStatsForLastMonthByDz(User connectedUser); - - IEnumerable GetStatsForLastMonthByJumpType(User connectedUser); - - SimpleSummary GetSimpleSummary(User connectedUser); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IUserImageService.cs b/Back/skydiveLogs-api.Business/Interfaces/IUserImageService.cs deleted file mode 100644 index 60a1ee2..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IUserImageService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IUserImageService - { - IEnumerable GetAllImages(User connectedUser); - - UserImage GetImageById(int id); - - void AddNewImage(UserImage image, User connectedUser); - - void UpdateImage(int id, UserImage image); - - void DeleteImageById(int id); - } -} diff --git a/Back/skydiveLogs-api.Business/Interfaces/IUserService.cs b/Back/skydiveLogs-api.Business/Interfaces/IUserService.cs deleted file mode 100644 index ea91d89..0000000 --- a/Back/skydiveLogs-api.Business/Interfaces/IUserService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using skydiveLogs_api.Domain; - -namespace skydiveLogs_api.Business.Interfaces -{ - public interface IUserService - { - User GetByLogin(string login, string password); - - User GetById(int userId); - - bool AddNewUser(User user); - } -} diff --git a/Back/skydiveLogs-api.Business/JumpService.cs b/Back/skydiveLogs-api.Business/JumpService.cs deleted file mode 100644 index 323ddd5..0000000 --- a/Back/skydiveLogs-api.Business/JumpService.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class JumpService : IJumpService - { - public JumpService(IJumpTypeService jumpTypeService, - IAircraftService aircraftService, - IDropZoneService dropZoneService, - IGearService gearService, - IJumpRepository jumpRepository) - { - _jumpTypeService = jumpTypeService; - _aircraftService = aircraftService; - _dropZoneService = dropZoneService; - _gearService = gearService; - _jumpRepository = jumpRepository; - } - - public void AddNewJump(int aircraftId, - int dzId, - int jumpTypeId, - int gearId, - Jump jump, - User connectedUser) - { - var selectedGear = _gearService.GetGearById(gearId); - var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId); - var selectedAircraft = _aircraftService.GetAircraftById(aircraftId); - var selectedDropZone = _dropZoneService.GetDzById(dzId); - - jump.Aircraft = selectedAircraft; - jump.JumpType = selectedJumpType; - jump.DropZone = selectedDropZone; - jump.Gear = selectedGear; - jump.User = connectedUser; - - _jumpRepository.Add(jump); - } - - public void DeleteJumpById(int id) - { - throw new NotImplementedException(); - } - - public IEnumerable GetAllJumps(User connectedUser) - { - return _jumpRepository.GetAll(connectedUser); - } - - public Jump GetJumpById(int id) - { - return _jumpRepository.GetById(id); - } - - public void UpdateJump(int id, Jump jump) - { - throw new NotImplementedException(); - } - - private readonly IJumpRepository _jumpRepository; - - private readonly IJumpTypeService _jumpTypeService; - - private readonly IAircraftService _aircraftService; - - private readonly IDropZoneService _dropZoneService; - - private readonly IGearService _gearService; - } -} diff --git a/Back/skydiveLogs-api.Business/JumpTypeService.cs b/Back/skydiveLogs-api.Business/JumpTypeService.cs deleted file mode 100644 index 233be29..0000000 --- a/Back/skydiveLogs-api.Business/JumpTypeService.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class JumpTypeService : IJumpTypeService - { - public JumpTypeService(IJumpTypeRepository jumpTypeRepository) - { - _jumpTypeRepository = jumpTypeRepository; - } - - public void AddNewJumpType(JumpType newJumpType) - { - _jumpTypeRepository.Add(newJumpType); - } - - public void DeleteJumpTypeById(int id) - { - throw new NotImplementedException(); - } - - public IEnumerable GetAllJumpTypes() - { - return _jumpTypeRepository.GetAll(); - } - - public JumpType GetJumpTypeById(int id) - { - return _jumpTypeRepository.GetById(id); - } - - public void UpdateJumpType(int id, JumpType value) - { - throw new NotImplementedException(); - } - - private readonly IJumpTypeRepository _jumpTypeRepository; - } -} diff --git a/Back/skydiveLogs-api.Business/StatsService.cs b/Back/skydiveLogs-api.Business/StatsService.cs deleted file mode 100644 index 4aaafeb..0000000 --- a/Back/skydiveLogs-api.Business/StatsService.cs +++ /dev/null @@ -1,237 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class StatsService : IStatsService - { - public StatsService(IJumpService jumpService) - { - _jumpService = jumpService; - } - - public IEnumerable GetStatsByAircraft(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - results = allJumps.GroupBy(j => j.Aircraft.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsByDz(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - results = allJumps.GroupBy(j => j.DropZone.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsByJumpType(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - results = allJumps.GroupBy(j => j.JumpType.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsByGear(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - results = allJumps.GroupBy(j => j.Gear.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsByYear(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - results = allJumps.GroupBy(j => j.JumpDate.Year, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsForLastYearByDz(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; - - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump) - .GroupBy(j => j.DropZone.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsForLastYearByJumpType(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; - - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump) - .GroupBy(j => j.JumpType.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsForLastMonthByDz(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; - var monthOfLastJump = lastJump.JumpDate.Month; - - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump && j.JumpDate.Month == monthOfLastJump) - .GroupBy(j => j.DropZone.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public IEnumerable GetStatsForLastMonthByJumpType(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new List(); - - if (allJumps.Any()) - { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; - var monthOfLastJump = lastJump.JumpDate.Month; - - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump && j.JumpDate.Month == monthOfLastJump) - .GroupBy(j => j.JumpType.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); - } - - return results; - } - - public SimpleSummary GetSimpleSummary(User connectedUser) - { - var allJumps = _jumpService.GetAllJumps(connectedUser); - var results = new SimpleSummary(); - - if (allJumps.Any()) - { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - - results = new SimpleSummary - { - LastJump = lastJump, - TotalJumps = allJumps.Count(), - TotalCutaways = allJumps.Where(j => j.WithCutaway).Count() - }; - } - - return results; - } - - private readonly IJumpService _jumpService; - } -} diff --git a/Back/skydiveLogs-api.Business/UserImageService.cs b/Back/skydiveLogs-api.Business/UserImageService.cs deleted file mode 100644 index 7f1d919..0000000 --- a/Back/skydiveLogs-api.Business/UserImageService.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; - - -namespace skydiveLogs_api.Business -{ - public class UserImageService : IUserImageService - { - public UserImageService(IUserImageRepository imageRepository) - { - _imageRepository = imageRepository; - } - - public void AddNewImage(UserImage newImage, User connectedUser) - { - newImage.User = connectedUser; - _imageRepository.Add(newImage); - } - - public void DeleteImageById(int id) - { - throw new NotImplementedException(); - } - - public UserImage GetImageById(int id) - { - return _imageRepository.GetById(id); - } - - public IEnumerable GetAllImages(User connectedUser) - { - return _imageRepository.GetAll(connectedUser); - } - - public void UpdateImage(int id, UserImage Image) - { - throw new NotImplementedException(); - } - - private readonly IUserImageRepository _imageRepository; - } -} diff --git a/Back/skydiveLogs-api.Business/UserService.cs b/Back/skydiveLogs-api.Business/UserService.cs deleted file mode 100644 index baf24e7..0000000 --- a/Back/skydiveLogs-api.Business/UserService.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.Security.Cryptography; -using System.Text; -using System.IO; -using System; - -using skydiveLogs_api.Business.Interfaces; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Business -{ - public class UserService : IUserService - { - public UserService(IUserRepository userRepository) - { - _userRepository = userRepository; - } - - public User GetById(int userId) - { - return _userRepository.GetById(userId); - } - - public User GetByLogin(string login, string password) - { - return _userRepository.GetByLogin(login, EncryptPassword(password)); - } - - public bool AddNewUser(User newUser) - { - newUser.Password = EncryptPassword(newUser.Password); - var foundUser = _userRepository.GetByLogin(newUser.Login, newUser.Password); - var result = false; - - if (foundUser == null) - { - _userRepository.Add(newUser); - result = true; - } - - return result; - } - - private string EncryptPassword(string password) - { - var encryptionKey = "skydivelogsangular"; //we can change the code converstion key as per our requirement - byte[] clearBytes = Encoding.Unicode.GetBytes(password); - var encryptedPassword = string.Empty; - - using (Aes encryptor = Aes.Create()) - { - Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(encryptionKey, - new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); - encryptor.Key = pdb.GetBytes(32); - encryptor.IV = pdb.GetBytes(16); - using (MemoryStream ms = new MemoryStream()) - { - using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write)) - { - cs.Write(clearBytes, 0, clearBytes.Length); - cs.Close(); - } - - encryptedPassword = Convert.ToBase64String(ms.ToArray()); - } - } - - return encryptedPassword; - } - - private readonly IUserRepository _userRepository; - } -} diff --git a/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj b/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj deleted file mode 100644 index 4dd6214..0000000 --- a/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net5.0 - skydiveLogs_api.Business - - - - - - - - diff --git a/Back/skydiveLogs-api.Data/AircraftRepository.cs b/Back/skydiveLogs-api.Data/AircraftRepository.cs deleted file mode 100644 index 52c9d27..0000000 --- a/Back/skydiveLogs-api.Data/AircraftRepository.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class AircraftRepository : IAircraftRepository - { - public AircraftRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfAircraft; - } - - public IEnumerable GetAll() - { - return _col.FindAll().ToList(); - } - - public Aircraft GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Update(Aircraft aircraft) - { - return _col.Update(aircraft); - } - - public bool Add(Aircraft newAircraft) - { - var result = true; - - try - { - _col.Insert(newAircraft); - } - catch - { - result = false; - } - - return result; - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/DropZoneRepository.cs b/Back/skydiveLogs-api.Data/DropZoneRepository.cs deleted file mode 100644 index 8cec9f8..0000000 --- a/Back/skydiveLogs-api.Data/DropZoneRepository.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class DropZoneRepository : IDropZoneRepository - { - public DropZoneRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfDropZone; - } - - public IEnumerable GetAll() - { - return _col.FindAll().ToList(); - } - - public DropZone GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Update(DropZone updatedDz) - { - return _col.Update(updatedDz); - } - - public bool Add(DropZone newDz) - { - var result = true; - - try - { - _col.Insert(newDz); - } - catch - { - result = false; - } - - return result; - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/GearRepository.cs b/Back/skydiveLogs-api.Data/GearRepository.cs deleted file mode 100644 index f3ae4b8..0000000 --- a/Back/skydiveLogs-api.Data/GearRepository.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections.Generic; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class GearRepository : IGearRepository - { - public GearRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfGear; - } - - public IEnumerable GetAll() - { - throw new System.NotImplementedException(); - } - - public IEnumerable GetAll(User user) - { - return _col.Include(x => x.User) - .Query() - .Where(j => j.User.Id == user.Id) - .ToList(); - } - - public Gear GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Update(Gear updatedGear) - { - return _col.Update(updatedGear); - } - - public bool Add(Gear newGear) - { - var result = true; - - try - { - _col.Insert(newGear); - } - catch - { - result = false; - } - - return result; - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/Interfaces/IDataProvider.cs b/Back/skydiveLogs-api.Data/Interfaces/IDataProvider.cs deleted file mode 100644 index 852c079..0000000 --- a/Back/skydiveLogs-api.Data/Interfaces/IDataProvider.cs +++ /dev/null @@ -1,28 +0,0 @@ -using LiteDB; - -using skydiveLogs_api.Domain; - - -namespace skydiveLogs_api.Infrastructure.Interfaces -{ - public interface IDataProvider - { - ILiteCollection GetCollection(); - - void Close(); - - ILiteCollection CollOfAircraft { get; } - - ILiteCollection CollOfDropZone { get; } - - ILiteCollection CollOfGear { get; } - - ILiteCollection CollOfJumpType { get; } - - ILiteCollection CollOfJump { get; } - - ILiteCollection CollOfUser { get; } - - ILiteCollection CollOfImage { get; } - } -} diff --git a/Back/skydiveLogs-api.Data/JumpRepository.cs b/Back/skydiveLogs-api.Data/JumpRepository.cs deleted file mode 100644 index a56a5f7..0000000 --- a/Back/skydiveLogs-api.Data/JumpRepository.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections.Generic; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class JumpRepository : IJumpRepository - { - public JumpRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfJump; - } - - public IEnumerable GetAll(User user) - { - return _col.Include(x => x.Aircraft) - .Include(x => x.DropZone) - .Include(x => x.Gear) - .Include(x => x.JumpType) - .Include(x => x.User) - .Query() - .Where(j => j.User.Id == user.Id) - .ToList(); - } - - public Jump GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Add(Jump newJump) - { - var result = true; - - try - { - _col.Insert(newJump); - } - catch - { - result = false; - } - - return result; - } - - public bool Update(Jump updatedJump) - { - throw new System.NotImplementedException(); - } - - public IEnumerable GetAll() - { - throw new System.NotImplementedException(); - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/JumpTypeRepository.cs b/Back/skydiveLogs-api.Data/JumpTypeRepository.cs deleted file mode 100644 index ee5adbb..0000000 --- a/Back/skydiveLogs-api.Data/JumpTypeRepository.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class JumpTypeRepository : IJumpTypeRepository - { - public JumpTypeRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfJumpType; - } - - public IEnumerable GetAll() - { - return _col.FindAll().ToList(); - } - - public JumpType GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Update(JumpType updatedJumpType) - { - return _col.Update(updatedJumpType); - } - - public bool Add(JumpType newJumpType) - { - var result = true; - - try - { - _col.Insert(newJumpType); - } - catch - { - result = false; - } - - return result; - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/LiteDbProvider.cs b/Back/skydiveLogs-api.Data/LiteDbProvider.cs deleted file mode 100644 index b10352e..0000000 --- a/Back/skydiveLogs-api.Data/LiteDbProvider.cs +++ /dev/null @@ -1,52 +0,0 @@ -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class LiteDbProvider : IDataProvider - { - public LiteDbProvider(string connectionString) - { - _db = new LiteDatabase(connectionString); - - BsonMapper.Global.Entity().DbRef(x => x.JumpType, "JumpType"); - BsonMapper.Global.Entity().DbRef(x => x.Aircraft, "Aircraft"); - BsonMapper.Global.Entity().DbRef(x => x.DropZone, "DropZone"); - BsonMapper.Global.Entity().DbRef(x => x.Gear, "Gear"); - BsonMapper.Global.Entity().DbRef(x => x.User, "User"); - - BsonMapper.Global.Entity().DbRef(x => x.User, "User"); - - BsonMapper.Global.Entity().DbRef(x => x.User, "User"); - } - - public ILiteCollection GetCollection() - { - return _db.GetCollection(); - } - - public void Close() - { - _db.Dispose(); - } - - private readonly LiteDatabase _db; - - public ILiteCollection CollOfAircraft => _db.GetCollection(); - - public ILiteCollection CollOfDropZone => _db.GetCollection(); - - public ILiteCollection CollOfGear => _db.GetCollection(); - - public ILiteCollection CollOfJumpType => _db.GetCollection(); - - public ILiteCollection CollOfJump => _db.GetCollection(); - - public ILiteCollection CollOfUser => _db.GetCollection(); - - public ILiteCollection CollOfImage => _db.GetCollection(); - } -} diff --git a/Back/skydiveLogs-api.Data/UserImageRepository.cs b/Back/skydiveLogs-api.Data/UserImageRepository.cs deleted file mode 100644 index 375d089..0000000 --- a/Back/skydiveLogs-api.Data/UserImageRepository.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections.Generic; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class UserImageRepository : IUserImageRepository - { - public UserImageRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfImage; - } - - public IEnumerable GetAll() - { - throw new System.NotImplementedException(); - } - - public IEnumerable GetAll(User user) - { - return _col.Include(x => x.User) - .Query() - .Where(j => j.User == user) - .ToList(); - } - - public UserImage GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Update(UserImage image) - { - return _col.Update(image); - } - - public bool Add(UserImage newImage) - { - var result = true; - - try - { - _col.Insert(newImage); - } - catch - { - result = false; - } - - return result; - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/UserRepository.cs b/Back/skydiveLogs-api.Data/UserRepository.cs deleted file mode 100644 index 883bf5d..0000000 --- a/Back/skydiveLogs-api.Data/UserRepository.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; - -using LiteDB; - -using skydiveLogs_api.Domain; -using skydiveLogs_api.DomainService.Repositories; -using skydiveLogs_api.Infrastructure.Interfaces; - - -namespace skydiveLogs_api.Infrastructure -{ - public class UserRepository : IUserRepository - { - public UserRepository(IDataProvider dataProvider) - { - _dataProvider = dataProvider; - _col = _dataProvider.CollOfUser; - } - - public User GetByLogin(string login, string password) - { - return _col.FindOne(u => u.Login == login && u.Password == password); - } - - public bool Add(User newUser) - { - var result = true; - - try - { - _col.Insert(newUser); - } - catch - { - result = false; - } - - return result; - } - - public IEnumerable GetAll() - { - throw new NotImplementedException(); - } - - public User GetById(int id) - { - return _col.FindById(new BsonValue(id)); - } - - public bool Update(User updated) - { - throw new NotImplementedException(); - } - - private readonly IDataProvider _dataProvider; - - private readonly ILiteCollection _col; - } -} diff --git a/Back/skydiveLogs-api.Data/skydiveLogs-api.Infrastructure.csproj b/Back/skydiveLogs-api.Data/skydiveLogs-api.Infrastructure.csproj deleted file mode 100644 index 2fd1fa5..0000000 --- a/Back/skydiveLogs-api.Data/skydiveLogs-api.Infrastructure.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net5.0 - skydiveLogs_api.Infrastructure - - - - - - - - - - - - diff --git a/Back/skydiveLogs-api.Domain/Aircraft.cs b/Back/skydiveLogs-api.Domain/Aircraft.cs index 019e73e..e657399 100644 --- a/Back/skydiveLogs-api.Domain/Aircraft.cs +++ b/Back/skydiveLogs-api.Domain/Aircraft.cs @@ -2,10 +2,13 @@ { public class Aircraft { + #region Public Properties + public int Id { get; set; } + public string ImageData { get; set; } public string Name { get; set; } - public string ImageData { get; set; } + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/DatabaseOptions.cs b/Back/skydiveLogs-api.Domain/DatabaseOptions.cs index 670c418..fd0db32 100644 --- a/Back/skydiveLogs-api.Domain/DatabaseOptions.cs +++ b/Back/skydiveLogs-api.Domain/DatabaseOptions.cs @@ -2,6 +2,10 @@ { public class DatabaseOptions { + #region Public Properties + public string ConnectionString { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/DropZone.cs b/Back/skydiveLogs-api.Domain/DropZone.cs index 71d8038..60f4144 100644 --- a/Back/skydiveLogs-api.Domain/DropZone.cs +++ b/Back/skydiveLogs-api.Domain/DropZone.cs @@ -4,22 +4,21 @@ namespace skydiveLogs_api.Domain { public class DropZone { + #region Public Properties + + public string Address { get; set; } + public string Email { get; set; } public int Id { get; set; } - public string Latitude { get; set; } + public bool IsFavorite { get; set; } + public string Latitude { get; set; } public string Longitude { get; set; } public string Name { get; set; } - - public string Address { get; set; } - + public IEnumerable Type { get; set; } public string Website { get; set; } - public string Email { get; set; } - - public IEnumerable Type { get; set; } - - public bool IsFavorite { get; set; } + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/FavoriteDropZone.cs b/Back/skydiveLogs-api.Domain/FavoriteDropZone.cs index 50c164b..dc3adbd 100644 --- a/Back/skydiveLogs-api.Domain/FavoriteDropZone.cs +++ b/Back/skydiveLogs-api.Domain/FavoriteDropZone.cs @@ -2,10 +2,12 @@ { public class FavoriteDropZone { - public int Id { get; set; } + #region Public Properties public DropZone DropZone { get; set; } - + public int Id { get; set; } public User User { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/Gear.cs b/Back/skydiveLogs-api.Domain/Gear.cs index 141ea74..6d95a8e 100644 --- a/Back/skydiveLogs-api.Domain/Gear.cs +++ b/Back/skydiveLogs-api.Domain/Gear.cs @@ -2,22 +2,20 @@ { public class Gear { - public int Id { get; set; } - - public string Name { get; set; } - - public string Manufacturer { get; set; } - - public int MinSize { get; set; } - - public int MaxSize { get; set; } + #region Public Properties public string Aad { get; set; } + public int Id { get; set; } public string MainCanopy { get; set; } - + public string Manufacturer { get; set; } + public int MaxSize { get; set; } + public int MinSize { get; set; } + public string Name { get; set; } public string ReserveCanopy { get; set; } public User User { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/Jump.cs b/Back/skydiveLogs-api.Domain/Jump.cs index d5e421a..9a37639 100644 --- a/Back/skydiveLogs-api.Domain/Jump.cs +++ b/Back/skydiveLogs-api.Domain/Jump.cs @@ -4,28 +4,22 @@ namespace skydiveLogs_api.Domain { public class Jump { - public int Id { get; set; } - - public JumpType JumpType { get; set; } + #region Public Properties public Aircraft Aircraft { get; set; } - - public DropZone DropZone { get; set; } - - public Gear Gear { get; set; } - - public User User { get; set; } - - public int ExitAltitude { get; set; } - public int DeployAltitude { get; set; } - - public bool WithCutaway { get; set; } - - public string Notes { get; set; } - - public DateTime JumpDate { get; set; } + public DropZone DropZone { get; set; } + public int ExitAltitude { get; set; } + public Gear Gear { get; set; } + public int Id { get; set; } public bool IsSpecial { get; set; } + public DateTime JumpDate { get; set; } + public JumpType JumpType { get; set; } + public string Notes { get; set; } + public User User { get; set; } + public bool WithCutaway { get; set; } + + #endregion Public Properties } } \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/JumpType.cs b/Back/skydiveLogs-api.Domain/JumpType.cs index 60a5279..1e1bf6d 100644 --- a/Back/skydiveLogs-api.Domain/JumpType.cs +++ b/Back/skydiveLogs-api.Domain/JumpType.cs @@ -2,8 +2,12 @@ { public class JumpType { + #region Public Properties + public int Id { get; set; } public string Name { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/SimpleSummary.cs b/Back/skydiveLogs-api.Domain/SimpleSummary.cs index 44f6abd..f79af50 100644 --- a/Back/skydiveLogs-api.Domain/SimpleSummary.cs +++ b/Back/skydiveLogs-api.Domain/SimpleSummary.cs @@ -2,10 +2,12 @@ { public class SimpleSummary { - public int TotalJumps { get; set; } - - public int TotalCutaways { get; set; } + #region Public Properties public Jump LastJump { get; set; } + public int TotalCutaways { get; set; } + public int TotalJumps { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/Statistic.cs b/Back/skydiveLogs-api.Domain/Statistic.cs index 4506743..4360bd4 100644 --- a/Back/skydiveLogs-api.Domain/Statistic.cs +++ b/Back/skydiveLogs-api.Domain/Statistic.cs @@ -2,8 +2,12 @@ { public class Statistic { + #region Public Properties + public string Label { get; set; } public int Nb { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/User.cs b/Back/skydiveLogs-api.Domain/User.cs index 83071bb..5c27e76 100644 --- a/Back/skydiveLogs-api.Domain/User.cs +++ b/Back/skydiveLogs-api.Domain/User.cs @@ -2,20 +2,19 @@ { public class User { - public int Id { get; set; } + #region Public Properties public string Email { get; set; } - public string FirstName { get; set; } - + public int Id { get; set; } + public bool IsAdmin { get; set; } + public string Language { get; set; } public string LastName { get; set; } public string Login { get; set; } public string Password { get; set; } - public bool IsAdmin { get; set; } - - public string Language { get; set; } + #endregion Public Properties } } \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/UserImage.cs b/Back/skydiveLogs-api.Domain/UserImage.cs index 3f8cbda..d3e110c 100644 --- a/Back/skydiveLogs-api.Domain/UserImage.cs +++ b/Back/skydiveLogs-api.Domain/UserImage.cs @@ -2,12 +2,13 @@ { public class UserImage { - public int Id { get; set; } + #region Public Properties public string Comment { get; set; } - public string Data { get; set; } - + public int Id { get; set; } public User User { get; set; } + + #endregion Public Properties } -} +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.Domain/UserStats.cs b/Back/skydiveLogs-api.Domain/UserStats.cs new file mode 100644 index 0000000..19c158f --- /dev/null +++ b/Back/skydiveLogs-api.Domain/UserStats.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +namespace skydiveLogs_api.Domain +{ + public class UserStats + { + #region Public Constructors + + public UserStats() + { + ByAircraft = new List(); + ByDz = new List(); + ByGear = new List(); + ByJumpType = new List(); + ByYear = new List(); + ForLastMonthByDz = new List(); + ForLastMonthByJumpType = new List(); + ForLastYearByDz = new List(); + ForLastYearByJumpType = new List(); + } + + #endregion Public Constructors + + #region Public Properties + + public IEnumerable ByAircraft { get; set; } + public IEnumerable ByDz { get; set; } + public IEnumerable ByGear { get; set; } + public IEnumerable ByJumpType { get; set; } + public IEnumerable ByYear { get; set; } + public IEnumerable ForLastMonthByDz { get; set; } + public IEnumerable ForLastMonthByJumpType { get; set; } + public IEnumerable ForLastYearByDz { get; set; } + public IEnumerable ForLastYearByJumpType { get; set; } + public int Id { get; set; } + public User User { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/Back/skydiveLogs-api.DomainBusiness/CacheService.cs b/Back/skydiveLogs-api.DomainBusiness/CacheService.cs index 8eeb702..2e76594 100644 --- a/Back/skydiveLogs-api.DomainBusiness/CacheService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/CacheService.cs @@ -9,27 +9,27 @@ namespace skydiveLogs_api.DomainBusiness { #region Public Methods - public bool Contains(CacheType type, int id = 0) + public bool Contains(CacheType type, int userId = 0) { - var key = GetKey(id, type); + var key = GetKey(userId, type); return MemoryCache.Default[key.ToString()] != null; } - public void Delete(CacheType type, int id = 0) + public void Delete(CacheType type, int userId = 0) { - var key = GetKey(id, type); + var key = GetKey(userId, type); MemoryCache.Default.Remove(key.ToString()); } - public T Get(CacheType type, int id = 0) + public T Get(CacheType type, int userId = 0) { - var key = GetKey(id, type); + var key = GetKey(userId, type); return (T)MemoryCache.Default[key.ToString()]; } - public void Put(CacheType type, object value, int duration, int id = 0) + public void Put(CacheType type, object value, int duration, int userId = 0) { - var key = GetKey(id, type); + var key = GetKey(userId, type); if (duration <= 0) throw new ArgumentException("Duration cannot be less or equal to zero", "duration"); @@ -41,9 +41,9 @@ namespace skydiveLogs_api.DomainBusiness MemoryCache.Default.Set(key.ToString(), value, policy); } - private string GetKey(int id, CacheType type) + private string GetKey(int userId, CacheType type) { - return $"{id}-{type}"; + return $"{userId}-{type}"; } #endregion Public Methods diff --git a/Back/skydiveLogs-api.DomainBusiness/GearService.cs b/Back/skydiveLogs-api.DomainBusiness/GearService.cs index ce47765..1e51c64 100644 --- a/Back/skydiveLogs-api.DomainBusiness/GearService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/GearService.cs @@ -30,7 +30,7 @@ namespace skydiveLogs_api.DomainBusiness _gearRepository.Add(newGear); var userId = _identityService.ConnectedUser.Id; - _cacheService.Delete(CacheType.Gear, id: userId); + _cacheService.Delete(CacheType.Gear, userId: userId); } public void AddRentalGear(User newUser) @@ -58,13 +58,13 @@ namespace skydiveLogs_api.DomainBusiness public IEnumerable GetAllGears() { var userId = _identityService.ConnectedUser.Id; - if (!_cacheService.Contains(CacheType.Gear, id: userId)) + if (!_cacheService.Contains(CacheType.Gear, userId: userId)) _cacheService.Put(CacheType.Gear, _gearRepository.GetAll(_identityService.ConnectedUser), 5 * 60 * 1000, - id: userId); + userId: userId); - return _cacheService.Get>(CacheType.Gear, id: userId); + return _cacheService.Get>(CacheType.Gear, userId: userId); } public Gear GetGearById(int id) diff --git a/Back/skydiveLogs-api.DomainBusiness/Interfaces/ICacheService.cs b/Back/skydiveLogs-api.DomainBusiness/Interfaces/ICacheService.cs index 3bb8805..e3948d2 100644 --- a/Back/skydiveLogs-api.DomainBusiness/Interfaces/ICacheService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/Interfaces/ICacheService.cs @@ -6,13 +6,13 @@ namespace skydiveLogs_api.DomainBusiness.Interfaces { #region Public Methods - bool Contains(CacheType type, int id = 0); + bool Contains(CacheType type, int userId = 0); - void Delete(CacheType type, int id = 0); + void Delete(CacheType type, int userId = 0); - T Get(CacheType type, int id = 0); + T Get(CacheType type, int userId = 0); - void Put(CacheType type, object value, int duration, int id = 0); + void Put(CacheType type, object value, int duration, int userId = 0); #endregion Public Methods } diff --git a/Back/skydiveLogs-api.DomainBusiness/Interfaces/IStatsService.cs b/Back/skydiveLogs-api.DomainBusiness/Interfaces/IStatsService.cs index 4626db1..343a97e 100644 --- a/Back/skydiveLogs-api.DomainBusiness/Interfaces/IStatsService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/Interfaces/IStatsService.cs @@ -26,6 +26,7 @@ namespace skydiveLogs_api.DomainBusiness.Interfaces IEnumerable GetStatsForLastYearByDz(); IEnumerable GetStatsForLastYearByJumpType(); + void Reset(); #endregion Public Methods } diff --git a/Back/skydiveLogs-api.DomainBusiness/JumpService.cs b/Back/skydiveLogs-api.DomainBusiness/JumpService.cs index ca2ce4e..e385143 100644 --- a/Back/skydiveLogs-api.DomainBusiness/JumpService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/JumpService.cs @@ -14,7 +14,8 @@ namespace skydiveLogs_api.DomainBusiness IDropZoneService dropZoneService, IGearService gearService, IJumpRepository jumpRepository, - IIdentityService identityService) + IIdentityService identityService, + IStatsService statsService) { _jumpTypeService = jumpTypeService; _aircraftService = aircraftService; @@ -22,6 +23,7 @@ namespace skydiveLogs_api.DomainBusiness _gearService = gearService; _jumpRepository = jumpRepository; _identityService = identityService; + _statsService = statsService; } #endregion Public Constructors @@ -46,11 +48,13 @@ namespace skydiveLogs_api.DomainBusiness jump.User = _identityService.ConnectedUser; _jumpRepository.Add(jump); + _statsService.Reset(); } public void DeleteJumpById(int id) { _jumpRepository.DeleteById(id); + _statsService.Reset(); } public IEnumerable GetAllJumps() @@ -83,6 +87,7 @@ namespace skydiveLogs_api.DomainBusiness private readonly IIdentityService _identityService; private readonly IJumpRepository _jumpRepository; private readonly IJumpTypeService _jumpTypeService; + private readonly IStatsService _statsService; #endregion Private Fields } diff --git a/Back/skydiveLogs-api.DomainBusiness/StatsService.cs b/Back/skydiveLogs-api.DomainBusiness/StatsService.cs index a921bea..4e8f2e5 100644 --- a/Back/skydiveLogs-api.DomainBusiness/StatsService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/StatsService.cs @@ -1,5 +1,6 @@ using skydiveLogs_api.Domain; using skydiveLogs_api.DomainBusiness.Interfaces; +using skydiveLogs_api.DomainService.Repositories; using System.Collections.Generic; using System.Linq; @@ -9,9 +10,13 @@ namespace skydiveLogs_api.DomainBusiness { #region Public Constructors - public StatsService(IJumpService jumpService) + public StatsService(IJumpService jumpService, + IUserStatsRepository userStatsRepository, + IIdentityService identityService) { _jumpService = jumpService; + _identityService = identityService; + _userStatsRepository = userStatsRepository; } #endregion Public Constructors @@ -40,207 +45,296 @@ namespace skydiveLogs_api.DomainBusiness public IEnumerable GetStatsByAircraft() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ByAircraft.Any()) { - results = allJumps.GroupBy(j => j.Aircraft.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); + + if (allJumps.Any()) + { + results = allJumps.GroupBy(j => j.Aircraft.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ByAircraft = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ByAircraft; } public IEnumerable GetStatsByDz() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ByDz.Any()) { - results = allJumps.GroupBy(j => j.DropZone.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); + + if (allJumps.Any()) + { + results = allJumps.GroupBy(j => j.DropZone.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ByDz = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ByDz; } public IEnumerable GetStatsByGear() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ByGear.Any()) { - results = allJumps.GroupBy(j => $"{j.Gear.Name} / {j.Gear.MainCanopy}", - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); + + if (allJumps.Any()) + { + results = allJumps.GroupBy(j => $"{j.Gear.Name} / {j.Gear.MainCanopy}", + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ByGear = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ByGear; } public IEnumerable GetStatsByJumpType() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ByJumpType.Any()) { - results = allJumps.GroupBy(j => j.JumpType.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); + + if (allJumps.Any()) + { + results = allJumps.GroupBy(j => j.JumpType.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ByJumpType = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ByJumpType; } public IEnumerable GetStatsByYear() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ByYear.Any()) { - results = allJumps.GroupBy(j => j.JumpDate.Year, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); + + if (allJumps.Any()) + { + results = allJumps.GroupBy(j => j.JumpDate.Year, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ByYear = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ByYear; } public IEnumerable GetStatsForLastMonthByDz() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ForLastMonthByDz.Any()) { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; - var monthOfLastJump = lastJump.JumpDate.Month; + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump && j.JumpDate.Month == monthOfLastJump) - .GroupBy(j => j.DropZone.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + if (allJumps.Any()) + { + var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); + var yearOfLastJump = lastJump.JumpDate.Year; + var monthOfLastJump = lastJump.JumpDate.Month; + + results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump && j.JumpDate.Month == monthOfLastJump) + .GroupBy(j => j.DropZone.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ForLastMonthByDz = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ForLastMonthByDz; } public IEnumerable GetStatsForLastMonthByJumpType() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ForLastMonthByJumpType.Any()) { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; - var monthOfLastJump = lastJump.JumpDate.Month; + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump && j.JumpDate.Month == monthOfLastJump) - .GroupBy(j => j.JumpType.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + if (allJumps.Any()) + { + var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); + var yearOfLastJump = lastJump.JumpDate.Year; + var monthOfLastJump = lastJump.JumpDate.Month; + + results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump && j.JumpDate.Month == monthOfLastJump) + .GroupBy(j => j.JumpType.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ForLastMonthByJumpType = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ForLastMonthByJumpType; } public IEnumerable GetStatsForLastYearByDz() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ForLastYearByDz.Any()) { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump) - .GroupBy(j => j.DropZone.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + if (allJumps.Any()) + { + var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); + var yearOfLastJump = lastJump.JumpDate.Year; + + results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump) + .GroupBy(j => j.DropZone.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ForLastYearByDz = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ForLastYearByDz; } public IEnumerable GetStatsForLastYearByJumpType() { - var allJumps = _jumpService.GetAllJumps(); - var results = new List(); - - if (allJumps.Any()) + var allStats = GetAllStats(); + if (!allStats.ForLastYearByJumpType.Any()) { - var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); - var yearOfLastJump = lastJump.JumpDate.Year; + var allJumps = _jumpService.GetAllJumps(); + var results = new List(); - results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump) - .GroupBy(j => j.JumpType.Name, - j => j, - (groupby, jumps) => new Statistic - { - Label = groupby.ToString(), - Nb = jumps.Count() - }) - .ToList(); + if (allJumps.Any()) + { + var lastJump = allJumps.OrderByDescending(j => j.JumpDate).First(); + var yearOfLastJump = lastJump.JumpDate.Year; + + results = allJumps.Where(j => j.JumpDate.Year == yearOfLastJump) + .GroupBy(j => j.JumpType.Name, + j => j, + (groupby, jumps) => new Statistic + { + Label = groupby.ToString(), + Nb = jumps.Count() + }) + .ToList(); + } + + allStats.ForLastYearByJumpType = results; + _userStatsRepository.Update(allStats); } - return results; + return allStats.ForLastYearByJumpType; + } + + public void Reset() + { + var tmp = new UserStats(); + tmp.User = _identityService.ConnectedUser; + _userStatsRepository.Add(tmp); } #endregion Public Methods + #region Private Methods + + private UserStats GetAllStats() + { + var allStats = _userStatsRepository.GetAll(_identityService.ConnectedUser); + if (allStats == null) + { + allStats = new UserStats(); + allStats.User = _identityService.ConnectedUser; + _userStatsRepository.Add(allStats); + } + + return allStats; + } + + #endregion Private Methods + #region Private Fields + private readonly IIdentityService _identityService; private readonly IJumpService _jumpService; + private readonly IUserStatsRepository _userStatsRepository; #endregion Private Fields } diff --git a/Back/skydiveLogs-api.DomainService/Repositories/IUserStatsRepository.cs b/Back/skydiveLogs-api.DomainService/Repositories/IUserStatsRepository.cs new file mode 100644 index 0000000..ef462a7 --- /dev/null +++ b/Back/skydiveLogs-api.DomainService/Repositories/IUserStatsRepository.cs @@ -0,0 +1,13 @@ +using skydiveLogs_api.Domain; + +namespace skydiveLogs_api.DomainService.Repositories +{ + public interface IUserStatsRepository : IRepository + { + #region Public Methods + + UserStats 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 650ce30..be6e900 100644 --- a/Back/skydiveLogs-api.Infrastructure/Interfaces/IDataProvider.cs +++ b/Back/skydiveLogs-api.Infrastructure/Interfaces/IDataProvider.cs @@ -26,6 +26,7 @@ namespace skydiveLogs_api.Infrastructure.Interfaces ILiteCollection CollOfImage { get; } ILiteCollection CollOfJump { get; } ILiteCollection CollOfJumpType { get; } + ILiteCollection CollOfStats { get; } ILiteCollection CollOfUser { get; } #endregion Public Properties diff --git a/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs b/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs index 17fa608..c540525 100644 --- a/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs +++ b/Back/skydiveLogs-api.Infrastructure/LiteDbProvider.cs @@ -21,6 +21,8 @@ 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"); @@ -52,6 +54,7 @@ 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(); #endregion Public Properties diff --git a/Back/skydiveLogs-api.Infrastructure/UserStatsRepository.cs b/Back/skydiveLogs-api.Infrastructure/UserStatsRepository.cs new file mode 100644 index 0000000..db31985 --- /dev/null +++ b/Back/skydiveLogs-api.Infrastructure/UserStatsRepository.cs @@ -0,0 +1,72 @@ +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 UserStatsRepository : IUserStatsRepository + { + #region Public Constructors + + public UserStatsRepository(IDataProvider dataProvider) + { + _dataProvider = dataProvider; + _col = _dataProvider.CollOfStats; + } + + #endregion Public Constructors + + #region Public Methods + + public int Add(UserStats 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 UserStats GetAll(User user) + { + return _col.Include(x => x.User) + .Query() + .Where(j => j.User.Id == user.Id) + .SingleOrDefault(); + } + + public UserStats GetById(int id) + { + throw new System.NotImplementedException(); + } + + public bool Update(UserStats 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 442f3ae..addf781 100644 --- a/Back/skydiveLogs-api.Ioc/IocService.cs +++ b/Back/skydiveLogs-api.Ioc/IocService.cs @@ -49,6 +49,7 @@ namespace skydiveLogs_api.Ioc _services.AddScoped(); _services.AddScoped(); _services.AddScoped(); + _services.AddScoped(); string connectionString = _configuration.GetConnectionString("DefaultConnection"); _services.AddSingleton(c => new LiteDbProvider(connectionString)); diff --git a/Back/skydiveLogs-api.Model/Aircraft.cs b/Back/skydiveLogs-api.Model/Aircraft.cs deleted file mode 100644 index 019e73e..0000000 --- a/Back/skydiveLogs-api.Model/Aircraft.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class Aircraft - { - public int Id { get; set; } - - public string Name { get; set; } - - public string ImageData { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/DatabaseOptions.cs b/Back/skydiveLogs-api.Model/DatabaseOptions.cs deleted file mode 100644 index 670c418..0000000 --- a/Back/skydiveLogs-api.Model/DatabaseOptions.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class DatabaseOptions - { - public string ConnectionString { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/DropZone.cs b/Back/skydiveLogs-api.Model/DropZone.cs deleted file mode 100644 index 71d8038..0000000 --- a/Back/skydiveLogs-api.Model/DropZone.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; - -namespace skydiveLogs_api.Domain -{ - public class DropZone - { - public int Id { get; set; } - - public string Latitude { get; set; } - - public string Longitude { get; set; } - - public string Name { get; set; } - - public string Address { get; set; } - - public string Website { get; set; } - - public string Email { get; set; } - - public IEnumerable Type { get; set; } - - public bool IsFavorite { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/Gear.cs b/Back/skydiveLogs-api.Model/Gear.cs deleted file mode 100644 index 141ea74..0000000 --- a/Back/skydiveLogs-api.Model/Gear.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class Gear - { - public int Id { get; set; } - - public string Name { get; set; } - - public string Manufacturer { get; set; } - - public int MinSize { get; set; } - - public int MaxSize { get; set; } - - public string Aad { get; set; } - - public string MainCanopy { get; set; } - - public string ReserveCanopy { get; set; } - - public User User { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/Jump.cs b/Back/skydiveLogs-api.Model/Jump.cs deleted file mode 100644 index 6d76752..0000000 --- a/Back/skydiveLogs-api.Model/Jump.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace skydiveLogs_api.Domain -{ - public class Jump - { - public int Id { get; set; } - - public JumpType JumpType { get; set; } - - public Aircraft Aircraft { get; set; } - - public DropZone DropZone { get; set; } - - public Gear Gear { get; set; } - - public User User { get; set; } - - public int ExitAltitude { get; set; } - - public int DeployAltitude { get; set; } - - public bool WithCutaway { get; set; } - - public string Notes { get; set; } - - public DateTime JumpDate { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/JumpType.cs b/Back/skydiveLogs-api.Model/JumpType.cs deleted file mode 100644 index 60a5279..0000000 --- a/Back/skydiveLogs-api.Model/JumpType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class JumpType - { - public int Id { get; set; } - - public string Name { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/SimpleSummary.cs b/Back/skydiveLogs-api.Model/SimpleSummary.cs deleted file mode 100644 index 44f6abd..0000000 --- a/Back/skydiveLogs-api.Model/SimpleSummary.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class SimpleSummary - { - public int TotalJumps { get; set; } - - public int TotalCutaways { get; set; } - - public Jump LastJump { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/Statistic.cs b/Back/skydiveLogs-api.Model/Statistic.cs deleted file mode 100644 index 4506743..0000000 --- a/Back/skydiveLogs-api.Model/Statistic.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class Statistic - { - public string Label { get; set; } - - public int Nb { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/User.cs b/Back/skydiveLogs-api.Model/User.cs deleted file mode 100644 index 9f6e320..0000000 --- a/Back/skydiveLogs-api.Model/User.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class User - { - public int Id { get; set; } - - public string Email { get; set; } - - public string FirstName { get; set; } - - public string LastName { get; set; } - - public string Login { get; set; } - - public string Password { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/UserImage.cs b/Back/skydiveLogs-api.Model/UserImage.cs deleted file mode 100644 index 3f8cbda..0000000 --- a/Back/skydiveLogs-api.Model/UserImage.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace skydiveLogs_api.Domain -{ - public class UserImage - { - public int Id { get; set; } - - public string Comment { get; set; } - - public string Data { get; set; } - - public User User { get; set; } - } -} diff --git a/Back/skydiveLogs-api.Model/skydiveLogs-api.Domain.csproj b/Back/skydiveLogs-api.Model/skydiveLogs-api.Domain.csproj deleted file mode 100644 index 46a0374..0000000 --- a/Back/skydiveLogs-api.Model/skydiveLogs-api.Domain.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - net5.0 - skydiveLogs_api.Domain - - - diff --git a/Back/skydiveLogs-api/skydiveLogs-api.csproj b/Back/skydiveLogs-api/skydiveLogs-api.csproj index 2749c8f..8100da7 100644 --- a/Back/skydiveLogs-api/skydiveLogs-api.csproj +++ b/Back/skydiveLogs-api/skydiveLogs-api.csproj @@ -20,7 +20,7 @@ - +