This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 13:37:58 +03:00
parent 333ad8be09
commit 370bbdedcd
164 changed files with 3915 additions and 161 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
@@ -3,8 +3,8 @@
"WorkspaceRootPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\", "WorkspaceRootPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\",
"Documents": [ "Documents": [
{ {
"AbsoluteMoniker": "D:0:0:{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}|Application\\Application.csproj|c:\\users\\andrei cerbu\\documents\\facultate\\cc-finalproj\\backend\\application\\endpoints\\doctors\\login\\doctorloginvalidation.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}|Application\\Application.csproj|solutionrelative:application\\endpoints\\doctors\\login\\doctorloginvalidation.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -14,12 +14,8 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 1, "SelectedChildIndex": 0,
"Children": [ "Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 0,
@@ -28,10 +24,18 @@
"RelativeDocumentMoniker": "Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs", "RelativeDocumentMoniker": "Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs",
"ToolTip": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs", "ToolTip": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs",
"RelativeToolTip": "Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs", "RelativeToolTip": "Application\\Endpoints\\Doctors\\Login\\DoctorLoginValidation.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAIAAAAdAAAA", "ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAABDAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-04-04T16:14:25.923Z", "WhenOpened": "2024-04-04T16:14:25.923Z",
"EditorCaption": "" "EditorCaption": ""
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
} }
] ]
} }
+1
View File
@@ -8,6 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
</ItemGroup> </ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace HealthcareManager.API.Controllers; namespace API.Controllers;
[Route("api/v1/[controller]")] [Route("api/v1/[controller]")]
[ApiController] [ApiController]
+30 -5
View File
@@ -1,13 +1,38 @@
using Infrastructure.Services.MongoDB; using Application.Endpoints;
using Application.Endpoints.Chats;
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Microsoft.AspNetCore.Mvc;
namespace HealthcareManager.API.Controllers; namespace API.Controllers;
public class ChatController : BaseApiController public class ChatController : BaseApiController
{ {
private readonly MongoDbService _mongoDbService; private readonly IChatMongoDbService _chatMongoDbService;
private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
public ChatController(MongoDbService mongoDbService) public ChatController(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
IDoctorRepository doctorRepository)
{ {
_mongoDbService = mongoDbService; _chatMongoDbService = chatMongoDbService;
_patientRepository = patientRepository;
_doctorRepository = doctorRepository;
}
[HttpPost("send_message")]
public async Task<ActionResult<BaseResponse>> SendMessage(SendMessageDto sendMessageDto)
{
var handler = new ChatHandler(_chatMongoDbService, _patientRepository, _doctorRepository);
var response = await handler.HandleSendMessage(sendMessageDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}
[HttpPost("get_conversation")]
public async Task<ActionResult<BaseResponse>> GetConversation(GetConversationDto getConversationDto)
{
var handler = new ChatHandler(_chatMongoDbService, _patientRepository, _doctorRepository);
var response = await handler.HandleGetConversation(getConversationDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
} }
} }
+55 -5
View File
@@ -5,6 +5,8 @@ using Application.Endpoints.Doctors.Registration;
using Application.Endpoints.Doctors.ResetPassword; using Application.Endpoints.Doctors.ResetPassword;
using Application.Services.Database; using Application.Services.Database;
using Application.Services.HashingAlgorithms; using Application.Services.HashingAlgorithms;
using Application.Services.Jwt;
using Core.Entities;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers; namespace API.Controllers;
@@ -15,29 +17,77 @@ public class DoctorsController : ControllerBase
{ {
private readonly IDoctorRepository _database; private readonly IDoctorRepository _database;
private readonly IHashingAlgorithms _hashingAlgorithms; private readonly IHashingAlgorithms _hashingAlgorithms;
private readonly IJwtService _jwtService;
public DoctorsController(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms) public DoctorsController(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms,
IJwtService jwtService)
{ {
_database = database; _database = database;
_hashingAlgorithms = hashingAlgorithms; _hashingAlgorithms = hashingAlgorithms;
_jwtService = jwtService;
} }
[HttpPost("register")] [HttpPost("register")]
public async Task<ActionResult<BaseResponse>> Register(DoctorRegistrationDto doctor) public async Task<ActionResult<BaseResponse>> Register(DoctorRegistrationDto doctorRegistrationDto)
{ {
var handler = new DoctorRegistrationHandler(_database, _hashingAlgorithms); var handler = new DoctorRegistrationHandler(_database, _hashingAlgorithms);
var response = await handler.Handle(doctor).ConfigureAwait(false); var response = await handler.Handle(doctorRegistrationDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
[HttpPost("login")] [HttpPost("login")]
public async Task<ActionResult<BaseResponse>> Login(DoctorLoginDto doctor) public async Task<ActionResult<BaseResponse>> Login(DoctorLoginDto doctorLoginDto)
{ {
var handler = new DoctorLoginHandler(_database, _hashingAlgorithms); var handler = new DoctorLoginHandler(_database, _hashingAlgorithms);
var response = await handler.Handle(doctor).ConfigureAwait(false); var response = await handler.Handle(doctorLoginDto).ConfigureAwait(false);
if (response.Data != null)
{
Doctor doctor = (Doctor)response.Data;
var authToken = _jwtService.GenerateJwtToken(doctor.Email);
HttpContext.Response.Headers.Add("Authorization", $"Bearer {authToken}");
}
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
[HttpPost("refresh_token")]
public async Task<ActionResult<BaseResponse>> RefreshToken()
{
var authorizationHeader = Request.Headers["Authorization"].FirstOrDefault();
if (string.IsNullOrEmpty(authorizationHeader) || !authorizationHeader.StartsWith("Bearer "))
{
return StatusCode(HttpStatusCodes.BadRequest, new BaseResponse
{
StatusCode = HttpStatusCodes.BadRequest,
Message = "Invalid request header format.",
Data = null
});
}
var oldToken = authorizationHeader.Substring("Bearer ".Length).Trim();
if (!_jwtService.ValidateJwtToken(oldToken))
{
return StatusCode(HttpStatusCodes.Unauthorized, new BaseResponse
{
StatusCode = HttpStatusCodes.Unauthorized,
Message = "Invalid JWT token.",
Data = null
});
}
else
{
var newToken = _jwtService.RefreshToken(oldToken);
return StatusCode(HttpStatusCodes.OK, new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = "Token refreshed successfully.",
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)
{ {
@@ -1,5 +1,6 @@
using Application.Endpoints; 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;
using Application.Services.Database.MongoDB; using Application.Services.Database.MongoDB;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@@ -13,19 +14,23 @@ public class MedicalHistoryController : ControllerBase
private readonly IMedicalHistoryRepository _medicalHistoryRepository; private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService; private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
private readonly IPatientRepository _patientRepository; private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository, public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository,
IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService) IPatientRepository patientRepository, IMedicalHistoryMongoDbService mongoDbService,
IDoctorRepository doctorRepository)
{ {
_medicalHistoryRepository = medicalHistoryRepository; _medicalHistoryRepository = medicalHistoryRepository;
_patientRepository = patientRepository; _patientRepository = patientRepository;
_medicalHistoryMongoDbService = mongoDbService; _medicalHistoryMongoDbService = mongoDbService;
_doctorRepository = doctorRepository;
} }
[HttpGet("{id}")] [HttpGet("{id}")]
public async Task<ActionResult<BaseResponse>> GetAsync(Guid 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); var response = await handler.HandleGet(id);
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
@@ -33,7 +38,8 @@ public class MedicalHistoryController : ControllerBase
[HttpGet] [HttpGet]
public async Task<ActionResult<BaseResponse>> GetAllDoctors() 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(); var response = await handler.HandleGetAll();
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
@@ -41,7 +47,8 @@ public class MedicalHistoryController : ControllerBase
[HttpPost] [HttpPost]
public async Task<ActionResult<BaseResponse>> PostAsync(MedicalHistoryCreateDto medicalHistoryCreateDto) 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); var response = await handler.HandleCreate(medicalHistoryCreateDto);
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
@@ -49,7 +56,8 @@ public class MedicalHistoryController : ControllerBase
[HttpPut] [HttpPut]
public async Task<ActionResult<BaseResponse>> UpdateAsync(MedicalHistoryUpdateDto medicalHistoryUpdateDto) 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); var response = await handler.HandleUpdate(medicalHistoryUpdateDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
@@ -57,16 +65,30 @@ public class MedicalHistoryController : ControllerBase
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<BaseResponse>> DeleteAsync(Guid 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); var response = await handler.HandleDelete(id);
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
/*
[HttpPut("grant_access")] [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);
} }
*/
} }
+50 -1
View File
@@ -5,6 +5,8 @@ using Application.Endpoints.Patients.Registration;
using Application.Endpoints.Patients.ResetPassword; using Application.Endpoints.Patients.ResetPassword;
using Application.Services.Database; using Application.Services.Database;
using Application.Services.HashingAlgorithms; using Application.Services.HashingAlgorithms;
using Application.Services.Jwt;
using Core.Entities;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers; namespace API.Controllers;
@@ -15,11 +17,14 @@ public class PatientsController : ControllerBase
{ {
private readonly IHashingAlgorithms _hashingAlgorithms; private readonly IHashingAlgorithms _hashingAlgorithms;
private readonly IPatientRepository _patientRepository; private readonly IPatientRepository _patientRepository;
private readonly IJwtService _jwtService;
public PatientsController(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms) public PatientsController(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms,
IJwtService jwtService)
{ {
_patientRepository = patientRepository; _patientRepository = patientRepository;
_hashingAlgorithms = hashingAlgorithms; _hashingAlgorithms = hashingAlgorithms;
_jwtService = jwtService;
} }
[HttpGet] [HttpGet]
@@ -43,8 +48,52 @@ public class PatientsController : ControllerBase
{ {
var handler = new PatientLoginHandler(_patientRepository); var handler = new PatientLoginHandler(_patientRepository);
var response = await handler.Handle(patientLoginDto).ConfigureAwait(false); var response = await handler.Handle(patientLoginDto).ConfigureAwait(false);
if (response.Data != null)
{
Patient patient = (Patient)response.Data;
var authToken = _jwtService.GenerateJwtToken(patient.Email);
HttpContext.Response.Headers.Add("Authorization", $"Bearer {authToken}");
}
return StatusCode(response.StatusCode, response); return StatusCode(response.StatusCode, response);
} }
[HttpPost("refresh_token")]
public async Task<ActionResult<BaseResponse>> RefreshToken()
{
var authorizationHeader = Request.Headers["Authorization"].FirstOrDefault();
if (string.IsNullOrEmpty(authorizationHeader) || !authorizationHeader.StartsWith("Bearer "))
{
return StatusCode(HttpStatusCodes.BadRequest, new BaseResponse
{
StatusCode = HttpStatusCodes.BadRequest,
Message = "Invalid request header format.",
Data = null
});
}
var oldToken = authorizationHeader.Substring("Bearer ".Length).Trim();
if (!_jwtService.ValidateJwtToken(oldToken))
{
return StatusCode(HttpStatusCodes.Unauthorized, new BaseResponse
{
StatusCode = HttpStatusCodes.Unauthorized,
Message = "Invalid JWT token.",
Data = null
});
}
else
{
var newToken = _jwtService.RefreshToken(oldToken);
return StatusCode(HttpStatusCodes.OK, new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = "Token refreshed successfully.",
Data = new { Token = newToken }
});
}
}
[HttpPost("register")] [HttpPost("register")]
public async Task<ActionResult<BaseResponse>> Register(PatientRegistrationDto patientRegistrationDto) public async Task<ActionResult<BaseResponse>> Register(PatientRegistrationDto patientRegistrationDto)
+57
View File
@@ -0,0 +1,57 @@
using System.Text.Json;
using Application.Endpoints;
namespace API.Middlewares;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using System.Linq;
using Application.Services.Jwt;
public class JwtMiddleware
{
private readonly RequestDelegate _next;
private readonly IJwtService _jwtService;
public JwtMiddleware(RequestDelegate next, IJwtService jwtService)
{
_next = next;
_jwtService = jwtService;
}
public async Task Invoke(HttpContext context)
{
var path = context.Request.Path.ToString().ToLower();
// Define the paths that should bypass JWT validation
var bypassPaths = new string[]
{
"/api/doctors/login",
"/api/doctors/register",
"/api/patients/login",
"/api/patients/register"
};
if (!bypassPaths.Contains(path))
{
var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
if (token != null && _jwtService.ValidateJwtToken(token))
{
await _next(context);
}
else
{
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
context.Response.ContentType = "application/json";
var response = new BaseResponse
{
StatusCode = StatusCodes.Status401Unauthorized,
Message = "Invalid JWT Token",
Data = null
};
var responseJson = JsonSerializer.Serialize(response);
await context.Response.WriteAsync(responseJson);
}
}
}
}
+19 -1
View File
@@ -1,9 +1,15 @@
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();
@@ -46,7 +52,19 @@ if (app.Environment.IsDevelopment())
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseAuthorization();
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:SecretKey"])),
ValidateIssuer = false,
ValidateAudience = false,
ClockSkew = TimeSpan.Zero
};
});
app.MapControllers(); app.MapControllers();
+6
View File
@@ -17,5 +17,11 @@
"ApiKeySettings": { "ApiKeySettings": {
"ApiKey": "testapikey" "ApiKey": "testapikey"
}, },
"Jwt": {
"SecretKey": "HealthcareManagerJwtKey",
"Issuer": "HealthcareManager",
"Audience": "HealthCareManagerUsers",
"ExpirationMinutes": 1440
},
"AllowedHosts": "*" "AllowedHosts": "*"
} }
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.
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" "MongoDBConnection": "mongodb+srv://andrei_cerbu:andrei@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
}, },
"HealthcareManagerDatabase": { "HealthcareManagerDatabase": {
"Name":"HealthcareManager", "Name": "HealthcareManager",
"MedicalRecordCollectionName": "MedicalHistory", "MedicalRecordCollectionName": "MedicalHistory",
"ChatCollectionName": "Chat" "ChatCollectionName": "Chat"
}, },
+20 -16
View File
@@ -14,14 +14,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -47,6 +45,10 @@
"net8.0": { "net8.0": {
"targetAlias": "net8.0", "targetAlias": "net8.0",
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Authentication.JwtBearer": {
"target": "Package",
"version": "[8.0.3, )"
},
"Swashbuckle.AspNetCore": { "Swashbuckle.AspNetCore": {
"target": "Package", "target": "Package",
"version": "[6.5.0, )" "version": "[6.5.0, )"
@@ -71,7 +73,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
}, },
@@ -85,14 +87,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -140,7 +140,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
}, },
@@ -154,14 +154,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -201,7 +199,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
}, },
@@ -215,14 +213,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -274,6 +270,10 @@
"target": "Package", "target": "Package",
"version": "[8.0.0, )" "version": "[8.0.0, )"
}, },
"Microsoft.IdentityModel.Tokens": {
"target": "Package",
"version": "[7.5.1, )"
},
"MongoDB.Driver": { "MongoDB.Driver": {
"target": "Package", "target": "Package",
"version": "[2.24.0, )" "version": "[2.24.0, )"
@@ -281,6 +281,10 @@
"Npgsql.EntityFrameworkCore.PostgreSQL": { "Npgsql.EntityFrameworkCore.PostgreSQL": {
"target": "Package", "target": "Package",
"version": "[8.0.2, )" "version": "[8.0.2, )"
},
"System.IdentityModel.Tokens.Jwt": {
"target": "Package",
"version": "[7.5.1, )"
} }
}, },
"imports": [ "imports": [
@@ -299,7 +303,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
} }
@@ -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+61a55fa7353346bdad2d677f0ec3c044c3aa87d5")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+90604e48ae9f78fa417a446c05f7759001447de5")]
[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 @@
9384050dd4f92ebe3a80d1f56d1515196db26fe72de654a1ee0d4041a1b7e633 8bbfd346519394cfd8dd09e31e613d7ac5c277d6dcd8753ee217716e41cadd15
Binary file not shown.
@@ -1 +1 @@
3416e3272dd0e47374f982bfa273624c68a9149bad5e6bd93b7898d980bc8f46 06fc5bd1554959a9b32bbdb9ef6b3f86b090ac26bcc67914d438a39ee322e613
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/48eb2adcbd149cd66c77ba558f492179d2bf29be/*"}}
Binary file not shown.
Binary file not shown.
Binary file not shown.
+317 -5
View File
@@ -60,6 +60,25 @@
} }
} }
}, },
"Microsoft.AspNetCore.Authentication.JwtBearer/8.0.3": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.1.2"
},
"compile": {
"lib/net8.0/Microsoft.AspNetCore.Authentication.JwtBearer.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.AspNetCore.Authentication.JwtBearer.dll": {
"related": ".xml"
}
},
"frameworkReferences": [
"Microsoft.AspNetCore.App"
]
},
"Microsoft.EntityFrameworkCore/8.0.3": { "Microsoft.EntityFrameworkCore/8.0.3": {
"type": "package", "type": "package",
"dependencies": { "dependencies": {
@@ -468,6 +487,101 @@
"buildTransitive/net6.0/_._": {} "buildTransitive/net6.0/_._": {}
} }
}, },
"Microsoft.IdentityModel.Abstractions/7.5.1": {
"type": "package",
"compile": {
"lib/net8.0/Microsoft.IdentityModel.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Abstractions.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.JsonWebTokens/7.5.1": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Tokens": "7.5.1"
},
"compile": {
"lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Logging/7.5.1": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Abstractions": "7.5.1"
},
"compile": {
"lib/net8.0/Microsoft.IdentityModel.Logging.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Logging.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Protocols/7.1.2": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Logging": "7.1.2",
"Microsoft.IdentityModel.Tokens": "7.1.2"
},
"compile": {
"lib/net8.0/Microsoft.IdentityModel.Protocols.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Protocols.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Protocols.OpenIdConnect/7.1.2": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Protocols": "7.1.2",
"System.IdentityModel.Tokens.Jwt": "7.1.2"
},
"compile": {
"lib/net8.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Tokens/7.5.1": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Logging": "7.5.1"
},
"compile": {
"lib/net8.0/Microsoft.IdentityModel.Tokens.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Tokens.dll": {
"related": ".xml"
}
}
},
"Microsoft.NETCore.Platforms/5.0.0": { "Microsoft.NETCore.Platforms/5.0.0": {
"type": "package", "type": "package",
"compile": { "compile": {
@@ -735,6 +849,23 @@
"lib/netcoreapp2.0/_._": {} "lib/netcoreapp2.0/_._": {}
} }
}, },
"System.IdentityModel.Tokens.Jwt/7.5.1": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.JsonWebTokens": "7.5.1",
"Microsoft.IdentityModel.Tokens": "7.5.1"
},
"compile": {
"lib/net8.0/System.IdentityModel.Tokens.Jwt.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/System.IdentityModel.Tokens.Jwt.dll": {
"related": ".xml"
}
}
},
"System.Memory/4.5.5": { "System.Memory/4.5.5": {
"type": "package", "type": "package",
"compile": { "compile": {
@@ -892,8 +1023,10 @@
"Microsoft.Extensions.Configuration": "8.0.0", "Microsoft.Extensions.Configuration": "8.0.0",
"Microsoft.Extensions.Configuration.Json": "8.0.0", "Microsoft.Extensions.Configuration.Json": "8.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0",
"Microsoft.IdentityModel.Tokens": "7.5.1",
"MongoDB.Driver": "2.24.0", "MongoDB.Driver": "2.24.0",
"Npgsql.EntityFrameworkCore.PostgreSQL": "8.0.2" "Npgsql.EntityFrameworkCore.PostgreSQL": "8.0.2",
"System.IdentityModel.Tokens.Jwt": "7.5.1"
}, },
"compile": { "compile": {
"bin/placeholder/Infrastructure.dll": {} "bin/placeholder/Infrastructure.dll": {}
@@ -1006,6 +1139,21 @@
"lib/netstandard2.1/FluentValidation.xml" "lib/netstandard2.1/FluentValidation.xml"
] ]
}, },
"Microsoft.AspNetCore.Authentication.JwtBearer/8.0.3": {
"sha512": "VsDy8R6/0ushSpUow7m4lB82ovVBnI1e2AtPo1z22pzYzUjqY9QJvaexzqMkwmI3K1CVdT6MweXiWoqCcHrJbA==",
"type": "package",
"path": "microsoft.aspnetcore.authentication.jwtbearer/8.0.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"THIRD-PARTY-NOTICES.TXT",
"lib/net8.0/Microsoft.AspNetCore.Authentication.JwtBearer.dll",
"lib/net8.0/Microsoft.AspNetCore.Authentication.JwtBearer.xml",
"microsoft.aspnetcore.authentication.jwtbearer.8.0.3.nupkg.sha512",
"microsoft.aspnetcore.authentication.jwtbearer.nuspec"
]
},
"Microsoft.EntityFrameworkCore/8.0.3": { "Microsoft.EntityFrameworkCore/8.0.3": {
"sha512": "QUPQbeq4yCjgIL/6PzkhfwhljXmai3CNOsErWFJ/WJ1Z41V8+At0Bi4PT8/2pX25kPgf83g0CUKIZd0QbeKT4A==", "sha512": "QUPQbeq4yCjgIL/6PzkhfwhljXmai3CNOsErWFJ/WJ1Z41V8+At0Bi4PT8/2pX25kPgf83g0CUKIZd0QbeKT4A==",
"type": "package", "type": "package",
@@ -1885,6 +2033,144 @@
"useSharedDesignerContext.txt" "useSharedDesignerContext.txt"
] ]
}, },
"Microsoft.IdentityModel.Abstractions/7.5.1": {
"sha512": "PT16ZFbPIiMsYv07oy3zOjqUOJ7xutGBkJTOX0+IbNyU6+O6X7aIxjq9EaSSRLWbekRgamgtmfg8Xjw6A6Ua9g==",
"type": "package",
"path": "microsoft.identitymodel.abstractions/7.5.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/Microsoft.IdentityModel.Abstractions.dll",
"lib/net461/Microsoft.IdentityModel.Abstractions.xml",
"lib/net462/Microsoft.IdentityModel.Abstractions.dll",
"lib/net462/Microsoft.IdentityModel.Abstractions.xml",
"lib/net472/Microsoft.IdentityModel.Abstractions.dll",
"lib/net472/Microsoft.IdentityModel.Abstractions.xml",
"lib/net6.0/Microsoft.IdentityModel.Abstractions.dll",
"lib/net6.0/Microsoft.IdentityModel.Abstractions.xml",
"lib/net8.0/Microsoft.IdentityModel.Abstractions.dll",
"lib/net8.0/Microsoft.IdentityModel.Abstractions.xml",
"lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll",
"lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.xml",
"microsoft.identitymodel.abstractions.7.5.1.nupkg.sha512",
"microsoft.identitymodel.abstractions.nuspec"
]
},
"Microsoft.IdentityModel.JsonWebTokens/7.5.1": {
"sha512": "93CGSa8RPdZU8zfvA3nf9NGKUqEnQrE12VzYlMqKh72ddhzusosqLNEUgH/YhFWBLRFOnY1RCgHMV7pR+sAx2w==",
"type": "package",
"path": "microsoft.identitymodel.jsonwebtokens/7.5.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/Microsoft.IdentityModel.JsonWebTokens.dll",
"lib/net461/Microsoft.IdentityModel.JsonWebTokens.xml",
"lib/net462/Microsoft.IdentityModel.JsonWebTokens.dll",
"lib/net462/Microsoft.IdentityModel.JsonWebTokens.xml",
"lib/net472/Microsoft.IdentityModel.JsonWebTokens.dll",
"lib/net472/Microsoft.IdentityModel.JsonWebTokens.xml",
"lib/net6.0/Microsoft.IdentityModel.JsonWebTokens.dll",
"lib/net6.0/Microsoft.IdentityModel.JsonWebTokens.xml",
"lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.dll",
"lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.xml",
"lib/netstandard2.0/Microsoft.IdentityModel.JsonWebTokens.dll",
"lib/netstandard2.0/Microsoft.IdentityModel.JsonWebTokens.xml",
"microsoft.identitymodel.jsonwebtokens.7.5.1.nupkg.sha512",
"microsoft.identitymodel.jsonwebtokens.nuspec"
]
},
"Microsoft.IdentityModel.Logging/7.5.1": {
"sha512": "PnpAQX20BAiDIPYmWUyQSlEaWD8BLXzHpiDGTCT568Cs0ReOeyzNe401LzCeiv6ilug/KefVeV1CeqtCHTo8dw==",
"type": "package",
"path": "microsoft.identitymodel.logging/7.5.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/Microsoft.IdentityModel.Logging.dll",
"lib/net461/Microsoft.IdentityModel.Logging.xml",
"lib/net462/Microsoft.IdentityModel.Logging.dll",
"lib/net462/Microsoft.IdentityModel.Logging.xml",
"lib/net472/Microsoft.IdentityModel.Logging.dll",
"lib/net472/Microsoft.IdentityModel.Logging.xml",
"lib/net6.0/Microsoft.IdentityModel.Logging.dll",
"lib/net6.0/Microsoft.IdentityModel.Logging.xml",
"lib/net8.0/Microsoft.IdentityModel.Logging.dll",
"lib/net8.0/Microsoft.IdentityModel.Logging.xml",
"lib/netstandard2.0/Microsoft.IdentityModel.Logging.dll",
"lib/netstandard2.0/Microsoft.IdentityModel.Logging.xml",
"microsoft.identitymodel.logging.7.5.1.nupkg.sha512",
"microsoft.identitymodel.logging.nuspec"
]
},
"Microsoft.IdentityModel.Protocols/7.1.2": {
"sha512": "SydLwMRFx6EHPWJ+N6+MVaoArN1Htt92b935O3RUWPY1yUF63zEjvd3lBu79eWdZUwedP8TN2I5V9T3nackvIQ==",
"type": "package",
"path": "microsoft.identitymodel.protocols/7.1.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/Microsoft.IdentityModel.Protocols.dll",
"lib/net461/Microsoft.IdentityModel.Protocols.xml",
"lib/net462/Microsoft.IdentityModel.Protocols.dll",
"lib/net462/Microsoft.IdentityModel.Protocols.xml",
"lib/net472/Microsoft.IdentityModel.Protocols.dll",
"lib/net472/Microsoft.IdentityModel.Protocols.xml",
"lib/net6.0/Microsoft.IdentityModel.Protocols.dll",
"lib/net6.0/Microsoft.IdentityModel.Protocols.xml",
"lib/net8.0/Microsoft.IdentityModel.Protocols.dll",
"lib/net8.0/Microsoft.IdentityModel.Protocols.xml",
"lib/netstandard2.0/Microsoft.IdentityModel.Protocols.dll",
"lib/netstandard2.0/Microsoft.IdentityModel.Protocols.xml",
"microsoft.identitymodel.protocols.7.1.2.nupkg.sha512",
"microsoft.identitymodel.protocols.nuspec"
]
},
"Microsoft.IdentityModel.Protocols.OpenIdConnect/7.1.2": {
"sha512": "6lHQoLXhnMQ42mGrfDkzbIOR3rzKM1W1tgTeMPLgLCqwwGw0d96xFi/UiX/fYsu7d6cD5MJiL3+4HuI8VU+sVQ==",
"type": "package",
"path": "microsoft.identitymodel.protocols.openidconnect/7.1.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll",
"lib/net461/Microsoft.IdentityModel.Protocols.OpenIdConnect.xml",
"lib/net462/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll",
"lib/net462/Microsoft.IdentityModel.Protocols.OpenIdConnect.xml",
"lib/net472/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll",
"lib/net472/Microsoft.IdentityModel.Protocols.OpenIdConnect.xml",
"lib/net6.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll",
"lib/net6.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.xml",
"lib/net8.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll",
"lib/net8.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.xml",
"lib/netstandard2.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll",
"lib/netstandard2.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.xml",
"microsoft.identitymodel.protocols.openidconnect.7.1.2.nupkg.sha512",
"microsoft.identitymodel.protocols.openidconnect.nuspec"
]
},
"Microsoft.IdentityModel.Tokens/7.5.1": {
"sha512": "Q3DKpyFViP84IUlTFKH/zIkswIrmSh2Vd/eFDo4wlOHy4DYxoweZEEw4kDEiKt9VCX6o7SddK3HK2xDYyFpexA==",
"type": "package",
"path": "microsoft.identitymodel.tokens/7.5.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/Microsoft.IdentityModel.Tokens.dll",
"lib/net461/Microsoft.IdentityModel.Tokens.xml",
"lib/net462/Microsoft.IdentityModel.Tokens.dll",
"lib/net462/Microsoft.IdentityModel.Tokens.xml",
"lib/net472/Microsoft.IdentityModel.Tokens.dll",
"lib/net472/Microsoft.IdentityModel.Tokens.xml",
"lib/net6.0/Microsoft.IdentityModel.Tokens.dll",
"lib/net6.0/Microsoft.IdentityModel.Tokens.xml",
"lib/net8.0/Microsoft.IdentityModel.Tokens.dll",
"lib/net8.0/Microsoft.IdentityModel.Tokens.xml",
"lib/netstandard2.0/Microsoft.IdentityModel.Tokens.dll",
"lib/netstandard2.0/Microsoft.IdentityModel.Tokens.xml",
"microsoft.identitymodel.tokens.7.5.1.nupkg.sha512",
"microsoft.identitymodel.tokens.nuspec"
]
},
"Microsoft.NETCore.Platforms/5.0.0": { "Microsoft.NETCore.Platforms/5.0.0": {
"sha512": "VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ==", "sha512": "VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ==",
"type": "package", "type": "package",
@@ -2244,6 +2530,29 @@
"version.txt" "version.txt"
] ]
}, },
"System.IdentityModel.Tokens.Jwt/7.5.1": {
"sha512": "UUw+E0R73lZLlXgneYIJQxNs1kfbcxjVzw64JQyiwjqCd4HMpAbjn+xRo86QZT84uHq8/MkqvfH82tgjgPzpuw==",
"type": "package",
"path": "system.identitymodel.tokens.jwt/7.5.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net461/System.IdentityModel.Tokens.Jwt.dll",
"lib/net461/System.IdentityModel.Tokens.Jwt.xml",
"lib/net462/System.IdentityModel.Tokens.Jwt.dll",
"lib/net462/System.IdentityModel.Tokens.Jwt.xml",
"lib/net472/System.IdentityModel.Tokens.Jwt.dll",
"lib/net472/System.IdentityModel.Tokens.Jwt.xml",
"lib/net6.0/System.IdentityModel.Tokens.Jwt.dll",
"lib/net6.0/System.IdentityModel.Tokens.Jwt.xml",
"lib/net8.0/System.IdentityModel.Tokens.Jwt.dll",
"lib/net8.0/System.IdentityModel.Tokens.Jwt.xml",
"lib/netstandard2.0/System.IdentityModel.Tokens.Jwt.dll",
"lib/netstandard2.0/System.IdentityModel.Tokens.Jwt.xml",
"system.identitymodel.tokens.jwt.7.5.1.nupkg.sha512",
"system.identitymodel.tokens.jwt.nuspec"
]
},
"System.Memory/4.5.5": { "System.Memory/4.5.5": {
"sha512": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", "sha512": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"type": "package", "type": "package",
@@ -2547,6 +2856,7 @@
"net8.0": [ "net8.0": [
"Application >= 1.0.0", "Application >= 1.0.0",
"Infrastructure >= 1.0.0", "Infrastructure >= 1.0.0",
"Microsoft.AspNetCore.Authentication.JwtBearer >= 8.0.3",
"Swashbuckle.AspNetCore >= 6.5.0" "Swashbuckle.AspNetCore >= 6.5.0"
] ]
}, },
@@ -2563,14 +2873,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -2596,6 +2904,10 @@
"net8.0": { "net8.0": {
"targetAlias": "net8.0", "targetAlias": "net8.0",
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Authentication.JwtBearer": {
"target": "Package",
"version": "[8.0.3, )"
},
"Swashbuckle.AspNetCore": { "Swashbuckle.AspNetCore": {
"target": "Package", "target": "Package",
"version": "[6.5.0, )" "version": "[6.5.0, )"
@@ -2620,7 +2932,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
} }
+9 -1
View File
@@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "nH+v0/ZQ0hK0w3knyskezmqQzqvqCYUEVhsdP2suOMyzmw/bxzwSVgn9E+iUU+5wOUyeCGutEG5PTTU1y/XNwA==", "dgSpecHash": "H5Qo0sozwr+dtjWKUvuynj4zk8X++aQJuu1j0FXoS/GLj1KwbgdyFric4d5FbEvjaO4v4r35BCqsZQZKD1Euvg==",
"success": true, "success": true,
"projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj", "projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
@@ -8,6 +8,7 @@
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\awssdk.securitytoken\\3.7.100.14\\awssdk.securitytoken.3.7.100.14.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\awssdk.securitytoken\\3.7.100.14\\awssdk.securitytoken.3.7.100.14.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\dnsclient\\1.6.1\\dnsclient.1.6.1.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\dnsclient\\1.6.1\\dnsclient.1.6.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\fluentvalidation\\11.9.0\\fluentvalidation.11.9.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\fluentvalidation\\11.9.0\\fluentvalidation.11.9.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.aspnetcore.authentication.jwtbearer\\8.0.3\\microsoft.aspnetcore.authentication.jwtbearer.8.0.3.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.3\\microsoft.entityframeworkcore.8.0.3.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.3\\microsoft.entityframeworkcore.8.0.3.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.3\\microsoft.entityframeworkcore.abstractions.8.0.3.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.3\\microsoft.entityframeworkcore.abstractions.8.0.3.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.3\\microsoft.entityframeworkcore.analyzers.8.0.3.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.3\\microsoft.entityframeworkcore.analyzers.8.0.3.nupkg.sha512",
@@ -30,6 +31,12 @@
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.options\\8.0.0\\microsoft.extensions.options.8.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.options\\8.0.0\\microsoft.extensions.options.8.0.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.options.configurationextensions\\8.0.0\\microsoft.extensions.options.configurationextensions.8.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.options.configurationextensions\\8.0.0\\microsoft.extensions.options.configurationextensions.8.0.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.identitymodel.abstractions\\7.5.1\\microsoft.identitymodel.abstractions.7.5.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.identitymodel.jsonwebtokens\\7.5.1\\microsoft.identitymodel.jsonwebtokens.7.5.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.identitymodel.logging\\7.5.1\\microsoft.identitymodel.logging.7.5.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.identitymodel.protocols\\7.1.2\\microsoft.identitymodel.protocols.7.1.2.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.identitymodel.protocols.openidconnect\\7.1.2\\microsoft.identitymodel.protocols.openidconnect.7.1.2.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.identitymodel.tokens\\7.5.1\\microsoft.identitymodel.tokens.7.5.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.netcore.platforms\\5.0.0\\microsoft.netcore.platforms.5.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.netcore.platforms\\5.0.0\\microsoft.netcore.platforms.5.0.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.openapi\\1.2.3\\microsoft.openapi.1.2.3.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.openapi\\1.2.3\\microsoft.openapi.1.2.3.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.win32.registry\\5.0.0\\microsoft.win32.registry.5.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.win32.registry\\5.0.0\\microsoft.win32.registry.5.0.0.nupkg.sha512",
@@ -46,6 +53,7 @@
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\swashbuckle.aspnetcore.swaggergen\\6.5.0\\swashbuckle.aspnetcore.swaggergen.6.5.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\swashbuckle.aspnetcore.swaggergen\\6.5.0\\swashbuckle.aspnetcore.swaggergen.6.5.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\swashbuckle.aspnetcore.swaggerui\\6.5.0\\swashbuckle.aspnetcore.swaggerui.6.5.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\swashbuckle.aspnetcore.swaggerui\\6.5.0\\swashbuckle.aspnetcore.swaggerui.6.5.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.buffers\\4.5.1\\system.buffers.4.5.1.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.buffers\\4.5.1\\system.buffers.4.5.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.identitymodel.tokens.jwt\\7.5.1\\system.identitymodel.tokens.jwt.7.5.1.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.memory\\4.5.5\\system.memory.4.5.5.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.memory\\4.5.5\\system.memory.4.5.5.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\5.0.0\\system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\5.0.0\\system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512",
"C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.security.accesscontrol\\5.0.0\\system.security.accesscontrol.5.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.security.accesscontrol\\5.0.0\\system.security.accesscontrol.5.0.0.nupkg.sha512",
+1 -1
View File
@@ -1 +1 @@
"restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj","projectName":"API","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj":{"projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj"},"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj":{"projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Swashbuckle.AspNetCore":{"target":"Package","version":"[6.5.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.AspNetCore.App":{"privateAssets":"none"},"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json"}} "restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj","projectName":"API","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj":{"projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj"},"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj":{"projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.AspNetCore.Authentication.JwtBearer":{"target":"Package","version":"[8.0.3, )"},"Swashbuckle.AspNetCore":{"target":"Package","version":"[6.5.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.AspNetCore.App":{"privateAssets":"none"},"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"}}
@@ -1 +1 @@
17125194878710486 17125558124497896
+1 -1
View File
@@ -1 +1 @@
17125195144135930 17125685577964752
@@ -0,0 +1,150 @@
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Core.Entities;
namespace Application.Endpoints.Chats;
public class ChatHandler
{
private readonly IChatMongoDbService _chatMongoDbService;
private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
public ChatHandler(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
IDoctorRepository doctorRepository)
{
_chatMongoDbService = chatMongoDbService;
_patientRepository = patientRepository;
_doctorRepository = doctorRepository;
}
public async Task<BaseResponse> HandleSendMessage(SendMessageDto sendMessageDto)
{
var validation = new SendMessageValidator();
var validationResult = await validation.ValidateAsync(sendMessageDto);
if (!validationResult.IsValid)
{
var firstError = validationResult.Errors.FirstOrDefault();
var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1;
var errorMessage = firstError.ErrorMessage;
return new BaseResponse
{
StatusCode = errorCode,
Message = errorMessage,
Data = null
};
}
if (!await CheckForUsersExistence(sendMessageDto.Sender, sendMessageDto.Receiver))
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.BadRequest,
Message = "Users can't be found in the system.",
Data = null
};
}
var chatId = ChatIdentifier.GenerateChatId(sendMessageDto.Sender, sendMessageDto.Receiver);
var criteria = new List<(string, string)>();
criteria.Add(("_id", chatId));
var documents = await _chatMongoDbService.FindAsync<Chat>(criteria);
if (!documents.Any())
{
return new BaseResponse()
{
StatusCode = HttpStatusCodes.NotFound,
Message = "Access to medical history not found.",
Data = null
};
}
var chat = documents[0].Messages;
chat.Add(new Message(sendMessageDto.Sender, sendMessageDto.Message));
var newChat = new Chat();
newChat.SetId(chatId);
newChat.SetMessages(chat);
await _chatMongoDbService.ModifyAsync("_id", chatId, newChat);
return new BaseResponse
{
StatusCode = HttpStatusCodes.NoContent,
Message = null,
Data = null
};
}
public async Task<BaseResponse> HandleGetConversation(GetConversationDto getConversationDto)
{
var validation = new GetConversationValidator();
var validationResult = await validation.ValidateAsync(getConversationDto);
if (!validationResult.IsValid)
{
var firstError = validationResult.Errors.FirstOrDefault();
var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1;
var errorMessage = firstError.ErrorMessage;
return new BaseResponse
{
StatusCode = errorCode,
Message = errorMessage,
Data = null
};
}
if (!await CheckForUsersExistence(getConversationDto.IdUser1, getConversationDto.IdUser2))
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.BadRequest,
Message = "Users can't be found in the system.",
Data = null
};
}
var chatId = ChatIdentifier.GenerateChatId(getConversationDto.IdUser1, getConversationDto.IdUser2);
var criteria = new List<(string, string)>();
criteria.Add(("_id", chatId));
Chat? chat = null;
var documents = await _chatMongoDbService.FindAsync<Chat>(criteria);
if (!documents.Any())
{
chat = new Chat();
chat.SetId(chatId);
await _chatMongoDbService.AddAsync(chat);
}
else
{
chat = documents[0];
}
return new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = "Fetching messages.",
Data = chat
};
}
private async Task<bool> CheckForUsersExistence(Guid idUser1, Guid idUser2)
{
var firstCheck = await _patientRepository.GetByIdAsync(idUser1) != null &&
await _doctorRepository.GetByIdAsync(idUser2) != null;
var secondCheck = await _patientRepository.GetByIdAsync(idUser2) != null &&
await _doctorRepository.GetByIdAsync(idUser1) != null;
return firstCheck || secondCheck;
}
}
@@ -0,0 +1,18 @@
namespace Application.Endpoints.Chats;
public class ChatIdentifier
{
public static string GenerateChatId(Guid id1, Guid id2)
{
// Convert GUIDs to strings
string strId1 = id1.ToString();
string strId2 = id2.ToString();
// Sort the GUID strings
string firstId = strId1.CompareTo(strId2) < 0 ? strId1 : strId2;
string secondId = strId1.CompareTo(strId2) < 0 ? strId2 : strId1;
// Combine them to get a symmetric string
return firstId + "-" + secondId;
}
}
@@ -0,0 +1,7 @@
namespace Application.Endpoints.Chats;
public class GetConversationDto
{
public Guid IdUser1 { get; set; }
public Guid IdUser2 { get; set; }
}
@@ -0,0 +1,15 @@
using FluentValidation;
namespace Application.Endpoints.Chats;
public class GetConversationValidator : AbstractValidator<GetConversationDto>
{
public GetConversationValidator()
{
RuleFor(x => x.IdUser1)
.NotEmpty().WithMessage("IdUser1 is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
RuleFor(x => x.IdUser2)
.NotEmpty().WithMessage("IdUser2 is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
}
}
@@ -0,0 +1,8 @@
namespace Application.Endpoints.Chats;
public class SendMessageDto
{
public Guid Sender { get; set; }
public Guid Receiver { get; set; }
public string Message { get; set; }
}
@@ -0,0 +1,18 @@
using FluentValidation;
namespace Application.Endpoints.Chats;
public class SendMessageValidator : AbstractValidator<SendMessageDto>
{
public SendMessageValidator()
{
RuleFor(x => x.Sender)
.NotEmpty().WithMessage("Sender Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
RuleFor(x => x.Receiver)
.NotEmpty().WithMessage("Receiver Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
RuleFor(x => x.Message)
.NotEmpty().WithMessage("Message is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
}
}
@@ -0,0 +1,7 @@
namespace Application.Endpoints.MedicalHistories.FileManagement;
public class MedicalHistoryCreateDto
{
public Guid UserId { get; set; }
public byte[] Content { get; set; } = [];
}
@@ -0,0 +1,28 @@
using Application.Services.Database;
using FluentValidation;
namespace Application.Endpoints.MedicalHistories.FileManagement;
public class MedicalHistoryCreateValidation : AbstractValidator<MedicalHistoryCreateDto>
{
private readonly IPatientRepository _patientRepository;
public MedicalHistoryCreateValidation(IPatientRepository patientRepository)
{
_patientRepository = patientRepository;
RuleFor(x => x.UserId)
.NotEmpty().WithMessage("Patient is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
.MustAsync(BeExistingUser).WithMessage("Specified patient doesn't exist.")
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
RuleFor(x => x.Content)
.NotEmpty().WithMessage("Description is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString());
}
private async Task<bool> BeExistingUser(Guid userId, CancellationToken cancellationToken)
{
var patient = await _patientRepository.GetByIdAsync(userId);
return patient != null;
}
}
@@ -0,0 +1,156 @@
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Core.Entities;
namespace Application.Endpoints.MedicalHistories.FileManagement;
public class MedicalHistoryFileManagementHandler
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
private readonly IPatientRepository _patientRepository;
public MedicalHistoryFileManagementHandler(IMedicalHistoryRepository medicalHistoryRepository,
IPatientRepository patientRepository, IMedicalHistoryMongoDbService medicalHistoryMongoDbService)
{
_medicalHistoryRepository = medicalHistoryRepository;
_patientRepository = patientRepository;
_medicalHistoryMongoDbService = medicalHistoryMongoDbService;
}
public async Task<BaseResponse> HandleGetAll()
{
var documents = await _medicalHistoryRepository.GetAllAsync().ConfigureAwait(false);
if (documents.Any())
return new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = "Retrieved medical histories",
Data = documents.ToList()
};
return new BaseResponse
{
StatusCode = HttpStatusCodes.NoContent,
Message = "Medical histories not found",
Data = null
};
}
public async Task<BaseResponse> HandleGet(Guid id)
{
var medicalHistory = await _medicalHistoryRepository.GetByIdAsync(id).ConfigureAwait(false);
if (medicalHistory != null)
return new BaseResponse
{
StatusCode = HttpStatusCodes.OK,
Message = "Medical history successfully retrieved",
Data = medicalHistory
};
return new BaseResponse
{
StatusCode = HttpStatusCodes.NotFound,
Message = "Medical history not found in system.",
Data = null
};
}
public async Task<BaseResponse> HandleCreate(MedicalHistoryCreateDto medicalHistoryCreateDto)
{
var validation = new MedicalHistoryCreateValidation(_patientRepository);
var validationResult = await validation.ValidateAsync(medicalHistoryCreateDto);
if (!validationResult.IsValid)
{
var firstError = validationResult.Errors.FirstOrDefault();
var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1;
var errorMessage = firstError.ErrorMessage;
return new BaseResponse
{
StatusCode = errorCode,
Message = errorMessage,
Data = null
};
}
var medicalHistory = new MedicalHistory
{
UserId = medicalHistoryCreateDto.UserId,
Content = medicalHistoryCreateDto.Content
};
var medicalHistoryId = medicalHistory.Id;
var newMedicalHistory = new MedicalHistoryAuthorisationModel
{
Id = medicalHistoryId.ToString(),
Authorisation = new List<string>()
};
await _medicalHistoryMongoDbService.AddAsync(newMedicalHistory);
await _medicalHistoryRepository.AddAsync(medicalHistory);
return new BaseResponse
{
StatusCode = HttpStatusCodes.Created,
Message = "Medical history record registered successfully",
Data = medicalHistory
};
}
public async Task<BaseResponse> HandleUpdate(MedicalHistoryUpdateDto updateDto)
{
var validation = new MedicalHistoryUpdateValidation(_medicalHistoryRepository, _patientRepository);
var validationResult = await validation.ValidateAsync(updateDto);
if (!validationResult.IsValid)
{
var firstError = validationResult.Errors.FirstOrDefault();
var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1;
var errorMessage = firstError.ErrorMessage;
return new BaseResponse
{
StatusCode = errorCode,
Message = errorMessage,
Data = null
};
}
var medicalHistoryToUpdate = await _medicalHistoryRepository.GetByIdAsync(updateDto.Id);
medicalHistoryToUpdate.Content = updateDto.Content;
await _medicalHistoryRepository.UpdateAsync(medicalHistoryToUpdate);
return new BaseResponse
{
StatusCode = HttpStatusCodes.NoContent,
Message = "Medical record updated successfully",
Data = null
};
}
public async Task<BaseResponse> HandleDelete(Guid id)
{
var medicalRecord = await _medicalHistoryRepository.GetByIdAsync(id);
if (medicalRecord == null)
return new BaseResponse
{
StatusCode = HttpStatusCodes.NotFound,
Message = "Medical record is not in system.",
Data = null
};
await _medicalHistoryMongoDbService.DeleteAsync<MedicalHistoryAuthorisationModel>("_id", id.ToString());
await _medicalHistoryRepository.DeleteAsync(medicalRecord);
//TODO delete from MongoDB
return new BaseResponse
{
StatusCode = HttpStatusCodes.NoContent,
Message = null,
Data = null
};
}
}
@@ -0,0 +1,7 @@
namespace Application.Endpoints.MedicalHistories.FileManagement;
public class MedicalHistoryUpdateDto
{
public Guid Id { get; set; }
public byte[] Content { get; set; } = [];
}
@@ -0,0 +1,30 @@
using Application.Services.Database;
using FluentValidation;
namespace Application.Endpoints.MedicalHistories.FileManagement;
public class MedicalHistoryUpdateValidation : AbstractValidator<MedicalHistoryUpdateDto>
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IPatientRepository _patientRepository;
public MedicalHistoryUpdateValidation(IMedicalHistoryRepository medicalHistoryRepository,
IPatientRepository patientRepository)
{
_medicalHistoryRepository = medicalHistoryRepository;
_patientRepository = patientRepository;
RuleFor(x => x.Id)
.NotEmpty().WithMessage("Id is required")
.MustAsync(BeExistingMedicalHistoryRecord).WithMessage("Medical history record does not exist");
RuleFor(x => x.Content)
.NotEmpty().WithMessage("Description is required.");
}
private async Task<bool> BeExistingMedicalHistoryRecord(Guid guid, CancellationToken token)
{
var record = await _medicalHistoryRepository.GetByIdAsync(guid);
return record != null;
}
}
@@ -0,0 +1,7 @@
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
public class MedicalHistoryManageAuthorizationDoctorDto
{
public Guid MedicalRecordId { get; set; }
public Guid DoctorId { get; set; }
}
@@ -0,0 +1,141 @@
using Application.Services.Database;
using Application.Services.Database.MongoDB;
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
public class MedicalHistoryManageAuthorizationHandler
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IDoctorRepository _doctorRepository;
private readonly IMedicalHistoryMongoDbService _medicalHistoryMongoDbService;
public MedicalHistoryManageAuthorizationHandler(IMedicalHistoryRepository medicalHistoryRepository,
IMedicalHistoryMongoDbService medicalHistoryMongoDbService, IDoctorRepository doctorRepository)
{
_medicalHistoryRepository = medicalHistoryRepository;
_medicalHistoryMongoDbService = medicalHistoryMongoDbService;
_doctorRepository = doctorRepository;
}
public async Task<BaseResponse> HandleGrantDoctorAccess(MedicalHistoryManageAuthorizationDoctorDto infoDto)
{
var validation = new MedicalHistoryManageAuthorizationValidation(_medicalHistoryRepository, _doctorRepository);
var validationResult = await validation.ValidateAsync(infoDto);
if (!validationResult.IsValid)
{
var firstError = validationResult.Errors.FirstOrDefault();
var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1;
var errorMessage = firstError.ErrorMessage;
return new BaseResponse
{
StatusCode = errorCode,
Message = errorMessage,
Data = null
};
}
var criteria = new List<(string, string)>();
criteria.Add(("_id", infoDto.MedicalRecordId.ToString()));
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
if (!documents.Any())
{
return new BaseResponse()
{
StatusCode = HttpStatusCodes.NotFound,
Message = "Access to medical history not found.",
Data = null
};
}
var authorisations = documents[0].Authorisation;
if (authorisations.Contains(infoDto.ToString()))
{
return new BaseResponse()
{
StatusCode = HttpStatusCodes.Conflict,
Message = "Access to medical history already granted.",
Data = null
};
}
authorisations.Add(infoDto.DoctorId.ToString());
var authorizationModel = new MedicalHistoryAuthorisationModel()
{
Id = infoDto.MedicalRecordId.ToString(),
Authorisation = authorisations
};
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
return new BaseResponse()
{
StatusCode = HttpStatusCodes.OK,
Message = "Access to medical history granted.",
Data = null
};
}
public async Task<BaseResponse> HandleRevokeDoctorAccess(MedicalHistoryManageAuthorizationDoctorDto infoDto)
{
var validation = new MedicalHistoryManageAuthorizationValidation(_medicalHistoryRepository, _doctorRepository);
var validationResult = await validation.ValidateAsync(infoDto);
if (!validationResult.IsValid)
{
var firstError = validationResult.Errors.FirstOrDefault();
var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1;
var errorMessage = firstError.ErrorMessage;
return new BaseResponse
{
StatusCode = errorCode,
Message = errorMessage,
Data = null
};
}
var criteria = new List<(string, string)>();
criteria.Add(("_id", infoDto.MedicalRecordId.ToString()));
var documents = await _medicalHistoryMongoDbService.FindAsync<MedicalHistoryAuthorisationModel>(criteria);
if (!documents.Any())
{
return new BaseResponse()
{
StatusCode = HttpStatusCodes.NotFound,
Message = "Access to medical history not found.",
Data = null
};
}
var authorisations = documents[0].Authorisation;
if (!authorisations.Contains(infoDto.DoctorId.ToString()))
{
return new BaseResponse()
{
StatusCode = HttpStatusCodes.Conflict,
Message = "Access to medical history already revoked.",
Data = null
};
}
authorisations.Remove(infoDto.DoctorId.ToString());
var authorizationModel = new MedicalHistoryAuthorisationModel()
{
Id = infoDto.MedicalRecordId.ToString(),
Authorisation = authorisations
};
await _medicalHistoryMongoDbService.ModifyAsync("_id", infoDto.MedicalRecordId.ToString(), authorizationModel);
return new BaseResponse()
{
StatusCode = HttpStatusCodes.OK,
Message = "Access to medical history granted.",
Data = null
};
}
}
@@ -0,0 +1,39 @@
using Application.Services.Database;
using FluentValidation;
namespace Application.Endpoints.MedicalHistories.ManageAuthorization;
public class MedicalHistoryManageAuthorizationValidation : AbstractValidator<MedicalHistoryManageAuthorizationDoctorDto>
{
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
private readonly IDoctorRepository _doctorRepository;
public MedicalHistoryManageAuthorizationValidation(IMedicalHistoryRepository medicalHistoryRepository,
IDoctorRepository doctorRepository)
{
RuleFor(x => x.MedicalRecordId)
.NotEmpty().WithMessage("Id is required").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
.MustAsync(BeExistingMedicalHistoryRecord).WithMessage("Medical history record does not exist")
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
RuleFor(x => x.DoctorId)
.NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString())
.MustAsync(IsDoctorRegistered).WithMessage("Doctor is not registered in system")
.WithErrorCode(HttpStatusCodes.NotFound.ToString());
_medicalHistoryRepository = medicalHistoryRepository;
_doctorRepository = doctorRepository;
}
private async Task<bool> BeExistingMedicalHistoryRecord(Guid guid, CancellationToken token)
{
var record = await _medicalHistoryRepository.GetByIdAsync(guid);
return record != null;
}
private async Task<bool> IsDoctorRegistered(Guid id, CancellationToken cancellationToken)
{
var doctor = await _doctorRepository.GetByIdAsync(id);
return doctor != null;
}
}
@@ -1,6 +1,16 @@
namespace Application.Services.Database.MongoDB; using MongoDB.Driver;
namespace Application.Services.Database.MongoDB;
public interface IChatMongoDbService public interface IChatMongoDbService
{ {
// Additional methods specific to Chat database IMongoCollection<T> GetCollection<T>();
Task<List<T>> FindAsync<T>(List<(string FieldName, string Value)> criteria);
Task AddAsync<T>(T document);
Task ModifyAsync<T>(string keyField, string keyValue, T document);
Task DeleteAsync<T>(string keyField, string keyValue);
} }
@@ -5,13 +5,13 @@ namespace Application.Services.Database.MongoDB;
public interface IMedicalHistoryMongoDbService public interface IMedicalHistoryMongoDbService
{ {
IMongoCollection<MedicalHistoryAuthorisationModel> GetCollection<MedicalHistoryAuthorisationModel>(); IMongoCollection<T> GetCollection<T>();
Task<List<MedicalHistoryAuthorisationModel>> FindAsync<MedicalHistoryAuthorisationModel>(List<(string FieldName, string Value)> criteria); Task<List<T>> FindAsync<T>(List<(string FieldName, string Value)> criteria);
Task AddAsync<MedicalHistoryAuthorisationModel>(MedicalHistoryAuthorisationModel document); Task AddAsync<T>(T document);
Task ModifyAsync<MedicalHistoryAuthorisationModel>(string keyField, string keyValue, MedicalHistoryAuthorisationModel document); Task ModifyAsync<T>(string keyField, string keyValue, T document);
Task DeleteAsync<MedicalHistoryAuthorisationModel>(string keyField, string keyValue); Task DeleteAsync<T>(string keyField, string keyValue);
} }
@@ -0,0 +1,10 @@
using System.Security.Claims;
namespace Application.Services.Jwt;
public interface IJwtService
{
string GenerateJwtToken(string email);
bool ValidateJwtToken(string token);
string? RefreshToken(string token);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,14 +14,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -69,7 +67,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
}, },
@@ -83,14 +81,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -130,7 +126,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
} }
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Application")] [assembly: System.Reflection.AssemblyCompanyAttribute("Application")]
[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+61a55fa7353346bdad2d677f0ec3c044c3aa87d5")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+90604e48ae9f78fa417a446c05f7759001447de5")]
[assembly: System.Reflection.AssemblyProductAttribute("Application")] [assembly: System.Reflection.AssemblyProductAttribute("Application")]
[assembly: System.Reflection.AssemblyTitleAttribute("Application")] [assembly: System.Reflection.AssemblyTitleAttribute("Application")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
ca8d9dbfc6e022b60b63524e70a3acb8ce1eaa86a2b066fce9c4864553b6125d 4068cc9959fca65509f12b041892bbe15b7b0ed4cb99494d72cf4e4d471b7ce1
@@ -1 +1 @@
e99f7362e6da84368608067cdbb0c281eef010bca303f59d33c712edf6a9964f a14527b9f0436826149b6114fc93ca0d3615f169c5065e509d90189e6d49d7bf
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/48eb2adcbd149cd66c77ba558f492179d2bf29be/*"}}
+2 -4
View File
@@ -851,14 +851,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -906,7 +904,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "+8cvg1kefgWQCHZNz0UFBqaMFHCU9vs6eKiSXlImrLEp7SlxQgKE4onuOThyjCArZTaU+iPlTxlBKu/wIdbkNg==", "dgSpecHash": "6rK5hZ4j6ClAzfxuWc17Wft98VDUQupYiEeI5viBfPq8M3e7wy2vBJ/LEy/lClFvezbz4wHPGdpeQDPOA9ZtBw==",
"success": true, "success": true,
"projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj", "projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
@@ -1 +1 @@
"restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj","projectName":"Application","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj":{"projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"FluentValidation":{"target":"Package","version":"[11.9.0, )"},"MongoDB.Driver":{"target":"Package","version":"[2.24.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json"}} "restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj","projectName":"Application","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj":{"projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"FluentValidation":{"target":"Package","version":"[11.9.0, )"},"MongoDB.Driver":{"target":"Package","version":"[2.24.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"}}
@@ -1 +1 @@
17122552827049708 17125558124497896
@@ -1 +1 @@
17125075151933320 17125685577729624
+57
View File
@@ -0,0 +1,57 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthcareManager.API", "HealthcareManager.API", "{F1846AEC-7080-447F-BC7E-4DB4CFDD0B9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "API", "API\API.csproj", "{AE742B5B-E541-4355-AD47-F36DDFF5C42E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthcareManager.Core", "HealthcareManager.Core", "{0FDD5484-B105-4B18-8C8B-A79B5D3A0228}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthcareManager.Infrastructure", "HealthcareManager.Infrastructure", "{2E30D87F-DC3C-4853-A755-7E3FBA2164E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{1158DC66-C8F1-4962-B294-1C4C86EE8A82}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{5E75761E-5C8B-488C-9C39-5D0E663258C5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthcareManager.Application", "HealthcareManager.Application", "{7FF28CA1-48C0-4A95-8056-977F3469577C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE742B5B-E541-4355-AD47-F36DDFF5C42E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE742B5B-E541-4355-AD47-F36DDFF5C42E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE742B5B-E541-4355-AD47-F36DDFF5C42E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE742B5B-E541-4355-AD47-F36DDFF5C42E}.Release|Any CPU.Build.0 = Release|Any CPU
{1158DC66-C8F1-4962-B294-1C4C86EE8A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1158DC66-C8F1-4962-B294-1C4C86EE8A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1158DC66-C8F1-4962-B294-1C4C86EE8A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1158DC66-C8F1-4962-B294-1C4C86EE8A82}.Release|Any CPU.Build.0 = Release|Any CPU
{5E75761E-5C8B-488C-9C39-5D0E663258C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E75761E-5C8B-488C-9C39-5D0E663258C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E75761E-5C8B-488C-9C39-5D0E663258C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E75761E-5C8B-488C-9C39-5D0E663258C5}.Release|Any CPU.Build.0 = Release|Any CPU
{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{726E8EFD-FC6A-4104-B8FB-2D9049C748C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AE742B5B-E541-4355-AD47-F36DDFF5C42E} = {F1846AEC-7080-447F-BC7E-4DB4CFDD0B9D}
{1158DC66-C8F1-4962-B294-1C4C86EE8A82} = {0FDD5484-B105-4B18-8C8B-A79B5D3A0228}
{5E75761E-5C8B-488C-9C39-5D0E663258C5} = {2E30D87F-DC3C-4853-A755-7E3FBA2164E0}
{726E8EFD-FC6A-4104-B8FB-2D9049C748C6} = {7FF28CA1-48C0-4A95-8056-977F3469577C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B4EDD4C4-C138-4A7C-9D15-283AC586050F}
EndGlobalSection
EndGlobal
+16 -9
View File
@@ -5,19 +5,26 @@ namespace Core.Entities;
public class Chat public class Chat
{ {
[BsonId] public string Id { get; private set; }
[BsonRepresentation(BsonType.String)] public List<Message> Messages { get; private set; } = new();
public Guid Id { get; set; }
public Guid PatientId { get; set; } public void SetId(string id) { Id = id; }
public Guid DoctorId { get; set; } public void SetMessages(List<Message> messages) { Messages = messages; }
public List<Message> Messages { get; set; } = new();
} }
public class Message public class Message
{ {
[BsonRepresentation(BsonType.String)] public Guid UserId { get; set; } public Message(Guid userId, string content)
{
UserId = userId;
Content = content;
}
[BsonRepresentation(BsonType.String)]
public Guid UserId { get; private set; }
public string Content { get; set; } public string Content { get; private set; }
public void SetUserId(Guid userId) { UserId = userId; }
public void SetContent(string content) { Content = content; }
} }
Binary file not shown.
Binary file not shown.
@@ -14,14 +14,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -61,7 +59,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
} }
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Core")] [assembly: System.Reflection.AssemblyCompanyAttribute("Core")]
[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+2ccec617a59a712428e67340dc46bebefb152aca")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+90604e48ae9f78fa417a446c05f7759001447de5")]
[assembly: System.Reflection.AssemblyProductAttribute("Core")] [assembly: System.Reflection.AssemblyProductAttribute("Core")]
[assembly: System.Reflection.AssemblyTitleAttribute("Core")] [assembly: System.Reflection.AssemblyTitleAttribute("Core")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
232a219588f79d4fe98faad4c868c44fc40b96e3f6b7bc8086f4447599f3e74e 5ede8fc56c8888c470a0873d22c6c4a215f0f44ccdf0f65ca635f6a6e2268a9e
@@ -1 +1 @@
481a6e81c3fb29f18f770ac0db64e6d4af0d1f426e06832b919c28802ccff560 6236e3f912b0532e598b72e522cff0eefd892ca01f330905ca686a017c34f569
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/2ccec617a59a712428e67340dc46bebefb152aca/*"}} {"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/48eb2adcbd149cd66c77ba558f492179d2bf29be/*"}}
Binary file not shown.
Binary file not shown.
+2 -4
View File
@@ -137,14 +137,12 @@
"outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\", "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\",
"projectStyle": "PackageReference", "projectStyle": "PackageReference",
"configFilePaths": [ "configFilePaths": [
"C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config"
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
], ],
"originalTargetFrameworks": [ "originalTargetFrameworks": [
"net8.0" "net8.0"
], ],
"sources": { "sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {} "https://api.nuget.org/v3/index.json": {}
}, },
"frameworks": { "frameworks": {
@@ -184,7 +182,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "7w8jrDBwgqCxUk4JCLDDAjFhEwshlhuMIblS2oyN6q5PKozln6O0dA8f6jN7yAtN9OFFP5VyVOSdJRz2HZbDHQ==", "dgSpecHash": "nUJYWQem8SFagSjBlwYcU+nbTi53nWZSxYTrPiHNTHcOWnBld4SMEechWWzFO+t4nThl0DYYE7H20aSoUlJA8A==",
"success": true, "success": true,
"projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj", "projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
+1 -1
View File
@@ -1 +1 @@
"restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj","projectName":"Core","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"MongoDB.Bson":{"target":"Package","version":"[2.24.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json"}} "restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj","projectName":"Core","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"MongoDB.Bson":{"target":"Package","version":"[2.24.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Users\\Andrei Cerbu\\.dotnet\\sdk\\8.0.203/PortableRuntimeIdentifierGraph.json"}}
@@ -1 +1 @@
17122552827080702 17125558124496805
+1 -1
View File
@@ -1 +1 @@
17125075151943813 17125685577652628
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Users\Andrei Cerbu\.dotnet\sdk\8.0.203\MSBuild.dll</s:String></wpf:ResourceDictionary>
@@ -16,8 +16,10 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0"/> <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0"/> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0"/>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.5.1" />
<PackageReference Include="MongoDB.Driver" Version="2.24.0"/> <PackageReference Include="MongoDB.Driver" Version="2.24.0"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2"/> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2"/>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+26 -13
View File
@@ -1,10 +1,13 @@
using Application.Services.Database; using Application.Services.Database;
using Application.Services.Database.MongoDB; using Application.Services.Database.MongoDB;
using Application.Services.HashingAlgorithms; using Application.Services.HashingAlgorithms;
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;
@@ -25,29 +28,39 @@ public static class DependencyInjection
services.AddScoped<IDoctorRepository, DoctorRepository>(); services.AddScoped<IDoctorRepository, DoctorRepository>();
services.AddScoped<IMedicalHistoryRepository, MedicalHistoryRepository>(); services.AddScoped<IMedicalHistoryRepository, MedicalHistoryRepository>();
// MongoDB Service // MongoDB services
var mongoDbConnectionString = configuration.GetValue<string>("ConnectionStrings:MongoDBConnection");
// Extract MongoDB database names
var healthcareManagerDatabaseName = configuration.GetValue<string>("HealthcareManagerDatabase:Name");
var medicalHistoryCollectionName = configuration.GetValue<string>("HealthcareManagerDatabase:MedicalRecordCollectionName");
var chatCollectionName = configuration.GetValue<string>("HealthcareManagerDatabase:ChatCollectionName");
// Register MongoDB services
services.AddSingleton<IMedicalHistoryMongoDbService>(serviceProvider => services.AddSingleton<IMedicalHistoryMongoDbService>(serviceProvider =>
new MedicalHistoryMongoDbService(mongoDbConnectionString, healthcareManagerDatabaseName, medicalHistoryCollectionName)); {
var configuration = serviceProvider.GetRequiredService<IConfiguration>();
var connectionString = configuration.GetConnectionString("MongoDBConnection");
var databaseName = configuration["HealthcareManagerDatabase:Name"];
var collectionName = configuration["HealthcareManagerDatabase:MedicalRecordCollectionName"];
return new MedicalHistoryMongoDbService(connectionString, databaseName, collectionName);
});
services.AddSingleton<IChatMongoDbService>(serviceProvider => services.AddSingleton<IChatMongoDbService>(serviceProvider =>
new ChatMongoDbService(mongoDbConnectionString, healthcareManagerDatabaseName, chatCollectionName)); {
var configuration = serviceProvider.GetRequiredService<IConfiguration>();
var connectionString = configuration.GetConnectionString("MongoDBConnection");
var databaseName = configuration["HealthcareManagerDatabase:Name"];
var collectionName = configuration["HealthcareManagerDatabase:ChatCollectionName"];
return new ChatMongoDbService(connectionString, databaseName, collectionName);
});
// Other Services // Other Services
services.AddScoped<IHashingAlgorithms, HashingAlgorithms>(); services.AddScoped<IHashingAlgorithms, HashingAlgorithms>();
services.AddSingleton<IJwtService, JwtService>(serviceProvider =>
{
var configuration = serviceProvider.GetRequiredService<IConfiguration>();
return new JwtService(configuration);
});
// services.AddScoped<IEmailService, EmailService>(); // services.AddScoped<IEmailService, EmailService>();
return services; return services;
} }
private static string ExtractMongoDbDatabaseName(string connectionString) private static string ExtractMongoDbDatabaseName(string connectionString)
{ {
var connectionStringBuilder = new MongoUrlBuilder(connectionString); var connectionStringBuilder = new MongoUrlBuilder(connectionString);
@@ -0,0 +1,115 @@
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using Application.Services.Jwt;
public class JwtService : IJwtService
{
private readonly string _secretKey;
private readonly string _issuer;
private readonly string _audience;
private readonly double _expiryMinutes;
public JwtService(IConfiguration configuration)
{
_secretKey = configuration["Jwt:SecretKey"];
_issuer = configuration["Jwt:Issuer"];
_audience = configuration["Jwt:Audience"];
_expiryMinutes = double.Parse(configuration["Jwt:ExpiryMinutes"]);
}
public string GenerateJwtToken(string email)
{
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes(_secretKey);
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new[]
{
new Claim(ClaimTypes.Email, email)
}),
Expires = DateTime.UtcNow.AddMinutes(_expiryMinutes),
Issuer = _issuer,
Audience = _audience,
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
};
var token = tokenHandler.CreateToken(tokenDescriptor);
return tokenHandler.WriteToken(token);
}
public bool ValidateJwtToken(string token)
{
if (string.IsNullOrWhiteSpace(token))
return false;
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes(_secretKey);
try
{
tokenHandler.ValidateToken(token, new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = true,
ValidateAudience = true,
ValidIssuer = _issuer,
ValidAudience = _audience,
ClockSkew = TimeSpan.Zero,
}, out SecurityToken validatedToken);
return true;
}
catch
{
return false;
}
}
public string RefreshToken(string token)
{
var principal = ValidateTokenAndGetPrincipal(token);
if (principal == null)
{
throw new SecurityTokenException("Invalid token.");
}
var emailClaim = principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email);
if (emailClaim == null)
{
throw new SecurityTokenException("Token does not contain an email claim.");
}
return GenerateJwtToken(emailClaim.Value);
}
private ClaimsPrincipal ValidateTokenAndGetPrincipal(string token)
{
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes(_secretKey);
try
{
var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = true,
ValidateAudience = true,
ValidIssuer = _issuer,
ValidAudience = _audience,
ClockSkew = TimeSpan.Zero,
}, out _);
return principal;
}
catch
{
// Log or handle validation errors if necessary
return null;
}
}
}
@@ -4,10 +4,10 @@ namespace Infrastructure.Services.MongoDB;
public class ChatMongoDbService : MongoDbService, IChatMongoDbService public class ChatMongoDbService : MongoDbService, IChatMongoDbService
{ {
public ChatMongoDbService(string connectionString, string databaseName, string collectionName) public ChatMongoDbService(string connectionString, string databaseName, string collectionName)
: base(connectionString, databaseName, collectionName) : base(connectionString, databaseName, collectionName)
{ {
} }
// Implement additional methods specific to Chat database if needed // Implement additional methods specific to Chat database if needed
} }
@@ -4,10 +4,10 @@ namespace Infrastructure.Services.MongoDB;
public class MedicalHistoryMongoDbService : MongoDbService, IMedicalHistoryMongoDbService public class MedicalHistoryMongoDbService : MongoDbService, IMedicalHistoryMongoDbService
{ {
public MedicalHistoryMongoDbService(string connectionString, string databaseName, string collectionName) public MedicalHistoryMongoDbService(string connectionString, string databaseName, string collectionName)
: base(connectionString, databaseName, collectionName) : base(connectionString, databaseName, collectionName)
{ {
} }
// Implement additional methods specific to Medical History database if needed // Implement additional methods specific to Medical History database if needed
} }
@@ -14,7 +14,7 @@ namespace Infrastructure.Services.MongoDB
{ {
_databaseName = databaseName; _databaseName = databaseName;
_collectionName = collectionName; _collectionName = collectionName;
Console.WriteLine($"Connection string: {connectionString}"); Console.WriteLine($"Connection string: {connectionString}");
Console.WriteLine($"Database Name: {databaseName}"); Console.WriteLine($"Database Name: {databaseName}");
Console.WriteLine($"Collection Name: {collectionName}"); Console.WriteLine($"Collection Name: {collectionName}");
@@ -23,12 +23,12 @@ namespace Infrastructure.Services.MongoDB
settings.ServerApi = new ServerApi(ServerApiVersion.V1); settings.ServerApi = new ServerApi(ServerApiVersion.V1);
_database = new MongoClient(settings); _database = new MongoClient(settings);
try try
{ {
var result = _database.GetDatabase("admin").RunCommand<BsonDocument>(new BsonDocument("ping", 1)); var result = _database.GetDatabase("admin").RunCommand<BsonDocument>(new BsonDocument("ping", 1));
Console.WriteLine("Pinged your deployment. You successfully connected to MongoDB!"); Console.WriteLine("Pinged your deployment. You successfully connected to MongoDB!");
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex); Console.WriteLine(ex);
} }
@@ -71,4 +71,4 @@ namespace Infrastructure.Services.MongoDB
await collection.DeleteOneAsync(filter); await collection.DeleteOneAsync(filter);
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More