api cu adaugare/revocare acces

This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 04:02:36 +03:00
parent 9334fa50cb
commit 48eb2adcbd
327 changed files with 261 additions and 98308 deletions
@@ -1,5 +1,7 @@
using Application.Endpoints;
using Application.Endpoints.MedicalHistories;
using Application.Endpoints.MedicalHistories.FileManagement;
using Application.Endpoints.MedicalHistories.ManageAuthorization;
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Microsoft.AspNetCore.Mvc;
@@ -13,19 +15,23 @@ public class MedicalHistoryController : ControllerBase
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository,
IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService)
IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService,
IDoctorRepository doctorRepository)
{
_medicalHistoryRepository = medicalHistoryRepository;
_patientRepository = patientRepository;
_medicalHistoryMongoDbService = mongoDbService;
_doctorRepository = doctorRepository;
}
[HttpGet("{id}")]
public async Task<ActionResult<BaseResponse>> GetAsync(Guid id)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var handler = new MedicalHistoryFileManagementHandler(_medicalHistoryRepository, _patientRepository,
_medicalHistoryMongoDbService);
var response = await handler.HandleGet(id);
return StatusCode(response.StatusCode, response);
}
@@ -33,7 +39,8 @@ public class MedicalHistoryController : ControllerBase
[HttpGet]
public async Task<ActionResult<BaseResponse>> GetAllDoctors()
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var handler = new MedicalHistoryFileManagementHandler(_medicalHistoryRepository, _patientRepository,
_medicalHistoryMongoDbService);
var response = await handler.HandleGetAll();
return StatusCode(response.StatusCode, response);
}
@@ -41,7 +48,8 @@ public class MedicalHistoryController : ControllerBase
[HttpPost]
public async Task<ActionResult<BaseResponse>> PostAsync(MedicalHistoryCreateDto medicalHistoryCreateDto)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var handler = new MedicalHistoryFileManagementHandler(_medicalHistoryRepository, _patientRepository,
_medicalHistoryMongoDbService);
var response = await handler.HandleCreate(medicalHistoryCreateDto);
return StatusCode(response.StatusCode, response);
}
@@ -49,7 +57,8 @@ public class MedicalHistoryController : ControllerBase
[HttpPut]
public async Task<ActionResult<BaseResponse>> UpdateAsync(MedicalHistoryUpdateDto medicalHistoryUpdateDto)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var handler = new MedicalHistoryFileManagementHandler(_medicalHistoryRepository, _patientRepository,
_medicalHistoryMongoDbService);
var response = await handler.HandleUpdate(medicalHistoryUpdateDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}
@@ -57,16 +66,30 @@ public class MedicalHistoryController : ControllerBase
[HttpDelete("{id}")]
public async Task<ActionResult<BaseResponse>> DeleteAsync(Guid id)
{
var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _medicalHistoryMongoDbService);
var handler = new MedicalHistoryFileManagementHandler(_medicalHistoryRepository, _patientRepository,
_medicalHistoryMongoDbService);
var response = await handler.HandleDelete(id);
return StatusCode(response.StatusCode, response);
}
/*
[HttpPut("grant_access")]
public async Task<ActionResult<BaseResponse>> GrantAccessToMedicalHistory(GrantAccessMedicalHistoryDto)
public async Task<ActionResult<BaseResponse>> GrantAccessToMedicalHistory(
MedicalHistoryManageAuthorizationDoctorDto infoDto)
{
return NotFound();
var handler = new MedicalHistoryManageAuthorizationHandler(_medicalHistoryRepository,
_medicalHistoryMongoDbService, _doctorRepository);
var response = await handler.HandleGrantDoctorAccess(infoDto);
return StatusCode(response.StatusCode, response);
}
[HttpPut("revoke_access")]
public async Task<ActionResult<BaseResponse>> RevokeAccessToMedicalHistory(
MedicalHistoryManageAuthorizationDoctorDto infoDto)
{
var handler = new MedicalHistoryManageAuthorizationHandler(_medicalHistoryRepository,
_medicalHistoryMongoDbService, _doctorRepository);
var response = await handler.HandleRevokeDoctorAccess(infoDto);
return StatusCode(response.StatusCode, response);
}
*/
}
+1 -1
View File
@@ -10,7 +10,7 @@
"MongoDBConnection": "mongodb+srv://andrei_cerbu:andrei@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
},
"HealthcareManagerDatabase": {
"Name":"HealthcareManager",
"Name": "HealthcareManager",
"MedicalRecordCollectionName": "MedicalHistory",
"ChatCollectionName": "Chat"
},
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.
@@ -10,7 +10,7 @@
"MongoDBConnection": "mongodb+srv://andrei_cerbu:andrei@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
},
"HealthcareManagerDatabase": {
"Name":"HealthcareManager",
"Name": "HealthcareManager",
"MedicalRecordCollectionName": "MedicalHistory",
"ChatCollectionName": "Chat"
},
@@ -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+61a55fa7353346bdad2d677f0ec3c044c3aa87d5")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b4eca98e0a616e4db63ed57610d69f27f43f4765")]
[assembly: System.Reflection.AssemblyProductAttribute("API")]
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
9384050dd4f92ebe3a80d1f56d1515196db26fe72de654a1ee0d4041a1b7e633
ff25e4eabd78a6c8257b3187d0c0a6d7ce9f93113ce81c3dc173c29363b6a20a
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/61a55fa7353346bdad2d677f0ec3c044c3aa87d5/*"}}
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/b4eca98e0a616e4db63ed57610d69f27f43f4765/*"}}
Binary file not shown.
Binary file not shown.
Binary file not shown.