Little update around the controllers
This commit is contained in:
@@ -6,6 +6,8 @@ namespace skydiveLogs_api.Business.Interface
|
||||
{
|
||||
User GetByLogin(string login, string password);
|
||||
|
||||
User GetById(int userId);
|
||||
|
||||
void AddNewUser(User user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using skydiveLogs_api.Business.Interface;
|
||||
using skydiveLogs_api.Model;
|
||||
using skydiveLogs_api.Data.Interface;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
using skydiveLogs_api.Business.Interface;
|
||||
using skydiveLogs_api.Model;
|
||||
using skydiveLogs_api.Data.Interface;
|
||||
|
||||
|
||||
namespace skydiveLogs_api.Business
|
||||
{
|
||||
public class UserService : IUserService
|
||||
@@ -15,11 +17,14 @@ namespace skydiveLogs_api.Business
|
||||
_userRepository = userRepository;
|
||||
}
|
||||
|
||||
public User GetById(int userId)
|
||||
{
|
||||
return _userRepository.GetById(userId);
|
||||
}
|
||||
|
||||
public User GetByLogin(string login, string password)
|
||||
{
|
||||
var tmp = _userRepository.GetByLogin(login, EncryptPassword(password));
|
||||
|
||||
return tmp;
|
||||
return _userRepository.GetByLogin(login, EncryptPassword(password));
|
||||
}
|
||||
|
||||
public void AddNewUser(User newUser)
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace skydiveLogs_api.Data
|
||||
|
||||
public User GetById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool Update(User updated)
|
||||
|
||||
@@ -11,8 +11,6 @@ using skydiveLogs_api.Model;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AircraftController : Base
|
||||
{
|
||||
public AircraftController(IAircraftService aircraftService,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using skydiveLogs_api.Model;
|
||||
@@ -8,6 +10,9 @@ using skydiveLogs_api.Model;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
public class Base : ControllerBase
|
||||
{
|
||||
public User ConnectedUser
|
||||
|
||||
@@ -11,8 +11,6 @@ using skydiveLogs_api.Model;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class DropZoneController : Base
|
||||
{
|
||||
public DropZoneController(IDropZoneService dropZoneService,
|
||||
|
||||
@@ -11,8 +11,6 @@ using skydiveLogs_api.Model;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GearController : Base
|
||||
{
|
||||
public GearController(IGearService gearService,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
|
||||
using AutoMapper;
|
||||
|
||||
@@ -10,14 +8,9 @@ using skydiveLogs_api.Business.Interface;
|
||||
using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.Model;
|
||||
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
public class JumpController : Base
|
||||
{
|
||||
public JumpController(IJumpService jumpService,
|
||||
|
||||
@@ -11,8 +11,6 @@ using skydiveLogs_api.Model;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class JumpTypeController : Base
|
||||
{
|
||||
public JumpTypeController(IJumpTypeService jumpTypeService,
|
||||
|
||||
@@ -10,8 +10,6 @@ using skydiveLogs_api.DataContract;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class StatsController : Base
|
||||
{
|
||||
public StatsController(IStatsService statsService,
|
||||
|
||||
@@ -5,6 +5,10 @@ using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Security.Claims;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using AutoMapper;
|
||||
|
||||
@@ -12,10 +16,6 @@ using skydiveLogs_api.Business.Interface;
|
||||
using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.Model;
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Security.Claims;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
|
||||
BIN
Back/skydiveLogs-api/Data/JumpsDb-log.db
Normal file
BIN
Back/skydiveLogs-api/Data/JumpsDb-log.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user