medicalHistory: deletion when patient is deleted
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
using Application.Endpoints;
|
using Application.Endpoints;
|
||||||
using Application.Endpoints.Appointments;
|
using Application.Endpoints.Appointments;
|
||||||
using Application.Services.Database;
|
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.MongoDB;
|
||||||
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace API.Controllers;
|
namespace API.Controllers;
|
||||||
@@ -9,8 +9,8 @@ namespace API.Controllers;
|
|||||||
public class AppointmentsController : BaseApiController
|
public class AppointmentsController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public AppointmentsController(IAppointmentsMongoDbService appointmentsMongoDbService,
|
public AppointmentsController(IAppointmentsMongoDbService appointmentsMongoDbService,
|
||||||
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
|
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
|
||||||
@@ -23,7 +23,8 @@ public class AppointmentsController : BaseApiController
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult<BaseResponse>> CreateAppointment(AppointmentManagementDto dto)
|
public async Task<ActionResult<BaseResponse>> CreateAppointment(AppointmentManagementDto dto)
|
||||||
{
|
{
|
||||||
var handler = new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
|
var handler =
|
||||||
|
new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
|
||||||
var response = await handler.HandleCreateAppointment(dto).ConfigureAwait(false);
|
var response = await handler.HandleCreateAppointment(dto).ConfigureAwait(false);
|
||||||
return StatusCode(response.StatusCode, response);
|
return StatusCode(response.StatusCode, response);
|
||||||
}
|
}
|
||||||
@@ -31,7 +32,8 @@ public class AppointmentsController : BaseApiController
|
|||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public async Task<ActionResult<BaseResponse>> DeleteAppointment(AppointmentManagementDto dto)
|
public async Task<ActionResult<BaseResponse>> DeleteAppointment(AppointmentManagementDto dto)
|
||||||
{
|
{
|
||||||
var handler = new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
|
var handler =
|
||||||
|
new AppointmentManagementHandler(_appointmentsMongoDbService, _patientRepository, _doctorRepository);
|
||||||
var response = await handler.HandleDeleteAppointment(dto).ConfigureAwait(false);
|
var response = await handler.HandleDeleteAppointment(dto).ConfigureAwait(false);
|
||||||
return StatusCode(response.StatusCode, response);
|
return StatusCode(response.StatusCode, response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Application.Endpoints;
|
using Application.Endpoints;
|
||||||
using Application.Endpoints.Chats;
|
using Application.Endpoints.Chats;
|
||||||
using Application.Services.Database;
|
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.MongoDB;
|
||||||
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace API.Controllers;
|
namespace API.Controllers;
|
||||||
@@ -9,8 +9,8 @@ namespace API.Controllers;
|
|||||||
public class ChatController : BaseApiController
|
public class ChatController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly IChatMongoDbService _chatMongoDbService;
|
private readonly IChatMongoDbService _chatMongoDbService;
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public ChatController(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
|
public ChatController(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
|
||||||
IDoctorRepository doctorRepository)
|
IDoctorRepository doctorRepository)
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ using Application.Endpoints.Doctors.Login;
|
|||||||
using Application.Endpoints.Doctors.Profile;
|
using Application.Endpoints.Doctors.Profile;
|
||||||
using Application.Endpoints.Doctors.Registration;
|
using Application.Endpoints.Doctors.Registration;
|
||||||
using Application.Endpoints.Doctors.ResetPassword;
|
using Application.Endpoints.Doctors.ResetPassword;
|
||||||
using Application.Services.Database;
|
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.MongoDB;
|
||||||
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
using Application.Services.Jwt;
|
using Application.Services.Jwt;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
@@ -16,10 +16,10 @@ namespace API.Controllers;
|
|||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class DoctorsController : ControllerBase
|
public class DoctorsController : ControllerBase
|
||||||
{
|
{
|
||||||
|
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||||
private readonly IDoctorRepository _database;
|
private readonly IDoctorRepository _database;
|
||||||
private readonly IHashingAlgorithms _hashingAlgorithms;
|
private readonly IHashingAlgorithms _hashingAlgorithms;
|
||||||
private readonly IJwtService _jwtService;
|
private readonly IJwtService _jwtService;
|
||||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
|
||||||
|
|
||||||
public DoctorsController(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms,
|
public DoctorsController(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms,
|
||||||
IJwtService jwtService, IAppointmentsMongoDbService appointmentsMongoDbService)
|
IJwtService jwtService, IAppointmentsMongoDbService appointmentsMongoDbService)
|
||||||
@@ -61,28 +61,23 @@ public class DoctorsController : ControllerBase
|
|||||||
{
|
{
|
||||||
var authorizationHeader = Request.Headers["Authorization"].FirstOrDefault();
|
var authorizationHeader = Request.Headers["Authorization"].FirstOrDefault();
|
||||||
if (string.IsNullOrEmpty(authorizationHeader) || !authorizationHeader.StartsWith("Bearer "))
|
if (string.IsNullOrEmpty(authorizationHeader) || !authorizationHeader.StartsWith("Bearer "))
|
||||||
{
|
|
||||||
return StatusCode(HttpStatusCodes.BadRequest, new BaseResponse
|
return StatusCode(HttpStatusCodes.BadRequest, new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.BadRequest,
|
StatusCode = HttpStatusCodes.BadRequest,
|
||||||
Message = "Invalid request header format.",
|
Message = "Invalid request header format.",
|
||||||
Data = null
|
Data = null
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
var oldToken = authorizationHeader.Substring("Bearer ".Length).Trim();
|
var oldToken = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
|
||||||
if (!_jwtService.ValidateJwtToken(oldToken))
|
if (!_jwtService.ValidateJwtToken(oldToken))
|
||||||
{
|
|
||||||
return StatusCode(HttpStatusCodes.Unauthorized, new BaseResponse
|
return StatusCode(HttpStatusCodes.Unauthorized, new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.Unauthorized,
|
StatusCode = HttpStatusCodes.Unauthorized,
|
||||||
Message = "Invalid JWT token.",
|
Message = "Invalid JWT token.",
|
||||||
Data = null
|
Data = null
|
||||||
});
|
});
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var newToken = _jwtService.RefreshToken(oldToken);
|
var newToken = _jwtService.RefreshToken(oldToken);
|
||||||
return StatusCode(HttpStatusCodes.OK, new BaseResponse
|
return StatusCode(HttpStatusCodes.OK, new BaseResponse
|
||||||
{
|
{
|
||||||
@@ -91,7 +86,6 @@ public class DoctorsController : ControllerBase
|
|||||||
Data = new { Token = newToken }
|
Data = new { Token = newToken }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("reset_password")]
|
[HttpPost("reset_password")]
|
||||||
public async Task<ActionResult<BaseResponse>> ResetPassword(DoctorResetPasswordDto resetDoctorDto)
|
public async Task<ActionResult<BaseResponse>> ResetPassword(DoctorResetPasswordDto resetDoctorDto)
|
||||||
@@ -131,10 +125,7 @@ public class DoctorsController : ControllerBase
|
|||||||
var handler = new DoctorProfileHandler(_database, _hashingAlgorithms);
|
var handler = new DoctorProfileHandler(_database, _hashingAlgorithms);
|
||||||
var response = await handler.HandleDelete(id).ConfigureAwait(false);
|
var response = await handler.HandleDelete(id).ConfigureAwait(false);
|
||||||
|
|
||||||
if (response.StatusCode < HttpStatusCodes.BadRequest)
|
if (response.StatusCode < HttpStatusCodes.BadRequest) DeleteDoctorAppointments(id);
|
||||||
{
|
|
||||||
DeleteDoctorAppointments(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return StatusCode(response.StatusCode, response);
|
return StatusCode(response.StatusCode, response);
|
||||||
}
|
}
|
||||||
@@ -146,10 +137,7 @@ public class DoctorsController : ControllerBase
|
|||||||
("DoctorId", doctorId.ToString())
|
("DoctorId", doctorId.ToString())
|
||||||
};
|
};
|
||||||
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
||||||
if (!appointments.Any())
|
if (!appointments.Any()) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await _appointmentsMongoDbService.DeleteByIdAsync<Appointment>(appointments[0].Id);
|
await _appointmentsMongoDbService.DeleteByIdAsync<Appointment>(appointments[0].Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Application.Endpoints;
|
using Application.Endpoints;
|
||||||
using Application.Endpoints.MedicalHistories.FileManagement;
|
using Application.Endpoints.MedicalHistories.FileManagement;
|
||||||
using Application.Endpoints.MedicalHistories.ManageAuthorization;
|
using Application.Endpoints.MedicalHistories.ManageAuthorization;
|
||||||
using Application.Services.Database;
|
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.MongoDB;
|
||||||
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace API.Controllers;
|
namespace API.Controllers;
|
||||||
@@ -11,10 +11,10 @@ namespace API.Controllers;
|
|||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class MedicalHistoryController : ControllerBase
|
public class MedicalHistoryController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
|
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||||
|
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||||
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository,
|
public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository,
|
||||||
IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService,
|
IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService,
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ using Application.Endpoints.Patients.Login;
|
|||||||
using Application.Endpoints.Patients.Profile;
|
using Application.Endpoints.Patients.Profile;
|
||||||
using Application.Endpoints.Patients.Registration;
|
using Application.Endpoints.Patients.Registration;
|
||||||
using Application.Endpoints.Patients.ResetPassword;
|
using Application.Endpoints.Patients.ResetPassword;
|
||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
using Application.Services.Jwt;
|
using Application.Services.Jwt;
|
||||||
using Core.Entities;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace API.Controllers;
|
namespace API.Controllers;
|
||||||
@@ -16,15 +15,17 @@ namespace API.Controllers;
|
|||||||
public class PatientsController : ControllerBase
|
public class PatientsController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IHashingAlgorithms _hashingAlgorithms;
|
private readonly IHashingAlgorithms _hashingAlgorithms;
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
private readonly IJwtService _jwtService;
|
private readonly IJwtService _jwtService;
|
||||||
|
private readonly IMedicalHistoryRepository _medicalHistory;
|
||||||
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public PatientsController(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms,
|
public PatientsController(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms,
|
||||||
IJwtService jwtService)
|
IJwtService jwtService, IMedicalHistoryRepository medicalHistory)
|
||||||
{
|
{
|
||||||
_patientRepository = patientRepository;
|
_patientRepository = patientRepository;
|
||||||
_hashingAlgorithms = hashingAlgorithms;
|
_hashingAlgorithms = hashingAlgorithms;
|
||||||
_jwtService = jwtService;
|
_jwtService = jwtService;
|
||||||
|
_medicalHistory = medicalHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -65,28 +66,23 @@ public class PatientsController : ControllerBase
|
|||||||
{
|
{
|
||||||
var authorizationHeader = Request.Headers["Authorization"].FirstOrDefault();
|
var authorizationHeader = Request.Headers["Authorization"].FirstOrDefault();
|
||||||
if (string.IsNullOrEmpty(authorizationHeader) || !authorizationHeader.StartsWith("Bearer "))
|
if (string.IsNullOrEmpty(authorizationHeader) || !authorizationHeader.StartsWith("Bearer "))
|
||||||
{
|
|
||||||
return StatusCode(HttpStatusCodes.BadRequest, new BaseResponse
|
return StatusCode(HttpStatusCodes.BadRequest, new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.BadRequest,
|
StatusCode = HttpStatusCodes.BadRequest,
|
||||||
Message = "Invalid request header format.",
|
Message = "Invalid request header format.",
|
||||||
Data = null
|
Data = null
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
var oldToken = authorizationHeader.Substring("Bearer ".Length).Trim();
|
var oldToken = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
|
||||||
if (!_jwtService.ValidateJwtToken(oldToken))
|
if (!_jwtService.ValidateJwtToken(oldToken))
|
||||||
{
|
|
||||||
return StatusCode(HttpStatusCodes.Unauthorized, new BaseResponse
|
return StatusCode(HttpStatusCodes.Unauthorized, new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.Unauthorized,
|
StatusCode = HttpStatusCodes.Unauthorized,
|
||||||
Message = "Invalid JWT token.",
|
Message = "Invalid JWT token.",
|
||||||
Data = null
|
Data = null
|
||||||
});
|
});
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var newToken = _jwtService.RefreshToken(oldToken);
|
var newToken = _jwtService.RefreshToken(oldToken);
|
||||||
return StatusCode(HttpStatusCodes.OK, new BaseResponse
|
return StatusCode(HttpStatusCodes.OK, new BaseResponse
|
||||||
{
|
{
|
||||||
@@ -95,7 +91,6 @@ public class PatientsController : ControllerBase
|
|||||||
Data = new { Token = newToken }
|
Data = new { Token = newToken }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("register")]
|
[HttpPost("register")]
|
||||||
public async Task<ActionResult<BaseResponse>> Register(PatientRegistrationDto patientRegistrationDto)
|
public async Task<ActionResult<BaseResponse>> Register(PatientRegistrationDto patientRegistrationDto)
|
||||||
@@ -126,6 +121,20 @@ public class PatientsController : ControllerBase
|
|||||||
{
|
{
|
||||||
var handler = new PatientProfileHandler(_patientRepository, _hashingAlgorithms);
|
var handler = new PatientProfileHandler(_patientRepository, _hashingAlgorithms);
|
||||||
var response = await handler.HandleDelete(id).ConfigureAwait(false);
|
var response = await handler.HandleDelete(id).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (response.StatusCode < HttpStatusCodes.BadRequest) DeleteMedicalHistory(id);
|
||||||
|
|
||||||
return StatusCode(response.StatusCode, response);
|
return StatusCode(response.StatusCode, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void DeleteMedicalHistory(Guid patientId)
|
||||||
|
{
|
||||||
|
var medicalHistoryList = await _medicalHistory.GetAllAsync();
|
||||||
|
foreach (var med in medicalHistoryList)
|
||||||
|
if (med.UserId == patientId)
|
||||||
|
{
|
||||||
|
await _medicalHistory.DeleteAsync(med);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,11 @@
|
|||||||
|
|
||||||
namespace API.Middlewares;
|
namespace API.Middlewares;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
public class ApiKeyMiddleware
|
public class ApiKeyMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
|
||||||
private const string API_KEY_HEADER_NAME = "ApiKey";
|
private const string API_KEY_HEADER_NAME = "ApiKey";
|
||||||
private readonly string _apiKey;
|
private readonly string _apiKey;
|
||||||
|
private readonly RequestDelegate _next;
|
||||||
|
|
||||||
public ApiKeyMiddleware(RequestDelegate next, IConfiguration configuration)
|
public ApiKeyMiddleware(RequestDelegate next, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Application.Endpoints;
|
using Application.Endpoints;
|
||||||
|
using Application.Services.Jwt;
|
||||||
|
|
||||||
namespace API.Middlewares;
|
namespace API.Middlewares;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Linq;
|
|
||||||
using Application.Services.Jwt;
|
|
||||||
|
|
||||||
public class JwtMiddleware
|
public class JwtMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
|
||||||
private readonly IJwtService _jwtService;
|
private readonly IJwtService _jwtService;
|
||||||
|
private readonly RequestDelegate _next;
|
||||||
|
|
||||||
public JwtMiddleware(RequestDelegate next, IJwtService jwtService)
|
public JwtMiddleware(RequestDelegate next, IJwtService jwtService)
|
||||||
{
|
{
|
||||||
@@ -24,7 +20,7 @@ public class JwtMiddleware
|
|||||||
var path = context.Request.Path.ToString().ToLower();
|
var path = context.Request.Path.ToString().ToLower();
|
||||||
|
|
||||||
// Define the paths that should bypass JWT validation
|
// Define the paths that should bypass JWT validation
|
||||||
var bypassPaths = new string[]
|
var bypassPaths = new[]
|
||||||
{
|
{
|
||||||
"/api/doctors/login",
|
"/api/doctors/login",
|
||||||
"/api/doctors/register",
|
"/api/doctors/register",
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
using System.Text;
|
|
||||||
using API.Middlewares;
|
using API.Middlewares;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Data;
|
using Infrastructure.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("API")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("API")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8663a186a056b0dfbfeebf9ae16be42b40101093")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+13bfa2bdd901a8b258d4cf881b5bb079066ab1c6")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("API")]
|
[assembly: System.Reflection.AssemblyProductAttribute("API")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
a61f57beead854c5be97ca0cf9336ea23b19a3b596fd07a95a410574950b1887
|
8e0774eef99f1b59f0ed0c9c924ec32f6e145f2aa7df39a7b5a2d83ccc6da96b
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Endpoints.Appointments;
|
namespace Application.Endpoints.Appointments;
|
||||||
@@ -7,8 +7,8 @@ namespace Application.Endpoints.Appointments;
|
|||||||
public class AppointmentManagementHandler
|
public class AppointmentManagementHandler
|
||||||
{
|
{
|
||||||
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
private readonly IAppointmentsMongoDbService _appointmentsMongoDbService;
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public AppointmentManagementHandler(IAppointmentsMongoDbService appointmentsMongoDbService,
|
public AppointmentManagementHandler(IAppointmentsMongoDbService appointmentsMongoDbService,
|
||||||
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
|
IPatientRepository patientRepository, IDoctorRepository doctorRepository)
|
||||||
@@ -41,7 +41,7 @@ public class AppointmentManagementHandler
|
|||||||
var appointmentId = IdentifierGenerator.GenerateId(dto.DoctorId, dto.PatientId);
|
var appointmentId = IdentifierGenerator.GenerateId(dto.DoctorId, dto.PatientId);
|
||||||
var criteria = new List<(string FieldName, string Value)>
|
var criteria = new List<(string FieldName, string Value)>
|
||||||
{
|
{
|
||||||
("_id", appointmentId),
|
("_id", appointmentId)
|
||||||
};
|
};
|
||||||
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public class AppointmentManagementHandler
|
|||||||
await _appointmentsMongoDbService.ModifyAsync("_id", appointmentId, appointment);
|
await _appointmentsMongoDbService.ModifyAsync("_id", appointmentId, appointment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseResponse()
|
return new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.Created,
|
StatusCode = HttpStatusCodes.Created,
|
||||||
Message = "Appointment successfully created.",
|
Message = "Appointment successfully created.",
|
||||||
@@ -93,25 +93,23 @@ public class AppointmentManagementHandler
|
|||||||
var appointmentId = IdentifierGenerator.GenerateId(dto.DoctorId, dto.PatientId);
|
var appointmentId = IdentifierGenerator.GenerateId(dto.DoctorId, dto.PatientId);
|
||||||
var criteria = new List<(string FieldName, string Value)>
|
var criteria = new List<(string FieldName, string Value)>
|
||||||
{
|
{
|
||||||
("_id", appointmentId),
|
("_id", appointmentId)
|
||||||
};
|
};
|
||||||
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
var appointments = await _appointmentsMongoDbService.FindAsync<Appointment>(criteria);
|
||||||
|
|
||||||
if (!appointments.Any())
|
if (!appointments.Any())
|
||||||
{
|
return new BaseResponse
|
||||||
return new BaseResponse()
|
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.NotFound,
|
StatusCode = HttpStatusCodes.NotFound,
|
||||||
Message = "Appointment not found in system.",
|
Message = "Appointment not found in system.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var appointment = appointments[0];
|
var appointment = appointments[0];
|
||||||
appointment.RemoveAppointment(dto.Appointment);
|
appointment.RemoveAppointment(dto.Appointment);
|
||||||
await _appointmentsMongoDbService.ModifyAsync("_id", appointmentId, appointment);
|
await _appointmentsMongoDbService.ModifyAsync("_id", appointmentId, appointment);
|
||||||
|
|
||||||
return new BaseResponse()
|
return new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.OK,
|
StatusCode = HttpStatusCodes.OK,
|
||||||
Message = "Appointment successfully removed.",
|
Message = "Appointment successfully removed.",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Appointments;
|
namespace Application.Endpoints.Appointments;
|
||||||
@@ -50,7 +50,7 @@ public class CreateAppointmentValidator : AbstractValidator<AppointmentManagemen
|
|||||||
|
|
||||||
private bool IsAppointmentValidFormat(DateTime appointment)
|
private bool IsAppointmentValidFormat(DateTime appointment)
|
||||||
{
|
{
|
||||||
if (appointment == default(DateTime))
|
if (appointment == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (appointment.Date < DateTime.UtcNow.Date)
|
if (appointment.Date < DateTime.UtcNow.Date)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Appointments;
|
namespace Application.Endpoints.Appointments;
|
||||||
@@ -51,7 +50,7 @@ public class DeleteAppointmentValidator : AbstractValidator<AppointmentManagemen
|
|||||||
|
|
||||||
private bool IsAppointmentValidFormat(DateTime appointment)
|
private bool IsAppointmentValidFormat(DateTime appointment)
|
||||||
{
|
{
|
||||||
if (appointment == default(DateTime))
|
if (appointment == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (appointment.Date < DateTime.UtcNow.Date)
|
if (appointment.Date < DateTime.UtcNow.Date)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Endpoints.Chats;
|
namespace Application.Endpoints.Chats;
|
||||||
@@ -7,8 +7,8 @@ namespace Application.Endpoints.Chats;
|
|||||||
public class ChatHandler
|
public class ChatHandler
|
||||||
{
|
{
|
||||||
private readonly IChatMongoDbService _chatMongoDbService;
|
private readonly IChatMongoDbService _chatMongoDbService;
|
||||||
private readonly IPatientRepository _patientRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public ChatHandler(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
|
public ChatHandler(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
|
||||||
IDoctorRepository doctorRepository)
|
IDoctorRepository doctorRepository)
|
||||||
@@ -38,14 +38,12 @@ public class ChatHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!await CheckForUsersExistence(sendMessageDto.Sender, sendMessageDto.Receiver))
|
if (!await CheckForUsersExistence(sendMessageDto.Sender, sendMessageDto.Receiver))
|
||||||
{
|
|
||||||
return new BaseResponse
|
return new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.BadRequest,
|
StatusCode = HttpStatusCodes.BadRequest,
|
||||||
Message = "Users can't be found in the system.",
|
Message = "Users can't be found in the system.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var chatId = IdentifierGenerator.GenerateId(sendMessageDto.Sender, sendMessageDto.Receiver);
|
var chatId = IdentifierGenerator.GenerateId(sendMessageDto.Sender, sendMessageDto.Receiver);
|
||||||
|
|
||||||
@@ -54,14 +52,12 @@ public class ChatHandler
|
|||||||
|
|
||||||
var documents = await _chatMongoDbService.FindAsync<Chat>(criteria);
|
var documents = await _chatMongoDbService.FindAsync<Chat>(criteria);
|
||||||
if (!documents.Any())
|
if (!documents.Any())
|
||||||
{
|
return new BaseResponse
|
||||||
return new BaseResponse()
|
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.NotFound,
|
StatusCode = HttpStatusCodes.NotFound,
|
||||||
Message = "Access to medical history not found.",
|
Message = "Access to medical history not found.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var chat = documents[0].Messages;
|
var chat = documents[0].Messages;
|
||||||
chat.Add(new Message(sendMessageDto.Sender, sendMessageDto.Message));
|
chat.Add(new Message(sendMessageDto.Sender, sendMessageDto.Message));
|
||||||
@@ -100,14 +96,12 @@ public class ChatHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!await CheckForUsersExistence(getConversationDto.IdUser1, getConversationDto.IdUser2))
|
if (!await CheckForUsersExistence(getConversationDto.IdUser1, getConversationDto.IdUser2))
|
||||||
{
|
|
||||||
return new BaseResponse
|
return new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.BadRequest,
|
StatusCode = HttpStatusCodes.BadRequest,
|
||||||
Message = "Users can't be found in the system.",
|
Message = "Users can't be found in the system.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var chatId = IdentifierGenerator.GenerateId(getConversationDto.IdUser1, getConversationDto.IdUser2);
|
var chatId = IdentifierGenerator.GenerateId(getConversationDto.IdUser1, getConversationDto.IdUser2);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.Login;
|
namespace Application.Endpoints.Doctors.Login;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.Login;
|
namespace Application.Endpoints.Doctors.Login;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.Profile;
|
namespace Application.Endpoints.Doctors.Profile;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.Profile;
|
namespace Application.Endpoints.Doctors.Profile;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.Registration;
|
namespace Application.Endpoints.Doctors.Registration;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.ResetPassword;
|
namespace Application.Endpoints.Doctors.ResetPassword;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Doctors.ResetPassword;
|
namespace Application.Endpoints.Doctors.ResetPassword;
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ public class IdentifierGenerator
|
|||||||
public static string GenerateId(Guid id1, Guid id2)
|
public static string GenerateId(Guid id1, Guid id2)
|
||||||
{
|
{
|
||||||
// Convert GUIDs to strings
|
// Convert GUIDs to strings
|
||||||
string strId1 = id1.ToString();
|
var strId1 = id1.ToString();
|
||||||
string strId2 = id2.ToString();
|
var strId2 = id2.ToString();
|
||||||
|
|
||||||
// Sort the GUID strings
|
// Sort the GUID strings
|
||||||
string firstId = strId1.CompareTo(strId2) < 0 ? strId1 : strId2;
|
var firstId = strId1.CompareTo(strId2) < 0 ? strId1 : strId2;
|
||||||
string secondId = strId1.CompareTo(strId2) < 0 ? strId2 : strId1;
|
var secondId = strId1.CompareTo(strId2) < 0 ? strId2 : strId1;
|
||||||
|
|
||||||
// Combine them to get a symmetric string
|
// Combine them to get a symmetric string
|
||||||
return firstId + "-" + secondId;
|
return firstId + "-" + secondId;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
||||||
|
|||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
||||||
|
|
||||||
public class MedicalHistoryFileManagementHandler
|
public class MedicalHistoryFileManagementHandler
|
||||||
{
|
{
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||||
|
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||||
private readonly IPatientRepository _patientRepository;
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public MedicalHistoryFileManagementHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
public MedicalHistoryFileManagementHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
namespace Application.Endpoints.MedicalHistories.FileManagement;
|
||||||
|
|||||||
+11
-19
@@ -1,13 +1,13 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
|
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
|
||||||
|
|
||||||
public class MedicalHistoryManageAuthorizationHandler
|
public class MedicalHistoryManageAuthorizationHandler
|
||||||
{
|
{
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||||
|
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||||
|
|
||||||
public MedicalHistoryManageAuthorizationHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
public MedicalHistoryManageAuthorizationHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
||||||
IMedicalHistoryMongoDbService medicalHistoryMongoDbService, IDoctorRepository doctorRepository)
|
IMedicalHistoryMongoDbService medicalHistoryMongoDbService, IDoctorRepository doctorRepository)
|
||||||
@@ -41,28 +41,24 @@ public class MedicalHistoryManageAuthorizationHandler
|
|||||||
|
|
||||||
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
|
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
|
||||||
if (!documents.Any())
|
if (!documents.Any())
|
||||||
{
|
return new BaseResponse
|
||||||
return new BaseResponse()
|
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.NotFound,
|
StatusCode = HttpStatusCodes.NotFound,
|
||||||
Message = "Access to medical history not found.",
|
Message = "Access to medical history not found.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var authorisations = documents[0].Authorisation;
|
var authorisations = documents[0].Authorisation;
|
||||||
if (authorisations.Contains(infoDto.ToString()))
|
if (authorisations.Contains(infoDto.ToString()))
|
||||||
{
|
return new BaseResponse
|
||||||
return new BaseResponse()
|
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.Conflict,
|
StatusCode = HttpStatusCodes.Conflict,
|
||||||
Message = "Access to medical history already granted.",
|
Message = "Access to medical history already granted.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
authorisations.Add(infoDto.DoctorId.ToString());
|
authorisations.Add(infoDto.DoctorId.ToString());
|
||||||
var authorizationModel = new MedicalHistoryAuthorisationModel()
|
var authorizationModel = new MedicalHistoryAuthorisationModel
|
||||||
{
|
{
|
||||||
Id = infoDto.MedicalRecordId.ToString(),
|
Id = infoDto.MedicalRecordId.ToString(),
|
||||||
Authorisation = authorisations
|
Authorisation = authorisations
|
||||||
@@ -70,7 +66,7 @@ public class MedicalHistoryManageAuthorizationHandler
|
|||||||
|
|
||||||
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
|
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
|
||||||
|
|
||||||
return new BaseResponse()
|
return new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.OK,
|
StatusCode = HttpStatusCodes.OK,
|
||||||
Message = "Access to medical history granted.",
|
Message = "Access to medical history granted.",
|
||||||
@@ -102,28 +98,24 @@ public class MedicalHistoryManageAuthorizationHandler
|
|||||||
|
|
||||||
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
|
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
|
||||||
if (!documents.Any())
|
if (!documents.Any())
|
||||||
{
|
return new BaseResponse
|
||||||
return new BaseResponse()
|
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.NotFound,
|
StatusCode = HttpStatusCodes.NotFound,
|
||||||
Message = "Access to medical history not found.",
|
Message = "Access to medical history not found.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var authorisations = documents[0].Authorisation;
|
var authorisations = documents[0].Authorisation;
|
||||||
if (!authorisations.Contains(infoDto.DoctorId.ToString()))
|
if (!authorisations.Contains(infoDto.DoctorId.ToString()))
|
||||||
{
|
return new BaseResponse
|
||||||
return new BaseResponse()
|
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.Conflict,
|
StatusCode = HttpStatusCodes.Conflict,
|
||||||
Message = "Access to medical history already revoked.",
|
Message = "Access to medical history already revoked.",
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
authorisations.Remove(infoDto.DoctorId.ToString());
|
authorisations.Remove(infoDto.DoctorId.ToString());
|
||||||
var authorizationModel = new MedicalHistoryAuthorisationModel()
|
var authorizationModel = new MedicalHistoryAuthorisationModel
|
||||||
{
|
{
|
||||||
Id = infoDto.MedicalRecordId.ToString(),
|
Id = infoDto.MedicalRecordId.ToString(),
|
||||||
Authorisation = authorisations
|
Authorisation = authorisations
|
||||||
@@ -131,7 +123,7 @@ public class MedicalHistoryManageAuthorizationHandler
|
|||||||
|
|
||||||
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
|
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
|
||||||
|
|
||||||
return new BaseResponse()
|
return new BaseResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCodes.OK,
|
StatusCode = HttpStatusCodes.OK,
|
||||||
Message = "Access to medical history granted.",
|
Message = "Access to medical history granted.",
|
||||||
|
|||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
|
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
|
||||||
|
|
||||||
public class MedicalHistoryManageAuthorizationValidation : AbstractValidator<MedicalHistoryManageAuthorizationDoctorDto>
|
public class MedicalHistoryManageAuthorizationValidation : AbstractValidator<MedicalHistoryManageAuthorizationDoctorDto>
|
||||||
{
|
{
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
private readonly IDoctorRepository _doctorRepository;
|
private readonly IDoctorRepository _doctorRepository;
|
||||||
|
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||||
|
|
||||||
public MedicalHistoryManageAuthorizationValidation(IMedicalHistoryRepository medicalHistoryRepository,
|
public MedicalHistoryManageAuthorizationValidation(IMedicalHistoryRepository medicalHistoryRepository,
|
||||||
IDoctorRepository doctorRepository)
|
IDoctorRepository doctorRepository)
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
public class MedicalHistoryAuthorisationModel
|
public class MedicalHistoryAuthorisationModel
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public List<string> Authorisation { get; set; } = new List<string>();
|
public List<string> Authorisation { get; set; } = new();
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories;
|
namespace Application.Endpoints.MedicalHistories;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories;
|
namespace Application.Endpoints.MedicalHistories;
|
||||||
|
|
||||||
public class MedicalHistoryHandler
|
public class MedicalHistoryHandler
|
||||||
{
|
{
|
||||||
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
|
||||||
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
|
||||||
|
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
|
||||||
private readonly IPatientRepository _patientRepository;
|
private readonly IPatientRepository _patientRepository;
|
||||||
|
|
||||||
public MedicalHistoryHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
public MedicalHistoryHandler(IMedicalHistoryRepository medicalHistoryRepository,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.MedicalHistories;
|
namespace Application.Endpoints.MedicalHistories;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.Login;
|
namespace Application.Endpoints.Patients.Login;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.Login;
|
namespace Application.Endpoints.Patients.Login;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.Profile;
|
namespace Application.Endpoints.Patients.Profile;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.Profile;
|
namespace Application.Endpoints.Patients.Profile;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.Registration;
|
namespace Application.Endpoints.Patients.Registration;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.ResetPassword;
|
namespace Application.Endpoints.Patients.ResetPassword;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace Application.Endpoints.Patients.ResetPassword;
|
namespace Application.Endpoints.Patients.ResetPassword;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Application.Endpoints.MedicalHistories;
|
using MongoDB.Driver;
|
||||||
using MongoDB.Driver;
|
|
||||||
|
|
||||||
namespace Application.Services.Database.MongoDB;
|
namespace Application.Services.Database.MongoDB;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
namespace Application.Services.Database;
|
|
||||||
|
|
||||||
public interface IConversationRepository
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Services.Database;
|
namespace Application.Services.Database.PostgreSQL;
|
||||||
|
|
||||||
public interface IDoctorRepository
|
public interface IDoctorRepository
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Services.Database;
|
namespace Application.Services.Database.PostgreSQL;
|
||||||
|
|
||||||
public interface IMedicalHistoryRepository
|
public interface IMedicalHistoryRepository
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
|
|
||||||
namespace Application.Services.Database;
|
namespace Application.Services.Database.PostgreSQL;
|
||||||
|
|
||||||
public interface IPatientRepository
|
public interface IPatientRepository
|
||||||
{
|
{
|
||||||
@@ -10,9 +10,9 @@ public interface IPatientRepository
|
|||||||
|
|
||||||
Task<Patient?> FindByEmailAsync(string email);
|
Task<Patient?> FindByEmailAsync(string email);
|
||||||
|
|
||||||
Task UpdateAsync(Patient doctor);
|
Task UpdateAsync(Patient patient);
|
||||||
|
|
||||||
Task DeleteAsync(Patient doctor);
|
Task DeleteAsync(Patient patient);
|
||||||
|
|
||||||
Task<IEnumerable<Patient>> GetAllAsync();
|
Task<IEnumerable<Patient>> GetAllAsync();
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System.Security.Claims;
|
namespace Application.Services.Jwt;
|
||||||
|
|
||||||
namespace Application.Services.Jwt;
|
|
||||||
|
|
||||||
public interface IJwtService
|
public interface IJwtService
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,21 +10,34 @@ public class Appointment
|
|||||||
public string Id { get; private set; }
|
public string Id { get; private set; }
|
||||||
public string PatientId { get; private set; }
|
public string PatientId { get; private set; }
|
||||||
public string DoctorId { get; private set; }
|
public string DoctorId { get; private set; }
|
||||||
public List<DateTime> AppointmentsList { get; private set; }
|
public List<DateTime> AppointmentsList { get; }
|
||||||
|
|
||||||
public void SetId(string id) { Id = id; }
|
public void SetId(string id)
|
||||||
public void SetPatientId(string patientId) { PatientId = patientId; }
|
{
|
||||||
public void SetDoctorIid(string doctorId) { DoctorId = doctorId; }
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPatientId(string patientId)
|
||||||
|
{
|
||||||
|
PatientId = patientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDoctorIid(string doctorId)
|
||||||
|
{
|
||||||
|
DoctorId = doctorId;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddAppointment(DateTime appointmentDate)
|
public void AddAppointment(DateTime appointmentDate)
|
||||||
{
|
{
|
||||||
DateTime utcAppointmentDate = new DateTime(appointmentDate.Year, appointmentDate.Month, appointmentDate.Day, 0, 0, 0, DateTimeKind.Utc);
|
var utcAppointmentDate = new DateTime(appointmentDate.Year, appointmentDate.Month, appointmentDate.Day, 0, 0, 0,
|
||||||
|
DateTimeKind.Utc);
|
||||||
AppointmentsList.Add(utcAppointmentDate);
|
AppointmentsList.Add(utcAppointmentDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAppointment(DateTime appointmentDate)
|
public void RemoveAppointment(DateTime appointmentDate)
|
||||||
{
|
{
|
||||||
DateTime utcAppointmentDate = new DateTime(appointmentDate.Year, appointmentDate.Month, appointmentDate.Day, 0, 0, 0, DateTimeKind.Utc);
|
var utcAppointmentDate = new DateTime(appointmentDate.Year, appointmentDate.Month, appointmentDate.Day, 0, 0, 0,
|
||||||
|
DateTimeKind.Utc);
|
||||||
AppointmentsList.Remove(utcAppointmentDate);
|
AppointmentsList.Remove(utcAppointmentDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,8 +8,15 @@ public class Chat
|
|||||||
public string Id { get; private set; }
|
public string Id { get; private set; }
|
||||||
public List<Message> Messages { get; private set; } = new();
|
public List<Message> Messages { get; private set; } = new();
|
||||||
|
|
||||||
public void SetId(string id) { Id = id; }
|
public void SetId(string id)
|
||||||
public void SetMessages(List<Message> messages) { Messages = messages; }
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMessages(List<Message> messages)
|
||||||
|
{
|
||||||
|
Messages = messages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Message
|
public class Message
|
||||||
@@ -20,11 +27,17 @@ public class Message
|
|||||||
Content = content;
|
Content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BsonRepresentation(BsonType.String)]
|
[BsonRepresentation(BsonType.String)] public Guid UserId { get; private set; }
|
||||||
public Guid UserId { get; private set; }
|
|
||||||
|
|
||||||
public string Content { get; private set; }
|
public string Content { get; private set; }
|
||||||
|
|
||||||
public void SetUserId(Guid userId) { UserId = userId; }
|
public void SetUserId(Guid userId)
|
||||||
public void SetContent(string content) { Content = content; }
|
{
|
||||||
|
UserId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetContent(string content)
|
||||||
|
{
|
||||||
|
Content = content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,14 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.MongoDB;
|
||||||
using Application.Services.Database.MongoDB;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Application.Services.HashingAlgorithms;
|
using Application.Services.HashingAlgorithms;
|
||||||
using Application.Services.Jwt;
|
using Application.Services.Jwt;
|
||||||
|
|
||||||
using Infrastructure.Data;
|
using Infrastructure.Data;
|
||||||
using Infrastructure.Services.HashingAlgorithms;
|
using Infrastructure.Services.HashingAlgorithms;
|
||||||
using Infrastructure.Services.MongoDB;
|
using Infrastructure.Services.MongoDB;
|
||||||
using Infrastructure.Services.PostgreSQL;
|
using Infrastructure.Services.PostgreSQL;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using MongoDB.Driver;
|
|
||||||
|
|
||||||
namespace Infrastructure;
|
namespace Infrastructure;
|
||||||
|
|
||||||
@@ -72,5 +69,4 @@ public static class DependencyInjection
|
|||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
using System;
|
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Application.Services.Jwt;
|
using Application.Services.Jwt;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
public class JwtService : IJwtService
|
public class JwtService : IJwtService
|
||||||
{
|
{
|
||||||
private readonly string _secretKey;
|
|
||||||
private readonly string _issuer;
|
|
||||||
private readonly string _audience;
|
private readonly string _audience;
|
||||||
private readonly double _expiryMinutes;
|
private readonly double _expiryMinutes;
|
||||||
|
private readonly string _issuer;
|
||||||
|
private readonly string _secretKey;
|
||||||
|
|
||||||
public JwtService(IConfiguration configuration)
|
public JwtService(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
@@ -34,7 +33,8 @@ public class JwtService : IJwtService
|
|||||||
Expires = DateTime.UtcNow.AddMinutes(_expiryMinutes),
|
Expires = DateTime.UtcNow.AddMinutes(_expiryMinutes),
|
||||||
Issuer = _issuer,
|
Issuer = _issuer,
|
||||||
Audience = _audience,
|
Audience = _audience,
|
||||||
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
|
SigningCredentials =
|
||||||
|
new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
|
||||||
};
|
};
|
||||||
|
|
||||||
var token = tokenHandler.CreateToken(tokenDescriptor);
|
var token = tokenHandler.CreateToken(tokenDescriptor);
|
||||||
@@ -58,8 +58,8 @@ public class JwtService : IJwtService
|
|||||||
ValidateAudience = true,
|
ValidateAudience = true,
|
||||||
ValidIssuer = _issuer,
|
ValidIssuer = _issuer,
|
||||||
ValidAudience = _audience,
|
ValidAudience = _audience,
|
||||||
ClockSkew = TimeSpan.Zero,
|
ClockSkew = TimeSpan.Zero
|
||||||
}, out SecurityToken validatedToken);
|
}, out var validatedToken);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -72,16 +72,10 @@ public class JwtService : IJwtService
|
|||||||
public string RefreshToken(string token)
|
public string RefreshToken(string token)
|
||||||
{
|
{
|
||||||
var principal = ValidateTokenAndGetPrincipal(token);
|
var principal = ValidateTokenAndGetPrincipal(token);
|
||||||
if (principal == null)
|
if (principal == null) throw new SecurityTokenException("Invalid token.");
|
||||||
{
|
|
||||||
throw new SecurityTokenException("Invalid token.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var emailClaim = principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email);
|
var emailClaim = principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email);
|
||||||
if (emailClaim == null)
|
if (emailClaim == null) throw new SecurityTokenException("Token does not contain an email claim.");
|
||||||
{
|
|
||||||
throw new SecurityTokenException("Token does not contain an email claim.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return GenerateJwtToken(emailClaim.Value);
|
return GenerateJwtToken(emailClaim.Value);
|
||||||
}
|
}
|
||||||
@@ -100,7 +94,7 @@ public class JwtService : IJwtService
|
|||||||
ValidateAudience = true,
|
ValidateAudience = true,
|
||||||
ValidIssuer = _issuer,
|
ValidIssuer = _issuer,
|
||||||
ValidAudience = _audience,
|
ValidAudience = _audience,
|
||||||
ClockSkew = TimeSpan.Zero,
|
ClockSkew = TimeSpan.Zero
|
||||||
}, out _);
|
}, out _);
|
||||||
|
|
||||||
return principal;
|
return principal;
|
||||||
@@ -111,5 +105,4 @@ public class JwtService : IJwtService
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,12 +24,8 @@ public class AppointmentsMongoDbService : MongoDbService, IAppointmentsMongoDbSe
|
|||||||
var appointments = await FindAsync<Appointment>(criteria);
|
var appointments = await FindAsync<Appointment>(criteria);
|
||||||
|
|
||||||
foreach (var app in appointments)
|
foreach (var app in appointments)
|
||||||
{
|
|
||||||
if (app.AppointmentsList.Any(a => a.Date == appointment.Date))
|
if (app.AppointmentsList.Any(a => a.Date == appointment.Date))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -47,12 +43,8 @@ public class AppointmentsMongoDbService : MongoDbService, IAppointmentsMongoDbSe
|
|||||||
var appointments = await FindAsync<Appointment>(criteria);
|
var appointments = await FindAsync<Appointment>(criteria);
|
||||||
|
|
||||||
foreach (var app in appointments)
|
foreach (var app in appointments)
|
||||||
{
|
|
||||||
if (app.AppointmentsList.Any(a => a.Date == appointment.Date))
|
if (app.AppointmentsList.Any(a => a.Date == appointment.Date))
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
using Application.Services.Database;
|
using MongoDB.Bson;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using MongoDB.Bson;
|
|
||||||
|
|
||||||
namespace Infrastructure.Services.MongoDB
|
namespace Infrastructure.Services.MongoDB;
|
||||||
{
|
|
||||||
public class MongoDbService
|
public class MongoDbService
|
||||||
{
|
{
|
||||||
|
private readonly string _collectionName;
|
||||||
private readonly IMongoClient _database;
|
private readonly IMongoClient _database;
|
||||||
private readonly string _databaseName;
|
private readonly string _databaseName;
|
||||||
private readonly string _collectionName;
|
|
||||||
|
|
||||||
public MongoDbService(string connectionString, string databaseName, string collectionName)
|
public MongoDbService(string connectionString, string databaseName, string collectionName)
|
||||||
{
|
{
|
||||||
@@ -78,4 +77,3 @@ namespace Infrastructure.Services.MongoDB
|
|||||||
await collection.DeleteOneAsync(filter);
|
await collection.DeleteOneAsync(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
using Infrastructure.Data;
|
using Infrastructure.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
using Infrastructure.Data;
|
using Infrastructure.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Application.Services.Database;
|
using Application.Services.Database.PostgreSQL;
|
||||||
using Core.Entities;
|
using Core.Entities;
|
||||||
using Infrastructure.Data;
|
using Infrastructure.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Infrastructure")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Infrastructure")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8663a186a056b0dfbfeebf9ae16be42b40101093")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+13bfa2bdd901a8b258d4cf881b5bb079066ab1c6")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
90add3a549a5ad86ae4df2628a148c5a9756bdaa56fd8988b963942aa2b42329
|
30fec65cc45becf276dcf8ed6696bf02cadfb1a90989db6bf5e21ba21d2c8f27
|
||||||
|
|||||||
Reference in New Issue
Block a user