Beging to add the authorization with a JWT token

This commit is contained in:
Sébastien André
2020-03-19 21:33:09 +01:00
parent 170ccbd9c5
commit 7bb702e46c
9 changed files with 132 additions and 17 deletions

View File

@@ -7,15 +7,16 @@ namespace skydiveLogs_api.Business.Interface
{
public interface IJumpService
{
IEnumerable<Jump> GetAllJumps();
IEnumerable<Jump> GetAllJumps(User connectedUser);
Jump GetJumpById(int id);
void AddNewJump(int aircraftId,
int dzId,
int jumpTypeId,
int gearId,
Jump jump);
int gearId,
Jump jump,
User connectedUser);
void UpdateJump(int id, Jump jump);

View File

@@ -27,7 +27,8 @@ namespace skydiveLogs_api.Business
int dzId,
int jumpTypeId,
int gearId,
Jump jump)
Jump jump,
User connectedUser)
{
var selectedGear = _gearService.GetGearById(gearId);
var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId);
@@ -38,6 +39,7 @@ namespace skydiveLogs_api.Business
jump.JumpType = selectedJumpType;
jump.DropZone = selectedDropZone;
jump.Gear = selectedGear;
jump.UserId = connectedUser.Id;
_jumpRepository.Add(jump);
}
@@ -47,9 +49,9 @@ namespace skydiveLogs_api.Business
throw new NotImplementedException();
}
public IEnumerable<Jump> GetAllJumps()
public IEnumerable<Jump> GetAllJumps(User connectedUser)
{
return _jumpRepository.GetAll();
return _jumpRepository.GetAll(connectedUser.Id);
}
public Jump GetJumpById(int id)