This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 02:31:05 +03:00
parent 61a55fa735
commit b4eca98e0a
57 changed files with 185 additions and 105 deletions
@@ -1,6 +1,7 @@
using Application.Endpoints;
using Application.Endpoints.MedicalHistories;
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
@@ -10,21 +11,21 @@ namespace API.Controllers;
public class MedicalHistoryController : ControllerBase
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IMongoDbService _mongoDbService;
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
private readonly IPatientRepository _patientRepository;
public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository,
IPatientRepository patientRepository, IMongoDbService mongoDbService)
IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService)
{
_medicalHistoryRepository = medicalHistoryRepository;
_patientRepository = patientRepository;
_mongoDbService = mongoDbService;
_medicalHistoryMongoDbService = mongoDbService;
}
[HttpGet("{id}")]
public async Task<ActionResult<BaseResponse>> GetAsync(Guid id)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService);
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var response = await handler.HandleGet(id);
return StatusCode(response.StatusCode, response);
}
@@ -32,7 +33,7 @@ public class MedicalHistoryController : ControllerBase
[HttpGet]
public async Task<ActionResult<BaseResponse>> GetAllDoctors()
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService);
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var response = await handler.HandleGetAll();
return StatusCode(response.StatusCode, response);
}
@@ -40,7 +41,7 @@ public class MedicalHistoryController : ControllerBase
[HttpPost]
public async Task<ActionResult<BaseResponse>> PostAsync(MedicalHistoryCreateDto medicalHistoryCreateDto)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService);
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var response = await handler.HandleCreate(medicalHistoryCreateDto);
return StatusCode(response.StatusCode, response);
}
@@ -48,7 +49,7 @@ public class MedicalHistoryController : ControllerBase
[HttpPut]
public async Task<ActionResult<BaseResponse>> UpdateAsync(MedicalHistoryUpdateDto medicalHistoryUpdateDto)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService);
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var response = await handler.HandleUpdate(medicalHistoryUpdateDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}
@@ -56,7 +57,7 @@ public class MedicalHistoryController : ControllerBase
[HttpDelete("{id}")]
public async Task<ActionResult<BaseResponse>> DeleteAsync(Guid id)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService);
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var response = await handler.HandleDelete(id);
return StatusCode(response.StatusCode, response);
}
+6 -1
View File
@@ -7,7 +7,12 @@
},
"ConnectionStrings": {
"HealthcareManagerDatabase": "Host=surus.db.elephantsql.com;Database=newbwuyu;Username=newbwuyu;Password=0end9Ixqo9PeTE4HVslX7_FVwruEhFf-;",
"MongoDBDatabase": "mongodb+srv://andrei_cerbu:andrei_cerbu@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
"MongoDBConnection": "mongodb+srv://andrei_cerbu:andrei@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
},
"HealthcareManagerDatabase": {
"Name":"HealthcareManager",
"MedicalRecordCollectionName": "MedicalHistory",
"ChatCollectionName": "Chat"
},
"ApiKeySettings": {
"ApiKey": "testapikey"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,12 @@
},
"ConnectionStrings": {
"HealthcareManagerDatabase": "Host=surus.db.elephantsql.com;Database=newbwuyu;Username=newbwuyu;Password=0end9Ixqo9PeTE4HVslX7_FVwruEhFf-;",
"MongoDBDatabase": "mongodb+srv://andrei_cerbu:andrei_cerbu@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
"MongoDBConnection": "mongodb+srv://andrei_cerbu:andrei@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
},
"HealthcareManagerDatabase": {
"Name":"HealthcareManager",
"MedicalRecordCollectionName": "MedicalHistory",
"ChatCollectionName": "Chat"
},
"ApiKeySettings": {
"ApiKey": "testapikey"
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("API")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b48d5ee19e5228d9bcb979f2140f996fe7a12723")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+61a55fa7353346bdad2d677f0ec3c044c3aa87d5")]
[assembly: System.Reflection.AssemblyProductAttribute("API")]
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
2a4e1c7096998582acfb9acc87d23cdf43dae534213aaa9d36839c4312b69e45
9384050dd4f92ebe3a80d1f56d1515196db26fe72de654a1ee0d4041a1b7e633
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/b48d5ee19e5228d9bcb979f2140f996fe7a12723/*"}}
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/61a55fa7353346bdad2d677f0ec3c044c3aa87d5/*"}}
Binary file not shown.
Binary file not shown.
Binary file not shown.