diff --git a/backend/API/API.csproj b/backend/API/API.csproj index 59e8b4c..43c6bbf 100644 --- a/backend/API/API.csproj +++ b/backend/API/API.csproj @@ -1,18 +1,19 @@ - - net8.0 - enable - enable - + + net8.0 + enable + enable + API + - - - + + + - - - - + + + + diff --git a/backend/API/Controllers/ChatController.cs b/backend/API/Controllers/ChatController.cs index f9d3256..47f585e 100644 --- a/backend/API/Controllers/ChatController.cs +++ b/backend/API/Controllers/ChatController.cs @@ -10,5 +10,4 @@ public class ChatController : BaseApiController { _mongoDbService = mongoDbService; } - -} +} \ No newline at end of file diff --git a/backend/API/Controllers/DoctorsController.cs b/backend/API/Controllers/DoctorsController.cs index 62a3874..a589f37 100644 --- a/backend/API/Controllers/DoctorsController.cs +++ b/backend/API/Controllers/DoctorsController.cs @@ -1,117 +1,80 @@ -using Microsoft.AspNetCore.Mvc; -using Core.Entities; +using Application.Endpoints; using Application.Endpoints.Doctors.Login; -using Application.Services.Database; +using Application.Endpoints.Doctors.Profile; using Application.Endpoints.Doctors.Registration; using Application.Endpoints.Doctors.ResetPassword; -using Application.Endpoints.Doctors.Profile; +using Application.Services.Database; +using Application.Services.HashingAlgorithms; +using Microsoft.AspNetCore.Mvc; -namespace HealthcareManager.API.Controllers; +namespace API.Controllers; [ApiController] [Route("api/[controller]")] public class DoctorsController : ControllerBase { private readonly IDoctorRepository _database; + private readonly IHashingAlgorithms _hashingAlgorithms; - public DoctorsController(IDoctorRepository database) + public DoctorsController(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms) { - _database = database ?? throw new ArgumentNullException(nameof(database)); - } - - [HttpGet] - public async Task> GetAllDoctors() - { - var handler = new DoctorProfileHandler(_database); - var response = await handler.HandleGetAll(); - if (!response.Success) - { - return BadRequest(response); - } - - return Ok(response.Data); - } - - [HttpGet("{id}")] - public async Task> GetDoctor(Guid id) - { - var handler = new DoctorProfileHandler(_database); - var response = await handler.HandleGet(id); - if (!response.Success) - { - return BadRequest(response); - } - - return Ok(response.Data); - } - - [HttpPost("login")] - public async Task> Login(DoctorLoginDTO doctor) - { - var handler = new DoctorLoginHandler(_database); - var response = await handler.Handle(doctor).ConfigureAwait(false); - - if(!response.Success) - { - return Unauthorized(response); - } - - return Ok(response); + _database = database; + _hashingAlgorithms = hashingAlgorithms; } [HttpPost("register")] - public async Task> Register(DoctorRegistrationDto doctor) + public async Task> Register(DoctorRegistrationDto doctor) { - var handler = new DoctorRegistrationHandler(_database); + var handler = new DoctorRegistrationHandler(_database, _hashingAlgorithms); var response = await handler.Handle(doctor).ConfigureAwait(false); - - if (!response.Success) - { - return Unauthorized(response); - } - - return Ok(response); + return StatusCode(response.StatusCode, response); } - [HttpPost("resetPassword")] - public async Task ResetPassword(DoctorLoginDTO resetDoctorDto) + [HttpPost("login")] + public async Task> Login(DoctorLoginDto doctor) { - var handler = new DoctorResetPasswordHandler(_database); + var handler = new DoctorLoginHandler(_database, _hashingAlgorithms); + var response = await handler.Handle(doctor).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpPost("reset_password")] + public async Task> ResetPassword(DoctorResetPasswordDto resetDoctorDto) + { + var handler = new DoctorResetPasswordHandler(_database, _hashingAlgorithms); var response = await handler.Handle(resetDoctorDto).ConfigureAwait(false); - - if (response.Success) - { - return Ok(response); - } - - return BadRequest(response); + return StatusCode(response.StatusCode, response); } - [HttpPut("{id}/profile")] - public async Task UpdateDoctorProfile(Guid id, [FromBody]DoctorProfileDTO doctorDto) + [HttpGet] + public async Task> GetAllDoctors() { - var handler = new DoctorProfileHandler(_database); - var response = await handler.HandleUpdate(id, doctorDto).ConfigureAwait(false); - - if (response.Success) - { - return Ok(response); - } - - return BadRequest(response); + var handler = new DoctorProfileHandler(_database, _hashingAlgorithms); + var response = await handler.HandleGetAll(); + return StatusCode(response.StatusCode, response); } - [HttpDelete("{id}/profile")] - public async Task DeleteDoctorProfile(Guid id) + [HttpGet("{id}")] + public async Task> GetDoctor(Guid id) { - var handler = new DoctorProfileHandler(_database); + var handler = new DoctorProfileHandler(_database, _hashingAlgorithms); + var response = await handler.HandleGet(id); + return StatusCode(response.StatusCode, response); + } + + [HttpPut] + public async Task> UpdateDoctorProfile(DoctorProfileUpdateDto doctorUpdateDto) + { + var handler = new DoctorProfileHandler(_database, _hashingAlgorithms); + var response = await handler.HandleUpdate(doctorUpdateDto).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpDelete("{id}")] + public async Task> DeleteDoctorProfile(Guid id) + { + var handler = new DoctorProfileHandler(_database, _hashingAlgorithms); var response = await handler.HandleDelete(id).ConfigureAwait(false); - - if (response.Success) - { - return NoContent(); - } - - return BadRequest(response); + return StatusCode(response.StatusCode, response); } -} +} \ No newline at end of file diff --git a/backend/API/Controllers/MedicalHistoryController.cs b/backend/API/Controllers/MedicalHistoryController.cs index e124c24..b8628a7 100644 --- a/backend/API/Controllers/MedicalHistoryController.cs +++ b/backend/API/Controllers/MedicalHistoryController.cs @@ -1,67 +1,71 @@ -using Application.Endpoints.MedicalHistories; +using Application.Endpoints; +using Application.Endpoints.MedicalHistories; using Application.Services.Database; -using Core.Entities; using Microsoft.AspNetCore.Mvc; -namespace HealthcareManager.API.Controllers; +namespace API.Controllers; [ApiController] [Route("api/[controller]")] public class MedicalHistoryController : ControllerBase { private readonly IMedicalHistoryRepository _medicalHistoryRepository; - private readonly IPacientRepository _pacientRepository; + private readonly IMongoDbService _mongoDbService; + private readonly IPatientRepository _patientRepository; - public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository, IPacientRepository pacientRepository) + public MedicalHistoryController(IMedicalHistoryRepository medicalHistoryRepository, + IPatientRepository patientRepository, IMongoDbService mongoDbService) { - _medicalHistoryRepository = medicalHistoryRepository ?? throw new ArgumentNullException(nameof(medicalHistoryRepository)); - _pacientRepository = pacientRepository ?? throw new ArgumentNullException(nameof(pacientRepository)); + _medicalHistoryRepository = medicalHistoryRepository; + _patientRepository = patientRepository; + _mongoDbService = mongoDbService; } [HttpGet("{id}")] - public async Task> GetAsync(Guid id) + public async Task> GetAsync(Guid id) { - var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _pacientRepository); + var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService); var response = await handler.HandleGet(id); - if (!response.Success) - { - return BadRequest(response); - } - - return Ok(response.Data); + return StatusCode(response.StatusCode, response); } - [HttpPost("{id}")] - public async Task> PostAsync(Guid id, [FromBody] byte[] description) + [HttpGet] + public async Task> GetAllDoctors() { - var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _pacientRepository); - var response = await handler.HandleCreate(id, description).ConfigureAwait(false); - - if (!response.Success) - { - return Unauthorized(response); - } - - return Ok(response); + var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService); + var response = await handler.HandleGetAll(); + return StatusCode(response.StatusCode, response); } - [HttpPut("{id}")] - public async Task UpdateAsync(Guid id, [FromBody] MedicalHistoryDTO medicalHistoryDTO) + [HttpPost] + public async Task> PostAsync(MedicalHistoryCreateDto medicalHistoryCreateDto) { - var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _pacientRepository); - var response = await handler.HandleUpdate(id, medicalHistoryDTO).ConfigureAwait(false); - - if (response.Success) - { - return Ok(response); - } - - return BadRequest(response); + var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService); + var response = await handler.HandleCreate(medicalHistoryCreateDto); + return StatusCode(response.StatusCode, response); } + [HttpPut] + public async Task> UpdateAsync(MedicalHistoryUpdateDto medicalHistoryUpdateDto) + { + var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService); + var response = await handler.HandleUpdate(medicalHistoryUpdateDto).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpDelete("{id}")] + public async Task> DeleteAsync(Guid id) + { + var handler = new MedicalHistoryHandler(_medicalHistoryRepository, _patientRepository, _mongoDbService); + var response = await handler.HandleDelete(id); + return StatusCode(response.StatusCode, response); + } + + /* [HttpPut("grant_access")] - public async Task GrantAccessToMedicalHistory(Guid id) + public async Task> GrantAccessToMedicalHistory(GrantAccessMedicalHistoryDto) { return NotFound(); } -} + */ +} \ No newline at end of file diff --git a/backend/API/Controllers/PacientsController.cs b/backend/API/Controllers/PacientsController.cs deleted file mode 100644 index 2ec98b4..0000000 --- a/backend/API/Controllers/PacientsController.cs +++ /dev/null @@ -1,117 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Core.Entities; -using Application.Endpoints.Pacients.Login; -using Application.Services.Database; -using Application.Endpoints.Pacients.Registration; -using Application.Endpoints.Pacients.ResetPassword; -using Application.Endpoints.Pacients.Profile; - -namespace HealthcareManager.API.Controllers; - -[ApiController] -[Route("api/[controller]")] -public class PacientsController : ControllerBase -{ - private readonly IPacientRepository _database; - - public PacientsController(IPacientRepository database) - { - _database = database ?? throw new ArgumentNullException(nameof(database)); - } - - [HttpGet] - public async Task> GetAllPacients() - { - var handler = new PacientProfileHandler(_database); - var response = await handler.HandleGetAll(); - if (!response.Success) - { - return BadRequest(response); - } - - return Ok(response.Data); - } - - [HttpGet("{id}")] - public async Task> GetPacient(Guid id) - { - var handler = new PacientProfileHandler(_database); - var response = await handler.HandleGet(id); - if (!response.Success) - { - return BadRequest(response); - } - - return Ok(response.Data); - } - - [HttpPost("login")] - public async Task> Login(PacientLoginDTO pacient) - { - var handler = new PacientLoginHandler(_database); - var response = await handler.Handle(pacient).ConfigureAwait(false); - - if (!response.Success) - { - return Unauthorized(response); - } - - return Ok(response); - } - - [HttpPost("register")] - public async Task> Register(PacientRegistrationDto pacient) - { - var handler = new PacientRegistrationHandler(_database); - var response = await handler.Handle(pacient).ConfigureAwait(false); - - if (!response.Success) - { - return Unauthorized(response); - } - - return Ok(response); - } - - [HttpPost("resetPassword")] - public async Task ResetPassword(PacientLoginDTO resetPacientDto) - { - var handler = new PacientResetPasswordHandler(_database); - var response = await handler.Handle(resetPacientDto).ConfigureAwait(false); - - if (response.Success) - { - return Ok(response); - } - - return BadRequest(response); - } - - [HttpPut("{id}/profile")] - public async Task UpdatePacientProfile(Guid id, [FromBody] PacientProfileDTO pacientDto) - { - var handler = new PacientProfileHandler(_database); - var response = await handler.HandleUpdate(id, pacientDto).ConfigureAwait(false); - - if (response.Success) - { - return Ok(response); - } - - return BadRequest(response); - } - - [HttpDelete("{id}/profile")] - public async Task DeletePacientProfile(Guid id) - { - var handler = new PacientProfileHandler(_database); - var response = await handler.HandleDelete(id).ConfigureAwait(false); - - if (response.Success) - { - return NoContent(); - } - - return BadRequest(response); - } -} diff --git a/backend/API/Controllers/PatientsController.cs b/backend/API/Controllers/PatientsController.cs new file mode 100644 index 0000000..90beb2b --- /dev/null +++ b/backend/API/Controllers/PatientsController.cs @@ -0,0 +1,80 @@ +using Application.Endpoints; +using Application.Endpoints.Patients.Login; +using Application.Endpoints.Patients.Profile; +using Application.Endpoints.Patients.Registration; +using Application.Endpoints.Patients.ResetPassword; +using Application.Services.Database; +using Application.Services.HashingAlgorithms; +using Microsoft.AspNetCore.Mvc; + +namespace API.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class PatientsController : ControllerBase +{ + private readonly IHashingAlgorithms _hashingAlgorithms; + private readonly IPatientRepository _patientRepository; + + public PatientsController(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms) + { + _patientRepository = patientRepository; + _hashingAlgorithms = hashingAlgorithms; + } + + [HttpGet] + public async Task> GetAllPatients() + { + var handler = new PatientProfileHandler(_patientRepository, _hashingAlgorithms); + var response = await handler.HandleGetAll(); + return StatusCode(response.StatusCode, response); + } + + [HttpGet("{id}")] + public async Task> GetPatient(Guid id) + { + var handler = new PatientProfileHandler(_patientRepository, _hashingAlgorithms); + var response = await handler.HandleGet(id); + return StatusCode(response.StatusCode, response); + } + + [HttpPost("login")] + public async Task> Login(PatientLoginDto patientLoginDto) + { + var handler = new PatientLoginHandler(_patientRepository); + var response = await handler.Handle(patientLoginDto).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpPost("register")] + public async Task> Register(PatientRegistrationDto patientRegistrationDto) + { + var handler = new PatientRegistrationHandler(_patientRepository, _hashingAlgorithms); + var response = await handler.Handle(patientRegistrationDto).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpPost("reset_password")] + public async Task> ResetPassword(PatientResetPasswordDto patientResetPasswordDto) + { + var handler = new PatientResetPasswordHandler(_patientRepository, _hashingAlgorithms); + var response = await handler.Handle(patientResetPasswordDto).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpPut] + public async Task> UpdatePatientProfile(PatientProfileDto patientDto) + { + var handler = new PatientProfileHandler(_patientRepository, _hashingAlgorithms); + var response = await handler.HandleUpdate(patientDto).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } + + [HttpDelete("{id}")] + public async Task> DeletePatientProfile(Guid id) + { + var handler = new PatientProfileHandler(_patientRepository, _hashingAlgorithms); + var response = await handler.HandleDelete(id).ConfigureAwait(false); + return StatusCode(response.StatusCode, response); + } +} \ No newline at end of file diff --git a/backend/API/Middlewares/ApiKeyValidationMiddleware.cs b/backend/API/Middlewares/ApiKeyValidationMiddleware.cs index 142ea4c..919132e 100644 --- a/backend/API/Middlewares/ApiKeyValidationMiddleware.cs +++ b/backend/API/Middlewares/ApiKeyValidationMiddleware.cs @@ -2,8 +2,8 @@ public class ApiKeyValidationMiddleware { - private readonly RequestDelegate _next; private const string APIKEYNAME = "ApiKey"; + private readonly RequestDelegate _next; public ApiKeyValidationMiddleware(RequestDelegate next) { @@ -39,4 +39,4 @@ public class ApiKeyValidationMiddleware await _next(context); } -} +} \ No newline at end of file diff --git a/backend/API/Middlewares/BodyCheckMiddleware.cs b/backend/API/Middlewares/BodyCheckMiddleware.cs index 557290d..e54a79f 100644 --- a/backend/API/Middlewares/BodyCheckMiddleware.cs +++ b/backend/API/Middlewares/BodyCheckMiddleware.cs @@ -17,7 +17,7 @@ public class BodyCheckMiddleware(RequestDelegate next) var buffer = new byte[Convert.ToInt32(context.Request.ContentLength)]; await context.Request.Body.ReadAsync(buffer, 0, buffer.Length); - string requestBody = Encoding.UTF8.GetString(buffer); + var requestBody = Encoding.UTF8.GetString(buffer); context.Request.Body.Seek(0, SeekOrigin.Begin); // Reset the stream for next middleware // Check if the body is empty @@ -31,5 +31,4 @@ public class BodyCheckMiddleware(RequestDelegate next) await _next(context); } -} - +} \ No newline at end of file diff --git a/backend/API/Program.cs b/backend/API/Program.cs index db3649c..3902904 100644 --- a/backend/API/Program.cs +++ b/backend/API/Program.cs @@ -20,7 +20,7 @@ builder.Services.AddSwaggerGen(c => In = ParameterLocation.Header, Scheme = "ApiKeyScheme" }); - var key = new OpenApiSecurityScheme() + var key = new OpenApiSecurityScheme { Reference = new OpenApiReference { @@ -30,9 +30,9 @@ builder.Services.AddSwaggerGen(c => In = ParameterLocation.Header }; var requirement = new OpenApiSecurityRequirement - { - { key, new List() } - }; + { + { key, new List() } + }; c.AddSecurityRequirement(requirement); }); @@ -66,8 +66,5 @@ app.Run(); static void EnsureDatabaseCreated(HealthcareManagerDatabase dbContext) { // Checking for pending migrations is more efficient than applying migrations unconditionally - if (dbContext.Database.GetPendingMigrations().Any()) - { - dbContext.Database.Migrate(); - } + if (dbContext.Database.GetPendingMigrations().Any()) dbContext.Database.Migrate(); } \ No newline at end of file diff --git a/backend/API/appsettings.json b/backend/API/appsettings.json index b3317b4..2942806 100644 --- a/backend/API/appsettings.json +++ b/backend/API/appsettings.json @@ -9,7 +9,6 @@ "HealthcareManagerDatabase": "Host=surus.db.elephantsql.com;Database=newbwuyu;Username=newbwuyu;Password=0end9Ixqo9PeTE4HVslX7_FVwruEhFf-;", "MongoDBDatabase": "mongodb+srv://andrei_cerbu:andrei_cerbu@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0" }, - "AllowedHosts": "*", "ApiKey": "testapikey" } diff --git a/backend/API/bin/Debug/net8.0/API.deps.json b/backend/API/bin/Debug/net8.0/API.deps.json index 1eb504d..3f09a94 100644 --- a/backend/API/bin/Debug/net8.0/API.deps.json +++ b/backend/API/bin/Debug/net8.0/API.deps.json @@ -77,15 +77,15 @@ } }, "Microsoft.EntityFrameworkCore.Analyzers/8.0.3": {}, - "Microsoft.EntityFrameworkCore.Relational/8.0.2": { + "Microsoft.EntityFrameworkCore.Relational/8.0.3": { "dependencies": { "Microsoft.EntityFrameworkCore": "8.0.3", "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" }, "runtime": { "lib/net8.0/Microsoft.EntityFrameworkCore.Relational.dll": { - "assemblyVersion": "8.0.2.0", - "fileVersion": "8.0.224.6803" + "assemblyVersion": "8.0.3.0", + "fileVersion": "8.0.324.11510" } } }, @@ -285,7 +285,7 @@ "dependencies": { "Microsoft.EntityFrameworkCore": "8.0.3", "Microsoft.EntityFrameworkCore.Abstractions": "8.0.3", - "Microsoft.EntityFrameworkCore.Relational": "8.0.2", + "Microsoft.EntityFrameworkCore.Relational": "8.0.3", "Npgsql": "8.0.2" }, "runtime": { @@ -375,7 +375,9 @@ }, "Application/1.0.0": { "dependencies": { - "FluentValidation": "11.9.0" + "Core": "1.0.0", + "FluentValidation": "11.9.0", + "MongoDB.Driver": "2.24.0" }, "runtime": { "Application.dll": {} @@ -394,6 +396,7 @@ "Application": "1.0.0", "Core": "1.0.0", "Microsoft.EntityFrameworkCore": "8.0.3", + "Microsoft.EntityFrameworkCore.Relational": "8.0.3", "Microsoft.Extensions.Configuration": "8.0.0", "Microsoft.Extensions.Configuration.Json": "8.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0", @@ -461,12 +464,12 @@ "path": "microsoft.entityframeworkcore.analyzers/8.0.3", "hashPath": "microsoft.entityframeworkcore.analyzers.8.0.3.nupkg.sha512" }, - "Microsoft.EntityFrameworkCore.Relational/8.0.2": { + "Microsoft.EntityFrameworkCore.Relational/8.0.3": { "type": "package", "serviceable": true, - "sha512": "sha512-NoGfcq2OPw0z8XAPf74YFwGlTKjedWdsIEJqq4SvKcPjcu+B+/XDDNrDRxTvILfz4Ug8POSF49s1jz1JvUqTAg==", - "path": "microsoft.entityframeworkcore.relational/8.0.2", - "hashPath": "microsoft.entityframeworkcore.relational.8.0.2.nupkg.sha512" + "sha512": "sha512-8JnVZHWaNFkrrD/FC0O4jekiHIYey8y6TQ4Co3OzLz0wd5Dm1cwJfTp++1TvaVu0BBd4bVDtiktppa5epuoPrA==", + "path": "microsoft.entityframeworkcore.relational/8.0.3", + "hashPath": "microsoft.entityframeworkcore.relational.8.0.3.nupkg.sha512" }, "Microsoft.Extensions.ApiDescription.Server/6.0.5": { "type": "package", diff --git a/backend/API/bin/Debug/net8.0/API.dll b/backend/API/bin/Debug/net8.0/API.dll index 83e8821..29e2afb 100644 Binary files a/backend/API/bin/Debug/net8.0/API.dll and b/backend/API/bin/Debug/net8.0/API.dll differ diff --git a/backend/API/bin/Debug/net8.0/API.exe b/backend/API/bin/Debug/net8.0/API.exe index ea0d281..c2a09cc 100644 Binary files a/backend/API/bin/Debug/net8.0/API.exe and b/backend/API/bin/Debug/net8.0/API.exe differ diff --git a/backend/API/bin/Debug/net8.0/API.pdb b/backend/API/bin/Debug/net8.0/API.pdb index 32578b1..19f9461 100644 Binary files a/backend/API/bin/Debug/net8.0/API.pdb and b/backend/API/bin/Debug/net8.0/API.pdb differ diff --git a/backend/API/bin/Debug/net8.0/Application.dll b/backend/API/bin/Debug/net8.0/Application.dll index 3847881..bed3154 100644 Binary files a/backend/API/bin/Debug/net8.0/Application.dll and b/backend/API/bin/Debug/net8.0/Application.dll differ diff --git a/backend/API/bin/Debug/net8.0/Application.pdb b/backend/API/bin/Debug/net8.0/Application.pdb index 140769a..81cca86 100644 Binary files a/backend/API/bin/Debug/net8.0/Application.pdb and b/backend/API/bin/Debug/net8.0/Application.pdb differ diff --git a/backend/API/bin/Debug/net8.0/Core.dll b/backend/API/bin/Debug/net8.0/Core.dll index 1de9e46..02b0d46 100644 Binary files a/backend/API/bin/Debug/net8.0/Core.dll and b/backend/API/bin/Debug/net8.0/Core.dll differ diff --git a/backend/API/bin/Debug/net8.0/Core.pdb b/backend/API/bin/Debug/net8.0/Core.pdb index f9e0e04..fafb776 100644 Binary files a/backend/API/bin/Debug/net8.0/Core.pdb and b/backend/API/bin/Debug/net8.0/Core.pdb differ diff --git a/backend/API/bin/Debug/net8.0/Infrastructure.dll b/backend/API/bin/Debug/net8.0/Infrastructure.dll index 4616341..8816b78 100644 Binary files a/backend/API/bin/Debug/net8.0/Infrastructure.dll and b/backend/API/bin/Debug/net8.0/Infrastructure.dll differ diff --git a/backend/API/bin/Debug/net8.0/Infrastructure.pdb b/backend/API/bin/Debug/net8.0/Infrastructure.pdb index 901d426..e5940d7 100644 Binary files a/backend/API/bin/Debug/net8.0/Infrastructure.pdb and b/backend/API/bin/Debug/net8.0/Infrastructure.pdb differ diff --git a/backend/API/bin/Debug/net8.0/Microsoft.EntityFrameworkCore.Relational.dll b/backend/API/bin/Debug/net8.0/Microsoft.EntityFrameworkCore.Relational.dll index b2bd321..0d72770 100644 Binary files a/backend/API/bin/Debug/net8.0/Microsoft.EntityFrameworkCore.Relational.dll and b/backend/API/bin/Debug/net8.0/Microsoft.EntityFrameworkCore.Relational.dll differ diff --git a/backend/API/bin/Debug/net8.0/appsettings.json b/backend/API/bin/Debug/net8.0/appsettings.json index 292fe14..2942806 100644 --- a/backend/API/bin/Debug/net8.0/appsettings.json +++ b/backend/API/bin/Debug/net8.0/appsettings.json @@ -9,6 +9,6 @@ "HealthcareManagerDatabase": "Host=surus.db.elephantsql.com;Database=newbwuyu;Username=newbwuyu;Password=0end9Ixqo9PeTE4HVslX7_FVwruEhFf-;", "MongoDBDatabase": "mongodb+srv://andrei_cerbu:andrei_cerbu@cluster0.v80skg6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0" }, - - "AllowedHosts": "*" + "AllowedHosts": "*", + "ApiKey": "testapikey" } diff --git a/backend/API/obj/API.csproj.nuget.dgspec.json b/backend/API/obj/API.csproj.nuget.dgspec.json index 2f3f389..7f350f9 100644 --- a/backend/API/obj/API.csproj.nuget.dgspec.json +++ b/backend/API/obj/API.csproj.nuget.dgspec.json @@ -98,7 +98,11 @@ "frameworks": { "net8.0": { "targetAlias": "net8.0", - "projectReferences": {} + "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": { @@ -114,6 +118,10 @@ "FluentValidation": { "target": "Package", "version": "[11.9.0, )" + }, + "MongoDB.Driver": { + "target": "Package", + "version": "[2.24.0, )" } }, "imports": [ @@ -250,6 +258,10 @@ "target": "Package", "version": "[8.0.3, )" }, + "Microsoft.EntityFrameworkCore.Relational": { + "target": "Package", + "version": "[8.0.3, )" + }, "Microsoft.Extensions.Configuration": { "target": "Package", "version": "[8.0.0, )" diff --git a/backend/API/obj/Debug/net8.0/API.AssemblyInfo.cs b/backend/API/obj/Debug/net8.0/API.AssemblyInfo.cs index 3b00620..3c6486a 100644 --- a/backend/API/obj/Debug/net8.0/API.AssemblyInfo.cs +++ b/backend/API/obj/Debug/net8.0/API.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("API")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1206db932183801caeaefeb110af24b0147366c1")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ccec617a59a712428e67340dc46bebefb152aca")] [assembly: System.Reflection.AssemblyProductAttribute("API")] [assembly: System.Reflection.AssemblyTitleAttribute("API")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/backend/API/obj/Debug/net8.0/API.AssemblyInfoInputs.cache b/backend/API/obj/Debug/net8.0/API.AssemblyInfoInputs.cache index 8278a66..66961bc 100644 --- a/backend/API/obj/Debug/net8.0/API.AssemblyInfoInputs.cache +++ b/backend/API/obj/Debug/net8.0/API.AssemblyInfoInputs.cache @@ -1 +1 @@ -0c139bdf077ad34598b9b50e71a3151cfc847b62ccfe6d358e4133a8470abb9c +abd09d11442616a05d74c5cf91eb2ab3a3f4e18f9d1feb34f7d619b58a9ee139 diff --git a/backend/API/obj/Debug/net8.0/API.assets.cache b/backend/API/obj/Debug/net8.0/API.assets.cache index da8cfb3..7b44c83 100644 Binary files a/backend/API/obj/Debug/net8.0/API.assets.cache and b/backend/API/obj/Debug/net8.0/API.assets.cache differ diff --git a/backend/API/obj/Debug/net8.0/API.csproj.AssemblyReference.cache b/backend/API/obj/Debug/net8.0/API.csproj.AssemblyReference.cache index e63ada2..a37112e 100644 Binary files a/backend/API/obj/Debug/net8.0/API.csproj.AssemblyReference.cache and b/backend/API/obj/Debug/net8.0/API.csproj.AssemblyReference.cache differ diff --git a/backend/API/obj/Debug/net8.0/API.csproj.CoreCompileInputs.cache b/backend/API/obj/Debug/net8.0/API.csproj.CoreCompileInputs.cache index c88abd5..f499b68 100644 --- a/backend/API/obj/Debug/net8.0/API.csproj.CoreCompileInputs.cache +++ b/backend/API/obj/Debug/net8.0/API.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -86f413f204b6bbdb2571f35c8208d17a18ef4d7252c53266660048227508f093 +3416e3272dd0e47374f982bfa273624c68a9149bad5e6bd93b7898d980bc8f46 diff --git a/backend/API/obj/Debug/net8.0/API.dll b/backend/API/obj/Debug/net8.0/API.dll index 83e8821..29e2afb 100644 Binary files a/backend/API/obj/Debug/net8.0/API.dll and b/backend/API/obj/Debug/net8.0/API.dll differ diff --git a/backend/API/obj/Debug/net8.0/API.pdb b/backend/API/obj/Debug/net8.0/API.pdb index 32578b1..19f9461 100644 Binary files a/backend/API/obj/Debug/net8.0/API.pdb and b/backend/API/obj/Debug/net8.0/API.pdb differ diff --git a/backend/API/obj/Debug/net8.0/API.sourcelink.json b/backend/API/obj/Debug/net8.0/API.sourcelink.json index 4f61ed8..e351cc3 100644 --- a/backend/API/obj/Debug/net8.0/API.sourcelink.json +++ b/backend/API/obj/Debug/net8.0/API.sourcelink.json @@ -1 +1 @@ -{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/1206db932183801caeaefeb110af24b0147366c1/*"}} \ No newline at end of file +{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/2ccec617a59a712428e67340dc46bebefb152aca/*"}} \ No newline at end of file diff --git a/backend/API/obj/Debug/net8.0/HealthcareManager.API.AssemblyInfo.cs b/backend/API/obj/Debug/net8.0/HealthcareManager.API.AssemblyInfo.cs new file mode 100644 index 0000000..7da4401 --- /dev/null +++ b/backend/API/obj/Debug/net8.0/HealthcareManager.API.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("HealthcareManager.API")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ccec617a59a712428e67340dc46bebefb152aca")] +[assembly: System.Reflection.AssemblyProductAttribute("HealthcareManager.API")] +[assembly: System.Reflection.AssemblyTitleAttribute("HealthcareManager.API")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/backend/API/obj/Debug/net8.0/HealthcareManager.API.AssemblyInfoInputs.cache b/backend/API/obj/Debug/net8.0/HealthcareManager.API.AssemblyInfoInputs.cache new file mode 100644 index 0000000..50aa792 --- /dev/null +++ b/backend/API/obj/Debug/net8.0/HealthcareManager.API.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +02a20cc73b88382df01707b6de9e61d10967067c54347b2bf3ccff89e4d0951c diff --git a/backend/API/obj/Debug/net8.0/HealthcareManager.API.GeneratedMSBuildEditorConfig.editorconfig b/backend/API/obj/Debug/net8.0/HealthcareManager.API.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..845fbea --- /dev/null +++ b/backend/API/obj/Debug/net8.0/HealthcareManager.API.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,19 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = true +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = API +build_property.RootNamespace = API +build_property.ProjectDir = C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\HealthcareManager.API\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.RazorLangVersion = 8.0 +build_property.SupportLocalizedComponentNames = +build_property.GenerateRazorMetadataSourceChecksumAttributes = +build_property.MSBuildProjectDirectory = C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\HealthcareManager.API +build_property._RazorSourceGeneratorDebug = diff --git a/backend/API/obj/Debug/net8.0/HealthcareManager.API.GlobalUsings.g.cs b/backend/API/obj/Debug/net8.0/HealthcareManager.API.GlobalUsings.g.cs new file mode 100644 index 0000000..025530a --- /dev/null +++ b/backend/API/obj/Debug/net8.0/HealthcareManager.API.GlobalUsings.g.cs @@ -0,0 +1,17 @@ +// +global using global::Microsoft.AspNetCore.Builder; +global using global::Microsoft.AspNetCore.Hosting; +global using global::Microsoft.AspNetCore.Http; +global using global::Microsoft.AspNetCore.Routing; +global using global::Microsoft.Extensions.Configuration; +global using global::Microsoft.Extensions.DependencyInjection; +global using global::Microsoft.Extensions.Hosting; +global using global::Microsoft.Extensions.Logging; +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Net.Http.Json; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/backend/API/obj/Debug/net8.0/HealthcareManager.API.assets.cache b/backend/API/obj/Debug/net8.0/HealthcareManager.API.assets.cache new file mode 100644 index 0000000..f561296 Binary files /dev/null and b/backend/API/obj/Debug/net8.0/HealthcareManager.API.assets.cache differ diff --git a/backend/API/obj/Debug/net8.0/HealthcareManager.API.csproj.AssemblyReference.cache b/backend/API/obj/Debug/net8.0/HealthcareManager.API.csproj.AssemblyReference.cache new file mode 100644 index 0000000..14bbb7a Binary files /dev/null and b/backend/API/obj/Debug/net8.0/HealthcareManager.API.csproj.AssemblyReference.cache differ diff --git a/backend/API/obj/Debug/net8.0/apphost.exe b/backend/API/obj/Debug/net8.0/apphost.exe index ea0d281..c2a09cc 100644 Binary files a/backend/API/obj/Debug/net8.0/apphost.exe and b/backend/API/obj/Debug/net8.0/apphost.exe differ diff --git a/backend/API/obj/Debug/net8.0/ref/API.dll b/backend/API/obj/Debug/net8.0/ref/API.dll index 53ddcea..b03f898 100644 Binary files a/backend/API/obj/Debug/net8.0/ref/API.dll and b/backend/API/obj/Debug/net8.0/ref/API.dll differ diff --git a/backend/API/obj/Debug/net8.0/refint/API.dll b/backend/API/obj/Debug/net8.0/refint/API.dll index 53ddcea..b03f898 100644 Binary files a/backend/API/obj/Debug/net8.0/refint/API.dll and b/backend/API/obj/Debug/net8.0/refint/API.dll differ diff --git a/backend/API/obj/HealthcareManager.API.csproj.nuget.dgspec.json b/backend/API/obj/HealthcareManager.API.csproj.nuget.dgspec.json new file mode 100644 index 0000000..0f4bed3 --- /dev/null +++ b/backend/API/obj/HealthcareManager.API.csproj.nuget.dgspec.json @@ -0,0 +1,307 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\HealthcareManager.API\\HealthcareManager.API.csproj": {} + }, + "projects": { + "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj": { + "version": "1.0.0", + "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", + "packagesPath": "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "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" + } + } + }, + "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj": { + "version": "1.0.0", + "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", + "packagesPath": "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "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" + } + } + }, + "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\HealthcareManager.API\\HealthcareManager.API.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\HealthcareManager.API\\HealthcareManager.API.csproj", + "projectName": "HealthcareManager.API", + "projectPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\HealthcareManager.API\\HealthcareManager.API.csproj", + "packagesPath": "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\HealthcareManager.API\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "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" + } + } + }, + "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj", + "projectName": "Infrastructure", + "projectPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj", + "packagesPath": "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "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\\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": { + "Microsoft.EntityFrameworkCore": { + "target": "Package", + "version": "[8.0.3, )" + }, + "Microsoft.EntityFrameworkCore.Design": { + "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive", + "suppressParent": "All", + "target": "Package", + "version": "[8.0.3, )" + }, + "Microsoft.EntityFrameworkCore.Relational": { + "target": "Package", + "version": "[8.0.3, )" + }, + "Microsoft.Extensions.Configuration": { + "target": "Package", + "version": "[8.0.0, )" + }, + "Microsoft.Extensions.Configuration.Json": { + "target": "Package", + "version": "[8.0.0, )" + }, + "Microsoft.Extensions.Options.ConfigurationExtensions": { + "target": "Package", + "version": "[8.0.0, )" + }, + "MongoDB.Driver": { + "target": "Package", + "version": "[2.24.0, )" + }, + "Npgsql.EntityFrameworkCore.PostgreSQL": { + "target": "Package", + "version": "[8.0.2, )" + } + }, + "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" + } + } + } + } +} \ No newline at end of file diff --git a/backend/API/obj/HealthcareManager.API.csproj.nuget.g.props b/backend/API/obj/HealthcareManager.API.csproj.nuget.g.props new file mode 100644 index 0000000..a3e3676 --- /dev/null +++ b/backend/API/obj/HealthcareManager.API.csproj.nuget.g.props @@ -0,0 +1,25 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Andrei Cerbu\.nuget\packages\ + PackageReference + 6.9.1 + + + + + + + + + + + C:\Users\Andrei Cerbu\.nuget\packages\microsoft.extensions.apidescription.server\6.0.5 + C:\Users\Andrei Cerbu\.nuget\packages\awssdk.core\3.7.100.14 + C:\Users\Andrei Cerbu\.nuget\packages\awssdk.securitytoken\3.7.100.14 + + \ No newline at end of file diff --git a/backend/API/obj/HealthcareManager.API.csproj.nuget.g.targets b/backend/API/obj/HealthcareManager.API.csproj.nuget.g.targets new file mode 100644 index 0000000..3bc36dc --- /dev/null +++ b/backend/API/obj/HealthcareManager.API.csproj.nuget.g.targets @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/backend/API/obj/project.assets.json b/backend/API/obj/project.assets.json index b8b248d..ba87dfb 100644 --- a/backend/API/obj/project.assets.json +++ b/backend/API/obj/project.assets.json @@ -104,10 +104,10 @@ "lib/netstandard2.0/_._": {} } }, - "Microsoft.EntityFrameworkCore.Relational/8.0.2": { + "Microsoft.EntityFrameworkCore.Relational/8.0.3": { "type": "package", "dependencies": { - "Microsoft.EntityFrameworkCore": "8.0.2", + "Microsoft.EntityFrameworkCore": "8.0.3", "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" }, "compile": { @@ -857,7 +857,9 @@ "type": "project", "framework": ".NETCoreApp,Version=v8.0", "dependencies": { - "FluentValidation": "11.9.0" + "Core": "1.0.0", + "FluentValidation": "11.9.0", + "MongoDB.Driver": "2.24.0" }, "compile": { "bin/placeholder/Application.dll": {} @@ -886,6 +888,7 @@ "Application": "1.0.0", "Core": "1.0.0", "Microsoft.EntityFrameworkCore": "8.0.3", + "Microsoft.EntityFrameworkCore.Relational": "8.0.3", "Microsoft.Extensions.Configuration": "8.0.0", "Microsoft.Extensions.Configuration.Json": "8.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0", @@ -1049,17 +1052,18 @@ "microsoft.entityframeworkcore.analyzers.nuspec" ] }, - "Microsoft.EntityFrameworkCore.Relational/8.0.2": { - "sha512": "NoGfcq2OPw0z8XAPf74YFwGlTKjedWdsIEJqq4SvKcPjcu+B+/XDDNrDRxTvILfz4Ug8POSF49s1jz1JvUqTAg==", + "Microsoft.EntityFrameworkCore.Relational/8.0.3": { + "sha512": "8JnVZHWaNFkrrD/FC0O4jekiHIYey8y6TQ4Co3OzLz0wd5Dm1cwJfTp++1TvaVu0BBd4bVDtiktppa5epuoPrA==", "type": "package", - "path": "microsoft.entityframeworkcore.relational/8.0.2", + "path": "microsoft.entityframeworkcore.relational/8.0.3", "files": [ ".nupkg.metadata", ".signature.p7s", "Icon.png", + "PACKAGE.md", "lib/net8.0/Microsoft.EntityFrameworkCore.Relational.dll", "lib/net8.0/Microsoft.EntityFrameworkCore.Relational.xml", - "microsoft.entityframeworkcore.relational.8.0.2.nupkg.sha512", + "microsoft.entityframeworkcore.relational.8.0.3.nupkg.sha512", "microsoft.entityframeworkcore.relational.nuspec" ] }, diff --git a/backend/API/obj/project.nuget.cache b/backend/API/obj/project.nuget.cache index 9f6c4b6..e3eeb12 100644 --- a/backend/API/obj/project.nuget.cache +++ b/backend/API/obj/project.nuget.cache @@ -1,6 +1,6 @@ { "version": 2, - "dgSpecHash": "Llti60b3JlFFmuYNc07w0zCtvVoC0dmeVpWVzdTRLLC9SU9eQLtNx+8lt8aENRzZ+d9tQS2redPHdW7VN9jOxQ==", + "dgSpecHash": "nH+v0/ZQ0hK0w3knyskezmqQzqvqCYUEVhsdP2suOMyzmw/bxzwSVgn9E+iUU+5wOUyeCGutEG5PTTU1y/XNwA==", "success": true, "projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj", "expectedPackageFiles": [ @@ -11,7 +11,7 @@ "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.analyzers\\8.0.3\\microsoft.entityframeworkcore.analyzers.8.0.3.nupkg.sha512", - "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.2\\microsoft.entityframeworkcore.relational.8.0.2.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.3\\microsoft.entityframeworkcore.relational.8.0.3.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.apidescription.server\\6.0.5\\microsoft.extensions.apidescription.server.6.0.5.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512", "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.0\\microsoft.extensions.caching.memory.8.0.0.nupkg.sha512", diff --git a/backend/API/obj/rider.project.model.nuget.info b/backend/API/obj/rider.project.model.nuget.info index 1280970..87e2209 100644 --- a/backend/API/obj/rider.project.model.nuget.info +++ b/backend/API/obj/rider.project.model.nuget.info @@ -1 +1 @@ -17122552827034613 \ No newline at end of file +17125194878710486 \ No newline at end of file diff --git a/backend/API/obj/rider.project.restore.info b/backend/API/obj/rider.project.restore.info index 1280970..d47398b 100644 --- a/backend/API/obj/rider.project.restore.info +++ b/backend/API/obj/rider.project.restore.info @@ -1 +1 @@ -17122552827034613 \ No newline at end of file +17125195144135930 \ No newline at end of file diff --git a/backend/Application/Application.csproj b/backend/Application/Application.csproj index 31564e9..bd3172a 100644 --- a/backend/Application/Application.csproj +++ b/backend/Application/Application.csproj @@ -1,17 +1,18 @@  - - net8.0 - enable - enable - + + net8.0 + enable + enable + - - - + + + + - - - + + + diff --git a/backend/Application/Endpoints/BaseResponse.cs b/backend/Application/Endpoints/BaseResponse.cs index 3af49b2..0fc9763 100644 --- a/backend/Application/Endpoints/BaseResponse.cs +++ b/backend/Application/Endpoints/BaseResponse.cs @@ -2,7 +2,7 @@ public class BaseResponse { - public bool Success { get; set; } + public int StatusCode { get; set; } public string? Message { get; set; } public object? Data { get; set; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Login/DoctorLoginDto.cs b/backend/Application/Endpoints/Doctors/Login/DoctorLoginDto.cs index c3bdb6b..49f3f8c 100644 --- a/backend/Application/Endpoints/Doctors/Login/DoctorLoginDto.cs +++ b/backend/Application/Endpoints/Doctors/Login/DoctorLoginDto.cs @@ -1,7 +1,7 @@ namespace Application.Endpoints.Doctors.Login; -public class DoctorLoginDTO +public class DoctorLoginDto { public string? Email { get; set; } public string? Password { get; set; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Login/DoctorLoginHandler.cs b/backend/Application/Endpoints/Doctors/Login/DoctorLoginHandler.cs index fa3ad37..8fa87ec 100644 --- a/backend/Application/Endpoints/Doctors/Login/DoctorLoginHandler.cs +++ b/backend/Application/Endpoints/Doctors/Login/DoctorLoginHandler.cs @@ -1,37 +1,42 @@ using Application.Services.Database; +using Application.Services.HashingAlgorithms; namespace Application.Endpoints.Doctors.Login; public class DoctorLoginHandler { private readonly IDoctorRepository _database; + private readonly IHashingAlgorithms _hashingAlgorithms; - public DoctorLoginHandler(IDoctorRepository database) + public DoctorLoginHandler(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms) { _database = database; + _hashingAlgorithms = hashingAlgorithms; } - public async Task Handle(DoctorLoginDTO loginDTO) + public async Task Handle(DoctorLoginDto loginDTO) { + loginDTO.Password = _hashingAlgorithms.SHA256Algorithm(loginDTO.Password); + var validation = new DoctorLoginValidation(_database); var validationResult = await validation.ValidateAsync(loginDTO); - if (!validationResult.IsValid) - { - var errorMessage = validationResult.Errors.FirstOrDefault()?.ErrorMessage; + if (validationResult.IsValid) return new BaseResponse { - Success = false, - Message = errorMessage, + StatusCode = HttpStatusCodes.OK, + Message = "Authentication successful", Data = null }; - } + var firstError = validationResult.Errors.FirstOrDefault(); + var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1; + var errorMessage = firstError.ErrorMessage; return new BaseResponse { - Success = true, - Message = "Authentication successful", + StatusCode = errorCode, + Message = errorMessage, Data = null }; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Login/DoctorLoginValidation.cs b/backend/Application/Endpoints/Doctors/Login/DoctorLoginValidation.cs index 592eb30..b7abda5 100644 --- a/backend/Application/Endpoints/Doctors/Login/DoctorLoginValidation.cs +++ b/backend/Application/Endpoints/Doctors/Login/DoctorLoginValidation.cs @@ -3,7 +3,7 @@ using FluentValidation; namespace Application.Endpoints.Doctors.Login; -public class DoctorLoginValidation : AbstractValidator +public class DoctorLoginValidation : AbstractValidator { private readonly IDoctorRepository _doctorRepository; @@ -12,13 +12,16 @@ public class DoctorLoginValidation : AbstractValidator _doctorRepository = doctorRepository; RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeExistingDoctor).WithMessage("Doctor with this email does not exist."); + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeExistingDoctor).WithMessage("Doctor with this email does not exist.") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long."); + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync((dto, password, cancellationToken) => CredentialsMatch(dto.Email, password, cancellationToken)) + .WithMessage("Incorrect email or password.") + .WithErrorCode(HttpStatusCodes.Unauthorized.ToString()); } private async Task BeExistingDoctor(string email, CancellationToken cancellationToken) @@ -26,4 +29,10 @@ public class DoctorLoginValidation : AbstractValidator var doctor = await _doctorRepository.FindByEmailAsync(email); return doctor != null; } -} + + private async Task CredentialsMatch(string email, string password, CancellationToken cancellationToken) + { + var code = await _doctorRepository.CredentialsMatch(email, password); + return code; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Profile/DoctorProfileHandler.cs b/backend/Application/Endpoints/Doctors/Profile/DoctorProfileHandler.cs index 957b04a..8799afb 100644 --- a/backend/Application/Endpoints/Doctors/Profile/DoctorProfileHandler.cs +++ b/backend/Application/Endpoints/Doctors/Profile/DoctorProfileHandler.cs @@ -1,32 +1,33 @@ using Application.Services.Database; +using Application.Services.HashingAlgorithms; namespace Application.Endpoints.Doctors.Profile; public class DoctorProfileHandler { - private readonly IDoctorRepository _doctorRepository; + private readonly IDoctorRepository _database; + private readonly IHashingAlgorithms _hashingAlgorithms; - public DoctorProfileHandler(IDoctorRepository doctorRepository) + public DoctorProfileHandler(IDoctorRepository database, IHashingAlgorithms hashingAlgorithms) { - _doctorRepository = doctorRepository; + _database = database; + _hashingAlgorithms = hashingAlgorithms; } public async Task HandleGet(Guid id) { - var doctor = await _doctorRepository.GetByIdAsync(id).ConfigureAwait(false); + var doctor = await _database.GetByIdAsync(id).ConfigureAwait(false); if (doctor != null) - { return new BaseResponse { - Success = true, + StatusCode = HttpStatusCodes.OK, Message = $"Retrieved doctor with id: {id}", Data = doctor }; - } return new BaseResponse { - Success = false, + StatusCode = HttpStatusCodes.NotFound, Message = $"Doctor with id: {id} not found", Data = null }; @@ -34,88 +35,76 @@ public class DoctorProfileHandler public async Task HandleGetAll() { - var doctors = await _doctorRepository.GetAllAsync().ConfigureAwait(false); + var doctors = await _database.GetAllAsync().ConfigureAwait(false); if (doctors.Any()) - { return new BaseResponse { - Success = true, + StatusCode = HttpStatusCodes.OK, Message = "Retrieved doctors", Data = doctors.ToList() }; - } return new BaseResponse { - Success = false, + StatusCode = HttpStatusCodes.NotFound, Message = "Doctors not found", Data = null }; } - public async Task HandleUpdate(Guid id, DoctorProfileDTO updateDto) + public async Task HandleUpdate(DoctorProfileUpdateDto doctorProfileUpdateDto) { - var validation = new DoctorProfileValidation(_doctorRepository); - var validationResult = await validation.ValidateAsync(updateDto); + var validation = new DoctorProfileValidation(_database); + var validationResult = await validation.ValidateAsync(doctorProfileUpdateDto); if (!validationResult.IsValid) { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); + var firstError = validationResult.Errors.FirstOrDefault(); + var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1; + var errorMessage = firstError.ErrorMessage; + return new BaseResponse { - Success = false, - Message = string.Join(", ", errorMessage), + StatusCode = errorCode, + Message = errorMessage, Data = null }; } - var doctorToUpdate = await _doctorRepository.GetByIdAsync(id); + var doctorToUpdate = await _database.GetByIdAsync(doctorProfileUpdateDto.Id); + doctorToUpdate.SetEmail(doctorProfileUpdateDto.Email); + doctorToUpdate.SetPassword(_hashingAlgorithms.SHA256Algorithm(doctorProfileUpdateDto.Password)); + doctorToUpdate.SetName(doctorProfileUpdateDto.Name); + doctorToUpdate.SetDescription(doctorProfileUpdateDto.Description); - if (doctorToUpdate == null) - { - return new BaseResponse - { - Success = false, - Message = "Doctor not found for given Id", - Data = null - }; - } - - doctorToUpdate.Email = updateDto.Email; - doctorToUpdate.Password = updateDto.Password; - doctorToUpdate.Name = updateDto.Name; - doctorToUpdate.Description = updateDto.Description; - - await _doctorRepository.UpdateAsync(doctorToUpdate); + await _database.UpdateAsync(doctorToUpdate); return new BaseResponse { - Success = true, - Message = "Doctor updated successfully", - Data = doctorToUpdate + StatusCode = HttpStatusCodes.NoContent, + Message = null, + Data = null }; } public async Task HandleDelete(Guid id) { - var doctorToDelete = await _doctorRepository.GetByIdAsync(id); + var doctorToDelete = await _database.GetByIdAsync(id); if (doctorToDelete == null) - { return new BaseResponse { - Success = false, - Message = $"Doctor with id: {id} does not exist", + StatusCode = HttpStatusCodes.NotFound, + Message = "Doctor was not found.", Data = null }; - } - await _doctorRepository.DeleteAsync(doctorToDelete); + await _database.DeleteAsync(doctorToDelete); return new BaseResponse { - Success = true, - Message = $"Doctor with id: {id} was succesfully deleted", - Data = doctorToDelete + StatusCode = HttpStatusCodes.NoContent, + Message = null, + Data = null }; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Profile/DoctorProfileDto.cs b/backend/Application/Endpoints/Doctors/Profile/DoctorProfileUpdateDto.cs similarity index 75% rename from backend/Application/Endpoints/Doctors/Profile/DoctorProfileDto.cs rename to backend/Application/Endpoints/Doctors/Profile/DoctorProfileUpdateDto.cs index 0127ca2..cd5d2ba 100644 --- a/backend/Application/Endpoints/Doctors/Profile/DoctorProfileDto.cs +++ b/backend/Application/Endpoints/Doctors/Profile/DoctorProfileUpdateDto.cs @@ -1,9 +1,10 @@ namespace Application.Endpoints.Doctors.Profile; -public class DoctorProfileDTO +public class DoctorProfileUpdateDto { + public Guid Id { get; set; } public string Name { get; set; } public string Email { get; set; } public string Password { get; set; } public string Description { get; set; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Profile/DoctorProfileValidation.cs b/backend/Application/Endpoints/Doctors/Profile/DoctorProfileValidation.cs index 879b3fd..f9c4fd6 100644 --- a/backend/Application/Endpoints/Doctors/Profile/DoctorProfileValidation.cs +++ b/backend/Application/Endpoints/Doctors/Profile/DoctorProfileValidation.cs @@ -3,7 +3,7 @@ using FluentValidation; namespace Application.Endpoints.Doctors.Profile; -public class DoctorProfileValidation : AbstractValidator +public class DoctorProfileValidation : AbstractValidator { private readonly IDoctorRepository _doctorRepository; @@ -11,30 +11,41 @@ public class DoctorProfileValidation : AbstractValidator { _doctorRepository = doctorRepository; + RuleFor(x => x.Id) + .NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(IsDoctorRegistered).WithMessage("Doctor is registered in system") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); + RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeUniqueEmail).WithMessage("Email in use by another doctor."); + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeUniqueEmail).WithMessage("Email in use by another doctor.") + .WithErrorCode(HttpStatusCodes.Conflict.ToString()); RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long."); + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(8).WithMessage("Password must be at least 8 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); RuleFor(x => x.Name) - .NotEmpty().WithMessage("Name is required.") - .MinimumLength(3).WithMessage("Name must be at least 3 characters long."); + .NotEmpty().WithMessage("Name is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(3).WithMessage("Name must be at least 3 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); RuleFor(x => x.Description) - .MaximumLength(3000).WithMessage("Description must not exceed 3000 characters."); + .MaximumLength(3000).WithMessage("Description must not exceed 3000 characters.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + } + + private async Task IsDoctorRegistered(Guid id, CancellationToken cancellationToken) + { + var doctor = await _doctorRepository.GetByIdAsync(id); + return doctor == null; } private async Task BeUniqueEmail(string email, CancellationToken cancellationToken) { var doctor = await _doctorRepository.FindByEmailAsync(email); - if (doctor != null) - { - return doctor.Email.Equals(email, StringComparison.OrdinalIgnoreCase); - } return doctor == null; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationDto.cs b/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationDto.cs index e24f2b4..6a4d75f 100644 --- a/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationDto.cs +++ b/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationDto.cs @@ -1,9 +1,9 @@ -namespace Application.Endpoints.Doctors.Login; +namespace Application.Endpoints.Doctors.Registration; public class DoctorRegistrationDto { - public string Name { get; set; } - public string Email { get; set; } - public string Password { get; set; } - public string Description { get; set; } -} + public string? Name { get; set; } + public string? Email { get; set; } + public string? Password { get; set; } + public string? Description { get; set; } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationHandler.cs b/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationHandler.cs index 7768af3..270a96f 100644 --- a/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationHandler.cs +++ b/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationHandler.cs @@ -1,5 +1,5 @@ -using Application.Endpoints.Doctors.Login; -using Application.Services.Database; +using Application.Services.Database; +using Application.Services.HashingAlgorithms; using Core.Entities; namespace Application.Endpoints.Doctors.Registration; @@ -7,10 +7,12 @@ namespace Application.Endpoints.Doctors.Registration; public class DoctorRegistrationHandler { private readonly IDoctorRepository _doctorRepository; + private readonly IHashingAlgorithms _hashingAlgorithms; - public DoctorRegistrationHandler(IDoctorRepository doctorRepository) + public DoctorRegistrationHandler(IDoctorRepository doctorRepository, IHashingAlgorithms hashingAlgorithms) { _doctorRepository = doctorRepository; + _hashingAlgorithms = hashingAlgorithms; } public async Task Handle(DoctorRegistrationDto registrationDTO) @@ -20,30 +22,31 @@ public class DoctorRegistrationHandler if (!validationResult.IsValid) { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); + var firstError = validationResult.Errors.FirstOrDefault(); + var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1; + var errorMessage = firstError.ErrorMessage; + return new BaseResponse { - Success = false, - Message = string.Join(", ", errorMessage), + StatusCode = errorCode, + Message = errorMessage, Data = null }; } - var doctor = new Doctor - { - Email = registrationDTO.Email, - Password = registrationDTO.Password, - Name = registrationDTO.Name, - Description = registrationDTO.Description - }; + var doctor = new Doctor(); + doctor.SetEmail(registrationDTO.Email); + doctor.SetPassword(_hashingAlgorithms.SHA256Algorithm(registrationDTO.Password)); + doctor.SetName(registrationDTO.Name); + doctor.SetDescription(registrationDTO.Description); await _doctorRepository.AddAsync(doctor); return new BaseResponse { - Success = true, + StatusCode = HttpStatusCodes.Created, Message = "Doctor registered successfully", - Data = doctor // Be careful with sending sensitive data like Passwords + Data = null }; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationValidation.cs b/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationValidation.cs index 1bc3b43..e753296 100644 --- a/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationValidation.cs +++ b/backend/Application/Endpoints/Doctors/Registration/DoctorRegistrationValidation.cs @@ -1,5 +1,4 @@ -using Application.Endpoints.Doctors.Login; -using Application.Services.Database; +using Application.Services.Database; using FluentValidation; namespace Application.Endpoints.Doctors.Registration; @@ -13,20 +12,24 @@ public class DoctorRegistrationValidation : AbstractValidator x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeUniqueEmail).WithMessage("Email already exists."); + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeUniqueEmail).WithMessage("Email already exists.") + .WithErrorCode(HttpStatusCodes.Conflict.ToString()); RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long."); + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(8).WithMessage("Password must be at least 8 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); RuleFor(x => x.Name) - .NotEmpty().WithMessage("Name is required.") - .MinimumLength(3).WithMessage("Name must be at least 3 characters long."); + .NotEmpty().WithMessage("Name is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(3).WithMessage("Name must be at least 3 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); RuleFor(x => x.Description) - .MaximumLength(3000).WithMessage("Description must not exceed 3000 characters."); + .MaximumLength(3000).WithMessage("Description must not exceed 3000 characters.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); } private async Task BeUniqueEmail(string email, CancellationToken cancellationToken) @@ -34,4 +37,4 @@ public class DoctorRegistrationValidation : AbstractValidator Handle(DoctorLoginDTO resetDoctorDto) + public async Task Handle(DoctorResetPasswordDto resetDoctorDto) { var validation = new DoctorResetPasswordValidation(_doctorRepository); var validationResult = await validation.ValidateAsync(resetDoctorDto); if (!validationResult.IsValid) { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); + var firstError = validationResult.Errors.FirstOrDefault(); + var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1; + var errorMessage = firstError.ErrorMessage; + return new BaseResponse { - Success = false, - Message = string.Join(", ", errorMessage), + StatusCode = errorCode, + Message = errorMessage, Data = null }; } var currentDoctor = await _doctorRepository.FindByEmailAsync(resetDoctorDto.Email); - var updatedDoctor = currentDoctor; - - updatedDoctor.Password = resetDoctorDto.Password; + updatedDoctor.SetPassword(_hashingAlgorithms.SHA256Algorithm(resetDoctorDto.Password)); await _doctorRepository.UpdateAsync(updatedDoctor); - updatedDoctor = await _doctorRepository.GetByIdAsync(currentDoctor.Id); - - if (updatedDoctor.Password != resetDoctorDto.Password) - { - return new BaseResponse - { - Success = false, - Message = $"Failed to update passwor for doctor {updatedDoctor.Name}", - Data = null - }; - } - return new BaseResponse { - Success = true, - Message = $"Password of doctor {updatedDoctor.Name} has been reset succesfully", - Data = updatedDoctor.Email + StatusCode = HttpStatusCodes.OK, + Message = "Password successfully changed!", + Data = null }; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Doctors/ResetPassword/DoctorResetPasswordValidation.cs b/backend/Application/Endpoints/Doctors/ResetPassword/DoctorResetPasswordValidation.cs index 8398eb1..c1b9f90 100644 --- a/backend/Application/Endpoints/Doctors/ResetPassword/DoctorResetPasswordValidation.cs +++ b/backend/Application/Endpoints/Doctors/ResetPassword/DoctorResetPasswordValidation.cs @@ -1,9 +1,9 @@ using Application.Services.Database; using FluentValidation; -namespace Application.Endpoints.Doctors.Login; +namespace Application.Endpoints.Doctors.ResetPassword; -public class DoctorResetPasswordValidation : AbstractValidator +public class DoctorResetPasswordValidation : AbstractValidator { private readonly IDoctorRepository _doctorRepository; @@ -12,15 +12,19 @@ public class DoctorResetPasswordValidation : AbstractValidator _doctorRepository = doctorRepository; RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeExistingDoctor).WithMessage("Doctor with this email does not exist."); + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeExistingDoctor).WithMessage("Doctor with this email does not exist.") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) .MinimumLength(8).WithMessage("Password must be at least 8 characters long.") - .MustAsync((dto, password, context, cancellationToken) => BeDifferentFromOldPassword(dto.Email, password, cancellationToken)) - .WithMessage("New password cannot be the same as old password."); + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync((dto, password, context, cancellationToken) => + BeDifferentFromOldPassword(dto.Email, password, cancellationToken)) + .WithMessage("New password cannot be the same as old password.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); } private async Task BeExistingDoctor(string email, CancellationToken cancellationToken) @@ -29,9 +33,10 @@ public class DoctorResetPasswordValidation : AbstractValidator return doctor != null; } - private async Task BeDifferentFromOldPassword(string email, string newPassword, CancellationToken cancellationToken) + private async Task BeDifferentFromOldPassword(string email, string newPassword, + CancellationToken cancellationToken) { var currentDoctor = await _doctorRepository.FindByEmailAsync(email); return !newPassword.Equals(currentDoctor?.Password, StringComparison.Ordinal); } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/HttpStatusCodes.cs b/backend/Application/Endpoints/HttpStatusCodes.cs new file mode 100644 index 0000000..80fa93b --- /dev/null +++ b/backend/Application/Endpoints/HttpStatusCodes.cs @@ -0,0 +1,16 @@ +namespace Application.Endpoints; + +public static class HttpStatusCodes +{ + public const int OK = 200; + public const int Created = 201; + public const int NoContent = 204; + public const int BadRequest = 400; + public const int Unauthorized = 401; + public const int Forbidden = 403; + public const int NotFound = 404; + public const int Conflict = 409; + + public const int InternalServerError = 500; + // Add more status codes as needed +} \ No newline at end of file diff --git a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryDto.cs b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateDto.cs similarity index 52% rename from backend/Application/Endpoints/MedicalHistories/MedicalHistoryDto.cs rename to backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateDto.cs index 86c5ab2..f03907e 100644 --- a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryDto.cs +++ b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateDto.cs @@ -1,7 +1,7 @@ namespace Application.Endpoints.MedicalHistories; -public class MedicalHistoryDTO +public class MedicalHistoryCreateDto { public Guid UserId { get; set; } - public byte[] Description { get; set; } = []; -} + public byte[] Content { get; set; } = []; +} \ No newline at end of file diff --git a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateValidation.cs b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateValidation.cs index ff0f5a3..7179d5c 100644 --- a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateValidation.cs +++ b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryCreateValidation.cs @@ -3,25 +3,26 @@ using FluentValidation; namespace Application.Endpoints.MedicalHistories; -public class MedicalHistoryCreateValidation : AbstractValidator +public class MedicalHistoryCreateValidation : AbstractValidator { - private readonly IPacientRepository _pacientRepository; + private readonly IPatientRepository _patientRepository; - public MedicalHistoryCreateValidation(IPacientRepository pacientRepository) + public MedicalHistoryCreateValidation(IPatientRepository patientRepository) { - _pacientRepository = pacientRepository; + _patientRepository = patientRepository; RuleFor(x => x.UserId) - .NotEmpty().WithMessage("Pacient is required.") - .MustAsync(BeExistingUser).WithMessage("Specified pacient id doesn't exist."); + .NotEmpty().WithMessage("Patient is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeExistingUser).WithMessage("Specified patient doesn't exist.") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); - RuleFor(x => x.Description) - .NotEmpty().WithMessage("Description is required."); + RuleFor(x => x.Content) + .NotEmpty().WithMessage("Description is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()); } private async Task BeExistingUser(Guid userId, CancellationToken cancellationToken) { - var pacient = await _pacientRepository.GetByIdAsync(userId); - return pacient != null; + var patient = await _patientRepository.GetByIdAsync(userId); + return patient != null; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryHandler.cs b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryHandler.cs index fb665e9..b20070d 100644 --- a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryHandler.cs +++ b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryHandler.cs @@ -6,104 +6,142 @@ namespace Application.Endpoints.MedicalHistories; public class MedicalHistoryHandler { private readonly IMedicalHistoryRepository _medicalHistoryRepository; - private readonly IPacientRepository _pacientRepository; + private readonly IMongoDbService _mongoDbService; + private readonly IPatientRepository _patientRepository; - public MedicalHistoryHandler(IMedicalHistoryRepository medicalHistoryRepository, IPacientRepository pacientRepository) + public MedicalHistoryHandler(IMedicalHistoryRepository medicalHistoryRepository, + IPatientRepository patientRepository, IMongoDbService mongoDbService) { _medicalHistoryRepository = medicalHistoryRepository; - _pacientRepository = pacientRepository; + _patientRepository = patientRepository; + _mongoDbService = mongoDbService; } - public async Task HandleGet(Guid id) + + public async Task HandleGetAll() { - var medicalHistory = await _medicalHistoryRepository.GetByIdAsync(id).ConfigureAwait(false); - if (medicalHistory != null) - { + var documents = await _medicalHistoryRepository.GetAllAsync().ConfigureAwait(false); + if (documents.Any()) return new BaseResponse { - Success = true, - Message = $"Retrieved Medical History with id: {id}", - Data = medicalHistory + StatusCode = HttpStatusCodes.OK, + Message = "Retrieved medical histories", + Data = documents.ToList() }; - } return new BaseResponse { - Success = false, - Message = $"Medical History with id: {id} not found", + StatusCode = HttpStatusCodes.NotFound, + Message = "Medical histories not found", Data = null }; } - public async Task HandleCreate(Guid userId, byte[] description) + public async Task HandleGet(Guid id) { - var validation = new MedicalHistoryCreateValidation(_pacientRepository); - var validationResult = await validation.ValidateAsync(new MedicalHistoryDTO { UserId = userId, Description = description}); + 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 HandleCreate(MedicalHistoryCreateDto medicalHistoryCreateDto) + { + var validation = new MedicalHistoryCreateValidation(_patientRepository); + var validationResult = await validation.ValidateAsync(medicalHistoryCreateDto); if (!validationResult.IsValid) { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); + var firstError = validationResult.Errors.FirstOrDefault(); + var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1; + var errorMessage = firstError.ErrorMessage; + return new BaseResponse { - Success = false, - Message = string.Join(", ", errorMessage), + StatusCode = errorCode, + Message = errorMessage, Data = null }; } var medicalHistory = new MedicalHistory { - UserId = userId, - Description = description + UserId = medicalHistoryCreateDto.UserId, + Content = medicalHistoryCreateDto.Content }; await _medicalHistoryRepository.AddAsync(medicalHistory); + //TODO add to MongoDB + return new BaseResponse { - Success = true, + StatusCode = HttpStatusCodes.Created, Message = "Medical history record registered successfully", Data = medicalHistory }; } - public async Task HandleUpdate(Guid id, MedicalHistoryDTO updateDto) + public async Task HandleUpdate(MedicalHistoryUpdateDto updateDto) { - var validation = new MedicalHistoryUpdateValidation(_medicalHistoryRepository, _pacientRepository); - var validationResult = await validation.ValidateAsync(new MedicalHistoryUpdateDTO { Id = id, UserId = updateDto.UserId, Description = updateDto.Description}); + var validation = new MedicalHistoryUpdateValidation(_medicalHistoryRepository, _patientRepository); + var validationResult = await validation.ValidateAsync(updateDto); if (!validationResult.IsValid) { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); + var firstError = validationResult.Errors.FirstOrDefault(); + var errorCode = int.TryParse(firstError.ErrorCode, out var code) ? code : -1; + var errorMessage = firstError.ErrorMessage; + return new BaseResponse { - Success = false, - Message = string.Join(", ", errorMessage), + StatusCode = errorCode, + Message = errorMessage, Data = null }; } - var medicalHistoryToUpdate = await _medicalHistoryRepository.GetByIdAsync(id); - - if (medicalHistoryToUpdate == null) - { - return new BaseResponse - { - Success = false, - Message = "Medical history not found for given Id", - Data = null - }; - } - - medicalHistoryToUpdate.UserId = updateDto.UserId; - medicalHistoryToUpdate.Description = updateDto.Description; + var medicalHistoryToUpdate = await _medicalHistoryRepository.GetByIdAsync(updateDto.Id); + medicalHistoryToUpdate.Content = updateDto.Content; await _medicalHistoryRepository.UpdateAsync(medicalHistoryToUpdate); - return new BaseResponse { - Success = true, - Message = "Pacient updated successfully", - Data = medicalHistoryToUpdate + StatusCode = HttpStatusCodes.NoContent, + Message = "Medical record updated successfully", + Data = null }; } -} + + public async Task 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 _medicalHistoryRepository.DeleteAsync(medicalRecord); + + //TODO delete from MongoDB + return new BaseResponse + { + StatusCode = HttpStatusCodes.NoContent, + Message = null, + Data = null + }; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateDto.cs b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateDto.cs index aaee541..23ad095 100644 --- a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateDto.cs +++ b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateDto.cs @@ -1,8 +1,7 @@ namespace Application.Endpoints.MedicalHistories; -public class MedicalHistoryUpdateDTO +public class MedicalHistoryUpdateDto { public Guid Id { get; set; } - public Guid UserId { get; set; } - public byte[] Description { get; set; } = []; -} + public byte[] Content { get; set; } = []; +} \ No newline at end of file diff --git a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateValidation.cs b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateValidation.cs index d02fe41..b9993c9 100644 --- a/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateValidation.cs +++ b/backend/Application/Endpoints/MedicalHistories/MedicalHistoryUpdateValidation.cs @@ -3,25 +3,22 @@ using FluentValidation; namespace Application.Endpoints.MedicalHistories; -public class MedicalHistoryUpdateValidation : AbstractValidator +public class MedicalHistoryUpdateValidation : AbstractValidator { private readonly IMedicalHistoryRepository _medicalHistoryRepository; - private readonly IPacientRepository _pacientRepository; + private readonly IPatientRepository _patientRepository; - public MedicalHistoryUpdateValidation(IMedicalHistoryRepository medicalHistoryRepository, IPacientRepository pacientRepository) + public MedicalHistoryUpdateValidation(IMedicalHistoryRepository medicalHistoryRepository, + IPatientRepository patientRepository) { _medicalHistoryRepository = medicalHistoryRepository; - _pacientRepository = pacientRepository; + _patientRepository = patientRepository; RuleFor(x => x.Id) .NotEmpty().WithMessage("Id is required") - .MustAsync(BeExistingMedicalHistoryRecord).WithMessage("Medical hostory record does not exist"); + .MustAsync(BeExistingMedicalHistoryRecord).WithMessage("Medical history record does not exist"); - RuleFor(x => x.UserId) - .NotEmpty().WithMessage("Pacient is required.") - .MustAsync(BeExistingUser).WithMessage("Specified pacient id doesn't exist."); - - RuleFor(x => x.Description) + RuleFor(x => x.Content) .NotEmpty().WithMessage("Description is required."); } @@ -30,10 +27,4 @@ public class MedicalHistoryUpdateValidation : AbstractValidator BeExistingUser(Guid userId, CancellationToken cancellationToken) - { - var pacient = await _pacientRepository.GetByIdAsync(userId); - return pacient != null; - } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Pacients/Login/PacientLoginHandler.cs b/backend/Application/Endpoints/Pacients/Login/PacientLoginHandler.cs deleted file mode 100644 index 9d5f98d..0000000 --- a/backend/Application/Endpoints/Pacients/Login/PacientLoginHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Application.Services.Database; - -namespace Application.Endpoints.Pacients.Login; - -public class PacientLoginHandler -{ - private readonly IPacientRepository _database; - - public PacientLoginHandler(IPacientRepository database) - { - _database = database; - } - - public async Task Handle(PacientLoginDTO loginDTO) - { - var validation = new PacientLoginValidation(_database); - var validationResult = await validation.ValidateAsync(loginDTO); - - if (!validationResult.IsValid) - { - var errorMessage = validationResult.Errors.FirstOrDefault()?.ErrorMessage; - return new BaseResponse - { - Success = false, - Message = errorMessage, - Data = null - }; - } - - return new BaseResponse - { - Success = true, - Message = "Authentication successful", - Data = null - }; - } -} diff --git a/backend/Application/Endpoints/Pacients/Login/PacientLoginValidation.cs b/backend/Application/Endpoints/Pacients/Login/PacientLoginValidation.cs deleted file mode 100644 index 960a0e5..0000000 --- a/backend/Application/Endpoints/Pacients/Login/PacientLoginValidation.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Application.Services.Database; -using FluentValidation; - -namespace Application.Endpoints.Pacients.Login; - -public class PacientLoginValidation : AbstractValidator -{ - private readonly IPacientRepository _pacientRepository; - - public PacientLoginValidation(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - - RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeExistingPacient).WithMessage("Pacient with this email does not exist."); - - RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long."); - } - - private async Task BeExistingPacient(string email, CancellationToken cancellationToken) - { - var pacient = await _pacientRepository.FindByEmailAsync(email); - return pacient != null; - } -} diff --git a/backend/Application/Endpoints/Pacients/Profile/PacientProfileDto.cs b/backend/Application/Endpoints/Pacients/Profile/PacientProfileDto.cs deleted file mode 100644 index 6a7f877..0000000 --- a/backend/Application/Endpoints/Pacients/Profile/PacientProfileDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Application.Endpoints.Pacients.Profile; - -public class PacientProfileDTO -{ - public string Name { get; set; } - public string Email { get; set; } - public string Password { get; set; } - public string Description { get; set; } -} diff --git a/backend/Application/Endpoints/Pacients/Profile/PacientProfileHandler.cs b/backend/Application/Endpoints/Pacients/Profile/PacientProfileHandler.cs deleted file mode 100644 index 415d8aa..0000000 --- a/backend/Application/Endpoints/Pacients/Profile/PacientProfileHandler.cs +++ /dev/null @@ -1,120 +0,0 @@ -using Application.Services.Database; - -namespace Application.Endpoints.Pacients.Profile; - -public class PacientProfileHandler -{ - private readonly IPacientRepository _pacientRepository; - - public PacientProfileHandler(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - } - - public async Task HandleGet(Guid id) - { - var pacient = await _pacientRepository.GetByIdAsync(id).ConfigureAwait(false); - if (pacient != null) - { - return new BaseResponse - { - Success = true, - Message = $"Retrieved pacient with id: {id}", - Data = pacient - }; - } - - return new BaseResponse - { - Success = false, - Message = $"Pacient with id: {id} not found", - Data = null - }; - } - - public async Task HandleGetAll() - { - var pacients = await _pacientRepository.GetAllAsync().ConfigureAwait(false); - if (pacients.Any()) - { - return new BaseResponse - { - Success = true, - Message = "Retrieved pacients", - Data = pacients.ToList() - }; - } - - return new BaseResponse - { - Success = false, - Message = "Pacients not found", - Data = null - }; - } - - public async Task HandleUpdate(Guid id, PacientProfileDTO updateDto) - { - var validation = new PacientProfileValidation(_pacientRepository); - var validationResult = await validation.ValidateAsync(updateDto); - - if (!validationResult.IsValid) - { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); - return new BaseResponse - { - Success = false, - Message = string.Join(", ", errorMessage), - Data = null - }; - } - - var pacientToUpdate = await _pacientRepository.GetByIdAsync(id); - - if (pacientToUpdate == null) - { - return new BaseResponse - { - Success = false, - Message = "Pacient not found for given Id", - Data = null - }; - } - - pacientToUpdate.Email = updateDto.Email; - pacientToUpdate.Password = updateDto.Password; - pacientToUpdate.Name = updateDto.Name; - - await _pacientRepository.UpdateAsync(pacientToUpdate); - - return new BaseResponse - { - Success = true, - Message = "Pacient updated successfully", - Data = pacientToUpdate - }; - } - - public async Task HandleDelete(Guid id) - { - var pacientToDelete = await _pacientRepository.GetByIdAsync(id); - if (pacientToDelete == null) - { - return new BaseResponse - { - Success = false, - Message = $"Pacient with id: {id} does not exist", - Data = null - }; - } - - await _pacientRepository.DeleteAsync(pacientToDelete); - - return new BaseResponse - { - Success = true, - Message = $"Pacient with id: {id} was succesfully deleted", - Data = pacientToDelete - }; - } -} diff --git a/backend/Application/Endpoints/Pacients/Profile/PacientProfileValidation.cs b/backend/Application/Endpoints/Pacients/Profile/PacientProfileValidation.cs deleted file mode 100644 index 43c2209..0000000 --- a/backend/Application/Endpoints/Pacients/Profile/PacientProfileValidation.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Application.Services.Database; -using FluentValidation; - -namespace Application.Endpoints.Pacients.Profile; - -public class PacientProfileValidation : AbstractValidator -{ - private readonly IPacientRepository _pacientRepository; - - public PacientProfileValidation(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - - RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeUniqueEmail).WithMessage("Email in use by another pacient."); - - RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long."); - - RuleFor(x => x.Name) - .NotEmpty().WithMessage("Name is required.") - .MinimumLength(3).WithMessage("Name must be at least 3 characters long."); - - RuleFor(x => x.Description) - .MaximumLength(3000).WithMessage("Description must not exceed 3000 characters."); - } - - private async Task BeUniqueEmail(string email, CancellationToken cancellationToken) - { - var pacient = await _pacientRepository.FindByEmailAsync(email); - if (pacient != null) - { - return pacient.Email.Equals(email, StringComparison.OrdinalIgnoreCase); - } - return pacient == null; - } -} diff --git a/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationHandler.cs b/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationHandler.cs deleted file mode 100644 index 54d7202..0000000 --- a/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationHandler.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Application.Endpoints.Pacients.Login; -using Application.Services.Database; -using Core.Entities; - -namespace Application.Endpoints.Pacients.Registration; - -public class PacientRegistrationHandler -{ - private readonly IPacientRepository _pacientRepository; - - public PacientRegistrationHandler(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - } - - public async Task Handle(PacientRegistrationDto registrationDTO) - { - var validation = new PacientRegistrationValidation(_pacientRepository); - var validationResult = await validation.ValidateAsync(registrationDTO); - - if (!validationResult.IsValid) - { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); - return new BaseResponse - { - Success = false, - Message = string.Join(", ", errorMessage), - Data = null - }; - } - - var pacient = new Pacient - { - Email = registrationDTO.Email, - Password = registrationDTO.Password, - Name = registrationDTO.Name - }; - - await _pacientRepository.AddAsync(pacient); - - return new BaseResponse - { - Success = true, - Message = "Pacient registered successfully", - Data = pacient // Be careful with sending sensitive data like Passwords - }; - } -} diff --git a/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationValidation.cs b/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationValidation.cs deleted file mode 100644 index 86bb3ac..0000000 --- a/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationValidation.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Application.Endpoints.Pacients.Login; -using Application.Services.Database; -using FluentValidation; - -namespace Application.Endpoints.Pacients.Registration; - -public class PacientRegistrationValidation : AbstractValidator -{ - private readonly IPacientRepository _pacientRepository; - - public PacientRegistrationValidation(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - - RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeUniqueEmail).WithMessage("Email already exists."); - - RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long."); - - RuleFor(x => x.Name) - .NotEmpty().WithMessage("Name is required.") - .MinimumLength(3).WithMessage("Name must be at least 3 characters long."); - } - - private async Task BeUniqueEmail(string email, CancellationToken cancellationToken) - { - var pacient = await _pacientRepository.FindByEmailAsync(email); - return pacient == null; - } -} diff --git a/backend/Application/Endpoints/Pacients/ResetPassword/PacientResetPasswordHandler.cs b/backend/Application/Endpoints/Pacients/ResetPassword/PacientResetPasswordHandler.cs deleted file mode 100644 index 5619604..0000000 --- a/backend/Application/Endpoints/Pacients/ResetPassword/PacientResetPasswordHandler.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Application.Endpoints.Pacients.Login; -using Application.Services.Database; - -namespace Application.Endpoints.Pacients.ResetPassword; - -public class PacientResetPasswordHandler -{ - private readonly IPacientRepository _pacientRepository; - - public PacientResetPasswordHandler(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - } - - public async Task Handle(PacientLoginDTO resetPacientDto) - { - var validation = new PacientResetPasswordValidation(_pacientRepository); - var validationResult = await validation.ValidateAsync(resetPacientDto); - - if (!validationResult.IsValid) - { - var errorMessage = validationResult.Errors.Select(e => e.ErrorMessage).ToList(); - return new BaseResponse - { - Success = false, - Message = string.Join(", ", errorMessage), - Data = null - }; - } - - var currentPacient = await _pacientRepository.FindByEmailAsync(resetPacientDto.Email); - - var updatedPacient = currentPacient; - - updatedPacient.Password = resetPacientDto.Password; - - await _pacientRepository.UpdateAsync(updatedPacient); - - updatedPacient = await _pacientRepository.GetByIdAsync(currentPacient.Id); - - if (updatedPacient.Password != resetPacientDto.Password) - { - return new BaseResponse - { - Success = false, - Message = $"Failed to update passwor for pacient {updatedPacient.Name}", - Data = null - }; - } - - return new BaseResponse - { - Success = true, - Message = $"Password of pacient {updatedPacient.Name} has been reset succesfully", - Data = updatedPacient.Email - }; - } -} diff --git a/backend/Application/Endpoints/Pacients/ResetPassword/PacientResetPasswordValidation.cs b/backend/Application/Endpoints/Pacients/ResetPassword/PacientResetPasswordValidation.cs deleted file mode 100644 index bbecf60..0000000 --- a/backend/Application/Endpoints/Pacients/ResetPassword/PacientResetPasswordValidation.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Application.Services.Database; -using FluentValidation; - -namespace Application.Endpoints.Pacients.Login; - -public class PacientResetPasswordValidation : AbstractValidator -{ - private readonly IPacientRepository _pacientRepository; - - public PacientResetPasswordValidation(IPacientRepository pacientRepository) - { - _pacientRepository = pacientRepository; - - RuleFor(x => x.Email) - .NotEmpty().WithMessage("Email is required.") - .EmailAddress().WithMessage("Invalid email format.") - .MustAsync(BeExistingPacient).WithMessage("Pacient with this email does not exist."); - - RuleFor(x => x.Password) - .NotEmpty().WithMessage("Password is required.") - .MinimumLength(8).WithMessage("Password must be at least 8 characters long.") - .MustAsync((dto, password, context, cancellationToken) => BeDifferentFromOldPassword(dto.Email, password, cancellationToken)) - .WithMessage("New password cannot be the same as old password."); - } - - private async Task BeExistingPacient(string email, CancellationToken cancellationToken) - { - var pacient = await _pacientRepository.FindByEmailAsync(email); - return pacient != null; - } - - private async Task BeDifferentFromOldPassword(string email, string newPassword, CancellationToken cancellationToken) - { - var currentPacient = await _pacientRepository.FindByEmailAsync(email); - return !newPassword.Equals(currentPacient?.Password, StringComparison.Ordinal); - } -} diff --git a/backend/Application/Endpoints/Pacients/Login/PacientLoginDto.cs b/backend/Application/Endpoints/Patients/Login/PatientLoginDto.cs similarity index 50% rename from backend/Application/Endpoints/Pacients/Login/PacientLoginDto.cs rename to backend/Application/Endpoints/Patients/Login/PatientLoginDto.cs index 04b6600..3264115 100644 --- a/backend/Application/Endpoints/Pacients/Login/PacientLoginDto.cs +++ b/backend/Application/Endpoints/Patients/Login/PatientLoginDto.cs @@ -1,7 +1,7 @@ -namespace Application.Endpoints.Pacients.Login; +namespace Application.Endpoints.Patients.Login; -public class PacientLoginDTO +public class PatientLoginDto { public string? Email { get; set; } public string? Password { get; set; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Login/PatientLoginHandler.cs b/backend/Application/Endpoints/Patients/Login/PatientLoginHandler.cs new file mode 100644 index 0000000..8127a19 --- /dev/null +++ b/backend/Application/Endpoints/Patients/Login/PatientLoginHandler.cs @@ -0,0 +1,37 @@ +using Application.Services.Database; + +namespace Application.Endpoints.Patients.Login; + +public class PatientLoginHandler +{ + private readonly IPatientRepository _database; + + public PatientLoginHandler(IPatientRepository database) + { + _database = database; + } + + public async Task Handle(PatientLoginDto loginDTO) + { + var validation = new PatientLoginValidation(_database); + var validationResult = await validation.ValidateAsync(loginDTO); + + if (validationResult.IsValid) + return new BaseResponse + { + StatusCode = HttpStatusCodes.OK, + Message = "Authentication successful", + Data = null + }; + + 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 + }; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Login/PatientLoginValidation.cs b/backend/Application/Endpoints/Patients/Login/PatientLoginValidation.cs new file mode 100644 index 0000000..21ff7b3 --- /dev/null +++ b/backend/Application/Endpoints/Patients/Login/PatientLoginValidation.cs @@ -0,0 +1,31 @@ +using Application.Services.Database; +using FluentValidation; + +namespace Application.Endpoints.Patients.Login; + +public class PatientLoginValidation : AbstractValidator +{ + private readonly IPatientRepository _patientRepository; + + public PatientLoginValidation(IPatientRepository patientRepository) + { + _patientRepository = patientRepository; + + RuleFor(x => x.Email) + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeExistingPatient).WithMessage("Patient with this email does not exist.") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); + + RuleFor(x => x.Password) + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(8).WithMessage("Password must be at least 8 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + } + + private async Task BeExistingPatient(string email, CancellationToken cancellationToken) + { + var patient = await _patientRepository.FindByEmailAsync(email); + return patient != null; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Profile/PatientProfileDto.cs b/backend/Application/Endpoints/Patients/Profile/PatientProfileDto.cs new file mode 100644 index 0000000..76cbeba --- /dev/null +++ b/backend/Application/Endpoints/Patients/Profile/PatientProfileDto.cs @@ -0,0 +1,9 @@ +namespace Application.Endpoints.Patients.Profile; + +public class PatientProfileDto +{ + public Guid Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + public string Password { get; set; } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Profile/PatientProfileHandler.cs b/backend/Application/Endpoints/Patients/Profile/PatientProfileHandler.cs new file mode 100644 index 0000000..749af92 --- /dev/null +++ b/backend/Application/Endpoints/Patients/Profile/PatientProfileHandler.cs @@ -0,0 +1,110 @@ +using Application.Services.Database; +using Application.Services.HashingAlgorithms; + +namespace Application.Endpoints.Patients.Profile; + +public class PatientProfileHandler +{ + private readonly IHashingAlgorithms _hashingAlgorithms; + private readonly IPatientRepository _patientRepository; + + public PatientProfileHandler(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms) + { + _patientRepository = patientRepository; + _hashingAlgorithms = hashingAlgorithms; + } + + public async Task HandleGet(Guid id) + { + var patient = await _patientRepository.GetByIdAsync(id).ConfigureAwait(false); + if (patient != null) + return new BaseResponse + { + StatusCode = HttpStatusCodes.OK, + Message = $"Retrieved patient with id: {id}", + Data = patient + }; + + return new BaseResponse + { + StatusCode = HttpStatusCodes.NotFound, + Message = $"Patient with id: {id} not found", + Data = null + }; + } + + public async Task HandleGetAll() + { + var patients = await _patientRepository.GetAllAsync().ConfigureAwait(false); + if (patients.Any()) + return new BaseResponse + { + StatusCode = HttpStatusCodes.OK, + Message = "Retrieved patients", + Data = patients.ToList() + }; + + return new BaseResponse + { + StatusCode = HttpStatusCodes.NotFound, + Message = "Patients not found", + Data = null + }; + } + + public async Task HandleUpdate(PatientProfileDto updateDto) + { + var validation = new PatientProfileValidation(_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 patientToUpdate = await _patientRepository.GetByIdAsync(updateDto.Id); + + patientToUpdate.SetEmail(updateDto.Email); + patientToUpdate.SetPassword(_hashingAlgorithms.SHA256Algorithm(updateDto.Password)); + patientToUpdate.SetName(updateDto.Name); + + await _patientRepository.UpdateAsync(patientToUpdate); + + return new BaseResponse + { + StatusCode = HttpStatusCodes.NoContent, + Message = null, + Data = null + }; + } + + public async Task HandleDelete(Guid id) + { + var patientToDelete = await _patientRepository.GetByIdAsync(id); + if (patientToDelete == null) + return new BaseResponse + { + StatusCode = HttpStatusCodes.NotFound, + Message = "Patient not found.", + Data = null + }; + + await _patientRepository.DeleteAsync(patientToDelete); + + return new BaseResponse + { + StatusCode = HttpStatusCodes.NotFound, + Message = null, + Data = null + }; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Profile/PatientProfileValidation.cs b/backend/Application/Endpoints/Patients/Profile/PatientProfileValidation.cs new file mode 100644 index 0000000..8602d60 --- /dev/null +++ b/backend/Application/Endpoints/Patients/Profile/PatientProfileValidation.cs @@ -0,0 +1,47 @@ +using Application.Services.Database; +using FluentValidation; + +namespace Application.Endpoints.Patients.Profile; + +public class PatientProfileValidation : AbstractValidator +{ + private readonly IPatientRepository _patientRepository; + + public PatientProfileValidation(IPatientRepository patientRepository) + { + _patientRepository = patientRepository; + + RuleFor(x => x.Id) + .NotEmpty().WithMessage("Id is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(IsPatientRegistered).WithMessage("Patient is registered in system") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); + + RuleFor(x => x.Email) + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeUniqueEmail).WithMessage("Email in use by another patient.") + .WithErrorCode(HttpStatusCodes.Conflict.ToString()); + + RuleFor(x => x.Password) + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(8).WithMessage("Password must be at least 8 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + + RuleFor(x => x.Name) + .NotEmpty().WithMessage("Name is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(3).WithMessage("Name must be at least 3 characters long.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + } + + private async Task IsPatientRegistered(Guid id, CancellationToken cancellationToken) + { + var doctor = await _patientRepository.GetByIdAsync(id); + return doctor == null; + } + + private async Task BeUniqueEmail(string email, CancellationToken cancellationToken) + { + var patient = await _patientRepository.FindByEmailAsync(email); + return patient == null; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationDto.cs b/backend/Application/Endpoints/Patients/Registration/PatientRegistrationDto.cs similarity index 55% rename from backend/Application/Endpoints/Pacients/Registration/PacientRegistrationDto.cs rename to backend/Application/Endpoints/Patients/Registration/PatientRegistrationDto.cs index b9fee04..7209d60 100644 --- a/backend/Application/Endpoints/Pacients/Registration/PacientRegistrationDto.cs +++ b/backend/Application/Endpoints/Patients/Registration/PatientRegistrationDto.cs @@ -1,8 +1,8 @@ -namespace Application.Endpoints.Pacients.Login; +namespace Application.Endpoints.Patients.Registration; -public class PacientRegistrationDto +public class PatientRegistrationDto { public string Name { get; set; } public string Email { get; set; } public string Password { get; set; } -} +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Registration/PatientRegistrationHandler.cs b/backend/Application/Endpoints/Patients/Registration/PatientRegistrationHandler.cs new file mode 100644 index 0000000..84388d9 --- /dev/null +++ b/backend/Application/Endpoints/Patients/Registration/PatientRegistrationHandler.cs @@ -0,0 +1,51 @@ +using Application.Services.Database; +using Application.Services.HashingAlgorithms; +using Core.Entities; + +namespace Application.Endpoints.Patients.Registration; + +public class PatientRegistrationHandler +{ + private readonly IHashingAlgorithms _hashingAlgorithms; + private readonly IPatientRepository _patientRepository; + + public PatientRegistrationHandler(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms) + { + _patientRepository = patientRepository; + _hashingAlgorithms = hashingAlgorithms; + } + + public async Task Handle(PatientRegistrationDto registrationDTO) + { + var validation = new PatientRegistrationValidation(_patientRepository); + var validationResult = await validation.ValidateAsync(registrationDTO); + + 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 patient = new Patient(); + patient.SetEmail(registrationDTO.Email); + patient.SetName(registrationDTO.Name); + patient.SetPassword(_hashingAlgorithms.SHA256Algorithm(registrationDTO.Password)); + + await _patientRepository.AddAsync(patient); + + return new BaseResponse + { + StatusCode = HttpStatusCodes.Created, + Message = "Patient registered successfully", + Data = patient // Be careful with sending sensitive data like Passwords + }; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/Registration/PatientRegistrationValidation.cs b/backend/Application/Endpoints/Patients/Registration/PatientRegistrationValidation.cs new file mode 100644 index 0000000..cc625aa --- /dev/null +++ b/backend/Application/Endpoints/Patients/Registration/PatientRegistrationValidation.cs @@ -0,0 +1,34 @@ +using Application.Services.Database; +using FluentValidation; + +namespace Application.Endpoints.Patients.Registration; + +public class PatientRegistrationValidation : AbstractValidator +{ + private readonly IPatientRepository _patientRepository; + + public PatientRegistrationValidation(IPatientRepository patientRepository) + { + _patientRepository = patientRepository; + + RuleFor(x => x.Email) + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeUniqueEmail).WithMessage("Email already exists.").WithErrorCode(HttpStatusCodes.Conflict.ToString()); + + + RuleFor(x => x.Password) + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(8).WithMessage("Password must be at least 8 characters long.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + + RuleFor(x => x.Name) + .NotEmpty().WithMessage("Name is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MinimumLength(3).WithMessage("Name must be at least 3 characters long.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + } + + private async Task BeUniqueEmail(string email, CancellationToken cancellationToken) + { + var pacient = await _patientRepository.FindByEmailAsync(email); + return pacient == null; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/ResetPassword/PatientLoginDto.cs b/backend/Application/Endpoints/Patients/ResetPassword/PatientLoginDto.cs new file mode 100644 index 0000000..69921eb --- /dev/null +++ b/backend/Application/Endpoints/Patients/ResetPassword/PatientLoginDto.cs @@ -0,0 +1,7 @@ +namespace Application.Endpoints.Patients.ResetPassword; + +public class PatientResetPasswordDto +{ + public string? Email { get; set; } + public string? Password { get; set; } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/ResetPassword/PatientResetPasswordHandler.cs b/backend/Application/Endpoints/Patients/ResetPassword/PatientResetPasswordHandler.cs new file mode 100644 index 0000000..2df47b5 --- /dev/null +++ b/backend/Application/Endpoints/Patients/ResetPassword/PatientResetPasswordHandler.cs @@ -0,0 +1,50 @@ +using Application.Services.Database; +using Application.Services.HashingAlgorithms; + +namespace Application.Endpoints.Patients.ResetPassword; + +public class PatientResetPasswordHandler +{ + private readonly IHashingAlgorithms _hashingAlgorithms; + private readonly IPatientRepository _patientRepository; + + public PatientResetPasswordHandler(IPatientRepository patientRepository, IHashingAlgorithms hashingAlgorithms) + { + _patientRepository = patientRepository; + _hashingAlgorithms = hashingAlgorithms; + } + + public async Task Handle(PatientResetPasswordDto patientResetPasswordDto) + { + patientResetPasswordDto.Password = _hashingAlgorithms.SHA256Algorithm(patientResetPasswordDto.Password); + var validation = new PatientResetPasswordValidation(_patientRepository); + var validationResult = await validation.ValidateAsync(patientResetPasswordDto); + + 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 currentPatient = await _patientRepository.FindByEmailAsync(patientResetPasswordDto.Email); + var updatedPatient = currentPatient; + updatedPatient.SetPassword(_hashingAlgorithms.SHA256Algorithm(patientResetPasswordDto.Password)); + + await _patientRepository.UpdateAsync(updatedPatient); + + return new BaseResponse + { + StatusCode = HttpStatusCodes.OK, + Message = "Password successfully changed!", + Data = null + }; + } +} \ No newline at end of file diff --git a/backend/Application/Endpoints/Patients/ResetPassword/PatientResetPasswordValidation.cs b/backend/Application/Endpoints/Patients/ResetPassword/PatientResetPasswordValidation.cs new file mode 100644 index 0000000..42f18b4 --- /dev/null +++ b/backend/Application/Endpoints/Patients/ResetPassword/PatientResetPasswordValidation.cs @@ -0,0 +1,40 @@ +using Application.Services.Database; +using FluentValidation; + +namespace Application.Endpoints.Patients.ResetPassword; + +public class PatientResetPasswordValidation : AbstractValidator +{ + private readonly IPatientRepository _patientRepository; + + public PatientResetPasswordValidation(IPatientRepository patientRepository) + { + _patientRepository = patientRepository; + + RuleFor(x => x.Email) + .NotEmpty().WithMessage("Email is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .EmailAddress().WithMessage("Invalid email format.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync(BeExistingPacient).WithMessage("Patient with this email does not exist.") + .WithErrorCode(HttpStatusCodes.NotFound.ToString()); + + RuleFor(x => x.Password) + .NotEmpty().WithMessage("Password is required.").WithErrorCode(HttpStatusCodes.BadRequest.ToString()) + .MustAsync((dto, password, context, cancellationToken) => + BeDifferentFromOldPassword(dto.Email, password, cancellationToken)) + .WithMessage("New password cannot be the same as old password.") + .WithErrorCode(HttpStatusCodes.BadRequest.ToString()); + } + + private async Task BeExistingPacient(string email, CancellationToken cancellationToken) + { + var pacient = await _patientRepository.FindByEmailAsync(email); + return pacient != null; + } + + private async Task BeDifferentFromOldPassword(string email, string newPassword, + CancellationToken cancellationToken) + { + var currentPatient = await _patientRepository.FindByEmailAsync(email); + return !newPassword.Equals(currentPatient?.Password, StringComparison.Ordinal); + } +} \ No newline at end of file diff --git a/backend/Application/Services/Database/IConversation.cs b/backend/Application/Services/Database/IConversation.cs index 41e4fae..75e498c 100644 --- a/backend/Application/Services/Database/IConversation.cs +++ b/backend/Application/Services/Database/IConversation.cs @@ -2,4 +2,4 @@ public interface IConversationRepository { -} +} \ No newline at end of file diff --git a/backend/Application/Services/Database/IDoctors.cs b/backend/Application/Services/Database/IDoctors.cs index b9ae00d..2eef847 100644 --- a/backend/Application/Services/Database/IDoctors.cs +++ b/backend/Application/Services/Database/IDoctors.cs @@ -6,9 +6,10 @@ public interface IDoctorRepository { Task AddAsync(Doctor doctor); - Task GetByIdAsync(Guid id); + Task GetByIdAsync(Guid id); Task FindByEmailAsync(string email); + Task CredentialsMatch(string email, string password); Task UpdateAsync(Doctor doctor); diff --git a/backend/Application/Services/Database/IMedicalHistory.cs b/backend/Application/Services/Database/IMedicalHistory.cs index 9b931b8..f7f01c8 100644 --- a/backend/Application/Services/Database/IMedicalHistory.cs +++ b/backend/Application/Services/Database/IMedicalHistory.cs @@ -4,12 +4,9 @@ namespace Application.Services.Database; public interface IMedicalHistoryRepository { - Task GetByIdAsync(Guid id); - - Task GetByUserIdAsync(Guid userId); - + Task GetByIdAsync(Guid id); Task AddAsync(MedicalHistory medicalHistory); - Task UpdateAsync(MedicalHistory medicalHistory); - -} + Task DeleteAsync(MedicalHistory medicalHistory); + Task> GetAllAsync(); +} \ No newline at end of file diff --git a/backend/Application/Services/Database/IMongoDbServices.cs b/backend/Application/Services/Database/IMongoDbServices.cs new file mode 100644 index 0000000..b12d38d --- /dev/null +++ b/backend/Application/Services/Database/IMongoDbServices.cs @@ -0,0 +1,12 @@ +using MongoDB.Driver; + +namespace Application.Services.Database; + +public interface IMongoDbService +{ + IMongoCollection GetCollection(string collectionName); + Task> FindAsync(string collectionName, List<(string FieldName, string Value)> criteria); + Task AddAsync(string collectionName, T document); + Task ModifyAsync(string collectionName, string keyField, string keyValue, T document); + Task DeleteAsync(string collectionName, string keyField, string keyValue); +} \ No newline at end of file diff --git a/backend/Application/Services/Database/IPatients.cs b/backend/Application/Services/Database/IPatients.cs index 5162989..29a6581 100644 --- a/backend/Application/Services/Database/IPatients.cs +++ b/backend/Application/Services/Database/IPatients.cs @@ -2,17 +2,17 @@ namespace Application.Services.Database; -public interface IPacientRepository +public interface IPatientRepository { - Task AddAsync(Pacient pacient); + Task AddAsync(Patient patient); - Task GetByIdAsync(Guid id); + Task GetByIdAsync(Guid id); - Task FindByEmailAsync(string email); + Task FindByEmailAsync(string email); - Task UpdateAsync(Pacient doctor); + Task UpdateAsync(Patient doctor); - Task DeleteAsync(Pacient doctor); + Task DeleteAsync(Patient doctor); - Task> GetAllAsync(); -} + Task> GetAllAsync(); +} \ No newline at end of file diff --git a/backend/Application/Services/HashingAlgorithms/IHashingAlgorithms.cs b/backend/Application/Services/HashingAlgorithms/IHashingAlgorithms.cs new file mode 100644 index 0000000..2cbd3d9 --- /dev/null +++ b/backend/Application/Services/HashingAlgorithms/IHashingAlgorithms.cs @@ -0,0 +1,6 @@ +namespace Application.Services.HashingAlgorithms; + +public interface IHashingAlgorithms +{ + string? SHA256Algorithm(string? password); +} \ No newline at end of file diff --git a/backend/Application/bin/Debug/net8.0/Application.deps.json b/backend/Application/bin/Debug/net8.0/Application.deps.json index 6cbfd1a..7db3fe4 100644 --- a/backend/Application/bin/Debug/net8.0/Application.deps.json +++ b/backend/Application/bin/Debug/net8.0/Application.deps.json @@ -8,12 +8,44 @@ ".NETCoreApp,Version=v8.0": { "Application/1.0.0": { "dependencies": { - "FluentValidation": "11.9.0" + "Core": "1.0.0", + "FluentValidation": "11.9.0", + "MongoDB.Driver": "2.24.0" }, "runtime": { "Application.dll": {} } }, + "AWSSDK.Core/3.7.100.14": { + "runtime": { + "lib/netcoreapp3.1/AWSSDK.Core.dll": { + "assemblyVersion": "3.3.0.0", + "fileVersion": "3.7.100.14" + } + } + }, + "AWSSDK.SecurityToken/3.7.100.14": { + "dependencies": { + "AWSSDK.Core": "3.7.100.14" + }, + "runtime": { + "lib/netcoreapp3.1/AWSSDK.SecurityToken.dll": { + "assemblyVersion": "3.3.0.0", + "fileVersion": "3.7.100.14" + } + } + }, + "DnsClient/1.6.1": { + "dependencies": { + "Microsoft.Win32.Registry": "5.0.0" + }, + "runtime": { + "lib/net5.0/DnsClient.dll": { + "assemblyVersion": "1.6.1.0", + "fileVersion": "1.6.1.0" + } + } + }, "FluentValidation/11.9.0": { "runtime": { "lib/net8.0/FluentValidation.dll": { @@ -21,6 +53,133 @@ "fileVersion": "11.9.0.0" } } + }, + "Microsoft.Extensions.Logging.Abstractions/2.0.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.0.17205" + } + } + }, + "Microsoft.NETCore.Platforms/5.0.0": {}, + "Microsoft.Win32.Registry/5.0.0": { + "dependencies": { + "System.Security.AccessControl": "5.0.0", + "System.Security.Principal.Windows": "5.0.0" + } + }, + "MongoDB.Bson/2.24.0": { + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "5.0.0" + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Bson.dll": { + "assemblyVersion": "2.24.0.0", + "fileVersion": "2.24.0.0" + } + } + }, + "MongoDB.Driver/2.24.0": { + "dependencies": { + "Microsoft.Extensions.Logging.Abstractions": "2.0.0", + "MongoDB.Bson": "2.24.0", + "MongoDB.Driver.Core": "2.24.0", + "MongoDB.Libmongocrypt": "1.8.2" + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Driver.dll": { + "assemblyVersion": "2.24.0.0", + "fileVersion": "2.24.0.0" + } + } + }, + "MongoDB.Driver.Core/2.24.0": { + "dependencies": { + "AWSSDK.SecurityToken": "3.7.100.14", + "DnsClient": "1.6.1", + "Microsoft.Extensions.Logging.Abstractions": "2.0.0", + "MongoDB.Bson": "2.24.0", + "MongoDB.Libmongocrypt": "1.8.2", + "SharpCompress": "0.30.1", + "Snappier": "1.0.0", + "System.Buffers": "4.5.1", + "ZstdSharp.Port": "0.7.3" + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Driver.Core.dll": { + "assemblyVersion": "2.24.0.0", + "fileVersion": "2.24.0.0" + } + } + }, + "MongoDB.Libmongocrypt/1.8.2": { + "runtime": { + "lib/netstandard2.1/MongoDB.Libmongocrypt.dll": { + "assemblyVersion": "1.8.2.0", + "fileVersion": "1.8.2.0" + } + }, + "runtimeTargets": { + "runtimes/linux/native/libmongocrypt.so": { + "rid": "linux", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/osx/native/libmongocrypt.dylib": { + "rid": "osx", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/win/native/mongocrypt.dll": { + "rid": "win", + "assetType": "native", + "fileVersion": "0.0.0.0" + } + } + }, + "SharpCompress/0.30.1": { + "runtime": { + "lib/net5.0/SharpCompress.dll": { + "assemblyVersion": "0.30.1.0", + "fileVersion": "0.30.1.0" + } + } + }, + "Snappier/1.0.0": { + "runtime": { + "lib/net5.0/Snappier.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.0.0.0" + } + } + }, + "System.Buffers/4.5.1": {}, + "System.Memory/4.5.5": {}, + "System.Runtime.CompilerServices.Unsafe/5.0.0": {}, + "System.Security.AccessControl/5.0.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "5.0.0", + "System.Security.Principal.Windows": "5.0.0" + } + }, + "System.Security.Principal.Windows/5.0.0": {}, + "ZstdSharp.Port/0.7.3": { + "runtime": { + "lib/net7.0/ZstdSharp.dll": { + "assemblyVersion": "0.7.3.0", + "fileVersion": "0.7.3.0" + } + } + }, + "Core/1.0.0": { + "dependencies": { + "MongoDB.Bson": "2.24.0" + }, + "runtime": { + "Core.dll": {} + } } } }, @@ -30,12 +189,143 @@ "serviceable": false, "sha512": "" }, + "AWSSDK.Core/3.7.100.14": { + "type": "package", + "serviceable": true, + "sha512": "sha512-gnEgxBlk4PFEfdPE8Lkf4+D16MZFYSaW7/o6Wwe5e035QWUkTJX0Dn4LfTCdV5QSEL/fOFxu+yCAm55eIIBgog==", + "path": "awssdk.core/3.7.100.14", + "hashPath": "awssdk.core.3.7.100.14.nupkg.sha512" + }, + "AWSSDK.SecurityToken/3.7.100.14": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dGCVuVo0CFUKWW85W8YENO+aREf8sCBDjvGbnNvxJuNW4Ss+brEU9ltHhq2KfZze2VUNK1/wygbPG1bmbpyXEw==", + "path": "awssdk.securitytoken/3.7.100.14", + "hashPath": "awssdk.securitytoken.3.7.100.14.nupkg.sha512" + }, + "DnsClient/1.6.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4H/f2uYJOZ+YObZjpY9ABrKZI+JNw3uizp6oMzTXwDw6F+2qIPhpRl/1t68O/6e98+vqNiYGu+lswmwdYUy3gg==", + "path": "dnsclient/1.6.1", + "hashPath": "dnsclient.1.6.1.nupkg.sha512" + }, "FluentValidation/11.9.0": { "type": "package", "serviceable": true, "sha512": "sha512-VneVlTvwYDkfHV5av3QrQ0amALgrLX6LV94wlYyEsh0B/klJBW7C8y2eAtj5tOZ3jH6CAVpr4s1ZGgew/QWyig==", "path": "fluentvalidation/11.9.0", "hashPath": "fluentvalidation.11.9.0.nupkg.sha512" + }, + "Microsoft.Extensions.Logging.Abstractions/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6ZCllUYGFukkymSTx3Yr0G/ajRxoNJp7/FqSxSB4fGISST54ifBhgu4Nc0ItGi3i6DqwuNd8SUyObmiC++AO2Q==", + "path": "microsoft.extensions.logging.abstractions/2.0.0", + "hashPath": "microsoft.extensions.logging.abstractions.2.0.0.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/5.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ==", + "path": "microsoft.netcore.platforms/5.0.0", + "hashPath": "microsoft.netcore.platforms.5.0.0.nupkg.sha512" + }, + "Microsoft.Win32.Registry/5.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==", + "path": "microsoft.win32.registry/5.0.0", + "hashPath": "microsoft.win32.registry.5.0.0.nupkg.sha512" + }, + "MongoDB.Bson/2.24.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-n8CWaA4iTuoEQYv0+FSKNTX/hJozFQa5EgSILVNPhTGHcrbABHhpVrT1NwRRAAS6sUb8ZyhHmLPBa88LJemptA==", + "path": "mongodb.bson/2.24.0", + "hashPath": "mongodb.bson.2.24.0.nupkg.sha512" + }, + "MongoDB.Driver/2.24.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j1q11iMk3LN38ze6jgV1ATp+WKVVQbsGrhFkuOcHwRNtIk70TpLKjOD1Z3CCkyrzxCsUyhwk745tK2ASNOI4WA==", + "path": "mongodb.driver/2.24.0", + "hashPath": "mongodb.driver.2.24.0.nupkg.sha512" + }, + "MongoDB.Driver.Core/2.24.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UW0yadpMPi9+MtLHy6onpol3D9tXMRg61P0ROnij+h35EOr0vt/nxvlPrDcUjl3SvttvpsEXQKxb2lQShBA1dA==", + "path": "mongodb.driver.core/2.24.0", + "hashPath": "mongodb.driver.core.2.24.0.nupkg.sha512" + }, + "MongoDB.Libmongocrypt/1.8.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-z/8JCULSHM1+mzkau0ivIkU9kIn8JEFFSkmYTSaMaWMMHt96JjUtMKuXxeGNGSnHZ5290ZPKIlQfjoWFk2sKog==", + "path": "mongodb.libmongocrypt/1.8.2", + "hashPath": "mongodb.libmongocrypt.1.8.2.nupkg.sha512" + }, + "SharpCompress/0.30.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XqD4TpfyYGa7QTPzaGlMVbcecKnXy4YmYLDWrU+JIj7IuRNl7DH2END+Ll7ekWIY8o3dAMWLFDE1xdhfIWD1nw==", + "path": "sharpcompress/0.30.1", + "hashPath": "sharpcompress.0.30.1.nupkg.sha512" + }, + "Snappier/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rFtK2KEI9hIe8gtx3a0YDXdHOpedIf9wYCEYtBEmtlyiWVX3XlCNV03JrmmAi/Cdfn7dxK+k0sjjcLv4fpHnqA==", + "path": "snappier/1.0.0", + "hashPath": "snappier.1.0.0.nupkg.sha512" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Memory/4.5.5": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "path": "system.memory/4.5.5", + "hashPath": "system.memory.4.5.5.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/5.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==", + "path": "system.runtime.compilerservices.unsafe/5.0.0", + "hashPath": "system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512" + }, + "System.Security.AccessControl/5.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==", + "path": "system.security.accesscontrol/5.0.0", + "hashPath": "system.security.accesscontrol.5.0.0.nupkg.sha512" + }, + "System.Security.Principal.Windows/5.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA==", + "path": "system.security.principal.windows/5.0.0", + "hashPath": "system.security.principal.windows.5.0.0.nupkg.sha512" + }, + "ZstdSharp.Port/0.7.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-U9Ix4l4cl58Kzz1rJzj5hoVTjmbx1qGMwzAcbv1j/d3NzrFaESIurQyg+ow4mivCgkE3S413y+U9k4WdnEIkRA==", + "path": "zstdsharp.port/0.7.3", + "hashPath": "zstdsharp.port.0.7.3.nupkg.sha512" + }, + "Core/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" } } } \ No newline at end of file diff --git a/backend/Application/bin/Debug/net8.0/Application.dll b/backend/Application/bin/Debug/net8.0/Application.dll index 3847881..bed3154 100644 Binary files a/backend/Application/bin/Debug/net8.0/Application.dll and b/backend/Application/bin/Debug/net8.0/Application.dll differ diff --git a/backend/Application/bin/Debug/net8.0/Application.pdb b/backend/Application/bin/Debug/net8.0/Application.pdb index 140769a..81cca86 100644 Binary files a/backend/Application/bin/Debug/net8.0/Application.pdb and b/backend/Application/bin/Debug/net8.0/Application.pdb differ diff --git a/backend/Application/bin/Debug/net8.0/Core.dll b/backend/Application/bin/Debug/net8.0/Core.dll new file mode 100644 index 0000000..02b0d46 Binary files /dev/null and b/backend/Application/bin/Debug/net8.0/Core.dll differ diff --git a/backend/Application/bin/Debug/net8.0/Core.pdb b/backend/Application/bin/Debug/net8.0/Core.pdb new file mode 100644 index 0000000..fafb776 Binary files /dev/null and b/backend/Application/bin/Debug/net8.0/Core.pdb differ diff --git a/backend/Application/obj/Application.csproj.nuget.dgspec.json b/backend/Application/obj/Application.csproj.nuget.dgspec.json index 97fb5fc..dd8cc07 100644 --- a/backend/Application/obj/Application.csproj.nuget.dgspec.json +++ b/backend/Application/obj/Application.csproj.nuget.dgspec.json @@ -27,7 +27,11 @@ "frameworks": { "net8.0": { "targetAlias": "net8.0", - "projectReferences": {} + "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": { @@ -43,6 +47,71 @@ "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" + } + } + }, + "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\Core.csproj": { + "version": "1.0.0", + "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", + "packagesPath": "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Core\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Andrei Cerbu\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "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": [ diff --git a/backend/Application/obj/Application.csproj.nuget.g.props b/backend/Application/obj/Application.csproj.nuget.g.props index 53ed97d..110a9a9 100644 --- a/backend/Application/obj/Application.csproj.nuget.g.props +++ b/backend/Application/obj/Application.csproj.nuget.g.props @@ -12,4 +12,8 @@ + + C:\Users\Andrei Cerbu\.nuget\packages\awssdk.core\3.7.100.14 + C:\Users\Andrei Cerbu\.nuget\packages\awssdk.securitytoken\3.7.100.14 + \ No newline at end of file diff --git a/backend/Application/obj/Debug/net8.0/Applicat.44B5EDA2.Up2Date b/backend/Application/obj/Debug/net8.0/Applicat.44B5EDA2.Up2Date new file mode 100644 index 0000000..e69de29 diff --git a/backend/Application/obj/Debug/net8.0/Application.AssemblyInfo.cs b/backend/Application/obj/Debug/net8.0/Application.AssemblyInfo.cs index 09352c5..94d1c06 100644 --- a/backend/Application/obj/Debug/net8.0/Application.AssemblyInfo.cs +++ b/backend/Application/obj/Debug/net8.0/Application.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Application")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1206db932183801caeaefeb110af24b0147366c1")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ccec617a59a712428e67340dc46bebefb152aca")] [assembly: System.Reflection.AssemblyProductAttribute("Application")] [assembly: System.Reflection.AssemblyTitleAttribute("Application")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/backend/Application/obj/Debug/net8.0/Application.AssemblyInfoInputs.cache b/backend/Application/obj/Debug/net8.0/Application.AssemblyInfoInputs.cache index a11511e..457bd1f 100644 --- a/backend/Application/obj/Debug/net8.0/Application.AssemblyInfoInputs.cache +++ b/backend/Application/obj/Debug/net8.0/Application.AssemblyInfoInputs.cache @@ -1 +1 @@ -08f11b06d50aa7f59bae5a60fd7574c692dba2ef91a67ff9c346e1a2e6d0ee14 +43c727b13400f8e89ac74c76384ddd37b5c5e6f7a0de4c00bfcc4bc65f5d856d diff --git a/backend/Application/obj/Debug/net8.0/Application.assets.cache b/backend/Application/obj/Debug/net8.0/Application.assets.cache index bfc7996..d31744b 100644 Binary files a/backend/Application/obj/Debug/net8.0/Application.assets.cache and b/backend/Application/obj/Debug/net8.0/Application.assets.cache differ diff --git a/backend/Application/obj/Debug/net8.0/Application.csproj.AssemblyReference.cache b/backend/Application/obj/Debug/net8.0/Application.csproj.AssemblyReference.cache index f22a618..c92b390 100644 Binary files a/backend/Application/obj/Debug/net8.0/Application.csproj.AssemblyReference.cache and b/backend/Application/obj/Debug/net8.0/Application.csproj.AssemblyReference.cache differ diff --git a/backend/Application/obj/Debug/net8.0/Application.csproj.CoreCompileInputs.cache b/backend/Application/obj/Debug/net8.0/Application.csproj.CoreCompileInputs.cache index 8ed19f2..cc003b2 100644 --- a/backend/Application/obj/Debug/net8.0/Application.csproj.CoreCompileInputs.cache +++ b/backend/Application/obj/Debug/net8.0/Application.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -e62e961dcbbbdb298dbb177e9f1605ac5651cf25ce346fbf2dad3942dc43b387 +a687c08ad227adac30cf205db23b335cafe12531e9fb53842e695d4fe5f9879a diff --git a/backend/Application/obj/Debug/net8.0/Application.csproj.FileListAbsolute.txt b/backend/Application/obj/Debug/net8.0/Application.csproj.FileListAbsolute.txt index fa8f367..d3501c5 100644 --- a/backend/Application/obj/Debug/net8.0/Application.csproj.FileListAbsolute.txt +++ b/backend/Application/obj/Debug/net8.0/Application.csproj.FileListAbsolute.txt @@ -11,3 +11,6 @@ C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\obj\D C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\obj\Debug\net8.0\refint\Application.dll C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\obj\Debug\net8.0\Application.pdb C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\obj\Debug\net8.0\ref\Application.dll +C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\bin\Debug\net8.0\Core.dll +C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\bin\Debug\net8.0\Core.pdb +C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\Application\obj\Debug\net8.0\Applicat.44B5EDA2.Up2Date diff --git a/backend/Application/obj/Debug/net8.0/Application.dll b/backend/Application/obj/Debug/net8.0/Application.dll index 3847881..bed3154 100644 Binary files a/backend/Application/obj/Debug/net8.0/Application.dll and b/backend/Application/obj/Debug/net8.0/Application.dll differ diff --git a/backend/Application/obj/Debug/net8.0/Application.pdb b/backend/Application/obj/Debug/net8.0/Application.pdb index 140769a..81cca86 100644 Binary files a/backend/Application/obj/Debug/net8.0/Application.pdb and b/backend/Application/obj/Debug/net8.0/Application.pdb differ diff --git a/backend/Application/obj/Debug/net8.0/Application.sourcelink.json b/backend/Application/obj/Debug/net8.0/Application.sourcelink.json index 4f61ed8..e351cc3 100644 --- a/backend/Application/obj/Debug/net8.0/Application.sourcelink.json +++ b/backend/Application/obj/Debug/net8.0/Application.sourcelink.json @@ -1 +1 @@ -{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/1206db932183801caeaefeb110af24b0147366c1/*"}} \ No newline at end of file +{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/2ccec617a59a712428e67340dc46bebefb152aca/*"}} \ No newline at end of file diff --git a/backend/Application/obj/Debug/net8.0/ref/Application.dll b/backend/Application/obj/Debug/net8.0/ref/Application.dll index a931374..df0cc13 100644 Binary files a/backend/Application/obj/Debug/net8.0/ref/Application.dll and b/backend/Application/obj/Debug/net8.0/ref/Application.dll differ diff --git a/backend/Application/obj/Debug/net8.0/refint/Application.dll b/backend/Application/obj/Debug/net8.0/refint/Application.dll index a931374..df0cc13 100644 Binary files a/backend/Application/obj/Debug/net8.0/refint/Application.dll and b/backend/Application/obj/Debug/net8.0/refint/Application.dll differ diff --git a/backend/Application/obj/project.assets.json b/backend/Application/obj/project.assets.json index 998f831..52cd1ba 100644 --- a/backend/Application/obj/project.assets.json +++ b/backend/Application/obj/project.assets.json @@ -2,6 +2,51 @@ "version": 3, "targets": { "net8.0": { + "AWSSDK.Core/3.7.100.14": { + "type": "package", + "compile": { + "lib/netcoreapp3.1/AWSSDK.Core.dll": { + "related": ".pdb;.xml" + } + }, + "runtime": { + "lib/netcoreapp3.1/AWSSDK.Core.dll": { + "related": ".pdb;.xml" + } + } + }, + "AWSSDK.SecurityToken/3.7.100.14": { + "type": "package", + "dependencies": { + "AWSSDK.Core": "[3.7.100.14, 4.0.0)" + }, + "compile": { + "lib/netcoreapp3.1/AWSSDK.SecurityToken.dll": { + "related": ".pdb;.xml" + } + }, + "runtime": { + "lib/netcoreapp3.1/AWSSDK.SecurityToken.dll": { + "related": ".pdb;.xml" + } + } + }, + "DnsClient/1.6.1": { + "type": "package", + "dependencies": { + "Microsoft.Win32.Registry": "5.0.0" + }, + "compile": { + "lib/net5.0/DnsClient.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net5.0/DnsClient.dll": { + "related": ".xml" + } + } + }, "FluentValidation/11.9.0": { "type": "package", "compile": { @@ -14,10 +59,345 @@ "related": ".xml" } } + }, + "Microsoft.Extensions.Logging.Abstractions/2.0.0": { + "type": "package", + "compile": { + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": { + "related": ".xml" + } + } + }, + "Microsoft.NETCore.Platforms/5.0.0": { + "type": "package", + "compile": { + "lib/netstandard1.0/_._": {} + }, + "runtime": { + "lib/netstandard1.0/_._": {} + } + }, + "Microsoft.Win32.Registry/5.0.0": { + "type": "package", + "dependencies": { + "System.Security.AccessControl": "5.0.0", + "System.Security.Principal.Windows": "5.0.0" + }, + "compile": { + "ref/netstandard2.0/Microsoft.Win32.Registry.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Win32.Registry.dll": { + "related": ".xml" + } + }, + "runtimeTargets": { + "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "MongoDB.Bson/2.24.0": { + "type": "package", + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "5.0.0" + }, + "compile": { + "lib/netstandard2.1/MongoDB.Bson.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Bson.dll": { + "related": ".xml" + } + } + }, + "MongoDB.Driver/2.24.0": { + "type": "package", + "dependencies": { + "Microsoft.Extensions.Logging.Abstractions": "2.0.0", + "MongoDB.Bson": "2.24.0", + "MongoDB.Driver.Core": "2.24.0", + "MongoDB.Libmongocrypt": "1.8.2" + }, + "compile": { + "lib/netstandard2.1/MongoDB.Driver.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Driver.dll": { + "related": ".xml" + } + } + }, + "MongoDB.Driver.Core/2.24.0": { + "type": "package", + "dependencies": { + "AWSSDK.SecurityToken": "3.7.100.14", + "DnsClient": "1.6.1", + "Microsoft.Extensions.Logging.Abstractions": "2.0.0", + "MongoDB.Bson": "2.24.0", + "MongoDB.Libmongocrypt": "1.8.2", + "SharpCompress": "0.30.1", + "Snappier": "1.0.0", + "System.Buffers": "4.5.1", + "ZstdSharp.Port": "0.7.3" + }, + "compile": { + "lib/netstandard2.1/MongoDB.Driver.Core.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Driver.Core.dll": { + "related": ".xml" + } + } + }, + "MongoDB.Libmongocrypt/1.8.2": { + "type": "package", + "compile": { + "lib/netstandard2.1/MongoDB.Libmongocrypt.dll": {} + }, + "runtime": { + "lib/netstandard2.1/MongoDB.Libmongocrypt.dll": {} + }, + "contentFiles": { + "contentFiles/any/any/_._": { + "buildAction": "None", + "codeLanguage": "any", + "copyToOutput": false + } + }, + "build": { + "build/_._": {} + }, + "runtimeTargets": { + "runtimes/linux/native/libmongocrypt.so": { + "assetType": "native", + "rid": "linux" + }, + "runtimes/osx/native/libmongocrypt.dylib": { + "assetType": "native", + "rid": "osx" + }, + "runtimes/win/native/mongocrypt.dll": { + "assetType": "native", + "rid": "win" + } + } + }, + "SharpCompress/0.30.1": { + "type": "package", + "compile": { + "lib/net5.0/SharpCompress.dll": {} + }, + "runtime": { + "lib/net5.0/SharpCompress.dll": {} + } + }, + "Snappier/1.0.0": { + "type": "package", + "compile": { + "lib/net5.0/Snappier.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/net5.0/Snappier.dll": { + "related": ".xml" + } + } + }, + "System.Buffers/4.5.1": { + "type": "package", + "compile": { + "ref/netcoreapp2.0/_._": {} + }, + "runtime": { + "lib/netcoreapp2.0/_._": {} + } + }, + "System.Memory/4.5.5": { + "type": "package", + "compile": { + "ref/netcoreapp2.1/_._": {} + }, + "runtime": { + "lib/netcoreapp2.1/_._": {} + } + }, + "System.Runtime.CompilerServices.Unsafe/5.0.0": { + "type": "package", + "compile": { + "ref/netstandard2.1/System.Runtime.CompilerServices.Unsafe.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "related": ".xml" + } + } + }, + "System.Security.AccessControl/5.0.0": { + "type": "package", + "dependencies": { + "Microsoft.NETCore.Platforms": "5.0.0", + "System.Security.Principal.Windows": "5.0.0" + }, + "compile": { + "ref/netstandard2.0/System.Security.AccessControl.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.0/System.Security.AccessControl.dll": { + "related": ".xml" + } + }, + "runtimeTargets": { + "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "System.Security.Principal.Windows/5.0.0": { + "type": "package", + "compile": { + "ref/netcoreapp3.0/System.Security.Principal.Windows.dll": { + "related": ".xml" + } + }, + "runtime": { + "lib/netstandard2.0/System.Security.Principal.Windows.dll": { + "related": ".xml" + } + }, + "runtimeTargets": { + "runtimes/unix/lib/netcoreapp2.1/System.Security.Principal.Windows.dll": { + "assetType": "runtime", + "rid": "unix" + }, + "runtimes/win/lib/netcoreapp2.1/System.Security.Principal.Windows.dll": { + "assetType": "runtime", + "rid": "win" + } + } + }, + "ZstdSharp.Port/0.7.3": { + "type": "package", + "compile": { + "lib/net7.0/ZstdSharp.dll": {} + }, + "runtime": { + "lib/net7.0/ZstdSharp.dll": {} + } + }, + "Core/1.0.0": { + "type": "project", + "framework": ".NETCoreApp,Version=v8.0", + "dependencies": { + "MongoDB.Bson": "2.24.0" + }, + "compile": { + "bin/placeholder/Core.dll": {} + }, + "runtime": { + "bin/placeholder/Core.dll": {} + } } } }, "libraries": { + "AWSSDK.Core/3.7.100.14": { + "sha512": "gnEgxBlk4PFEfdPE8Lkf4+D16MZFYSaW7/o6Wwe5e035QWUkTJX0Dn4LfTCdV5QSEL/fOFxu+yCAm55eIIBgog==", + "type": "package", + "path": "awssdk.core/3.7.100.14", + "hasTools": true, + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "awssdk.core.3.7.100.14.nupkg.sha512", + "awssdk.core.nuspec", + "lib/net35/AWSSDK.Core.dll", + "lib/net35/AWSSDK.Core.pdb", + "lib/net35/AWSSDK.Core.xml", + "lib/net45/AWSSDK.Core.dll", + "lib/net45/AWSSDK.Core.pdb", + "lib/net45/AWSSDK.Core.xml", + "lib/netcoreapp3.1/AWSSDK.Core.dll", + "lib/netcoreapp3.1/AWSSDK.Core.pdb", + "lib/netcoreapp3.1/AWSSDK.Core.xml", + "lib/netstandard2.0/AWSSDK.Core.dll", + "lib/netstandard2.0/AWSSDK.Core.pdb", + "lib/netstandard2.0/AWSSDK.Core.xml", + "tools/account-management.ps1" + ] + }, + "AWSSDK.SecurityToken/3.7.100.14": { + "sha512": "dGCVuVo0CFUKWW85W8YENO+aREf8sCBDjvGbnNvxJuNW4Ss+brEU9ltHhq2KfZze2VUNK1/wygbPG1bmbpyXEw==", + "type": "package", + "path": "awssdk.securitytoken/3.7.100.14", + "hasTools": true, + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "analyzers/dotnet/cs/AWSSDK.SecurityToken.CodeAnalysis.dll", + "awssdk.securitytoken.3.7.100.14.nupkg.sha512", + "awssdk.securitytoken.nuspec", + "lib/net35/AWSSDK.SecurityToken.dll", + "lib/net35/AWSSDK.SecurityToken.pdb", + "lib/net35/AWSSDK.SecurityToken.xml", + "lib/net45/AWSSDK.SecurityToken.dll", + "lib/net45/AWSSDK.SecurityToken.pdb", + "lib/net45/AWSSDK.SecurityToken.xml", + "lib/netcoreapp3.1/AWSSDK.SecurityToken.dll", + "lib/netcoreapp3.1/AWSSDK.SecurityToken.pdb", + "lib/netcoreapp3.1/AWSSDK.SecurityToken.xml", + "lib/netstandard2.0/AWSSDK.SecurityToken.dll", + "lib/netstandard2.0/AWSSDK.SecurityToken.pdb", + "lib/netstandard2.0/AWSSDK.SecurityToken.xml", + "tools/install.ps1", + "tools/uninstall.ps1" + ] + }, + "DnsClient/1.6.1": { + "sha512": "4H/f2uYJOZ+YObZjpY9ABrKZI+JNw3uizp6oMzTXwDw6F+2qIPhpRl/1t68O/6e98+vqNiYGu+lswmwdYUy3gg==", + "type": "package", + "path": "dnsclient/1.6.1", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "dnsclient.1.6.1.nupkg.sha512", + "dnsclient.nuspec", + "icon.png", + "lib/net45/DnsClient.dll", + "lib/net45/DnsClient.xml", + "lib/net471/DnsClient.dll", + "lib/net471/DnsClient.xml", + "lib/net5.0/DnsClient.dll", + "lib/net5.0/DnsClient.xml", + "lib/netstandard1.3/DnsClient.dll", + "lib/netstandard1.3/DnsClient.xml", + "lib/netstandard2.0/DnsClient.dll", + "lib/netstandard2.0/DnsClient.xml", + "lib/netstandard2.1/DnsClient.dll", + "lib/netstandard2.1/DnsClient.xml" + ] + }, "FluentValidation/11.9.0": { "sha512": "VneVlTvwYDkfHV5av3QrQ0amALgrLX6LV94wlYyEsh0B/klJBW7C8y2eAtj5tOZ3jH6CAVpr4s1ZGgew/QWyig==", "type": "package", @@ -42,11 +422,420 @@ "lib/netstandard2.1/FluentValidation.dll", "lib/netstandard2.1/FluentValidation.xml" ] + }, + "Microsoft.Extensions.Logging.Abstractions/2.0.0": { + "sha512": "6ZCllUYGFukkymSTx3Yr0G/ajRxoNJp7/FqSxSB4fGISST54ifBhgu4Nc0ItGi3i6DqwuNd8SUyObmiC++AO2Q==", + "type": "package", + "path": "microsoft.extensions.logging.abstractions/2.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll", + "lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.xml", + "microsoft.extensions.logging.abstractions.2.0.0.nupkg.sha512", + "microsoft.extensions.logging.abstractions.nuspec" + ] + }, + "Microsoft.NETCore.Platforms/5.0.0": { + "sha512": "VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ==", + "type": "package", + "path": "microsoft.netcore.platforms/5.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/netstandard1.0/_._", + "microsoft.netcore.platforms.5.0.0.nupkg.sha512", + "microsoft.netcore.platforms.nuspec", + "runtime.json", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "Microsoft.Win32.Registry/5.0.0": { + "sha512": "dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==", + "type": "package", + "path": "microsoft.win32.registry/5.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net46/Microsoft.Win32.Registry.dll", + "lib/net461/Microsoft.Win32.Registry.dll", + "lib/net461/Microsoft.Win32.Registry.xml", + "lib/netstandard1.3/Microsoft.Win32.Registry.dll", + "lib/netstandard2.0/Microsoft.Win32.Registry.dll", + "lib/netstandard2.0/Microsoft.Win32.Registry.xml", + "microsoft.win32.registry.5.0.0.nupkg.sha512", + "microsoft.win32.registry.nuspec", + "ref/net46/Microsoft.Win32.Registry.dll", + "ref/net461/Microsoft.Win32.Registry.dll", + "ref/net461/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/Microsoft.Win32.Registry.dll", + "ref/netstandard1.3/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/de/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/es/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/fr/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/it/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/ja/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/ko/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/ru/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/zh-hans/Microsoft.Win32.Registry.xml", + "ref/netstandard1.3/zh-hant/Microsoft.Win32.Registry.xml", + "ref/netstandard2.0/Microsoft.Win32.Registry.dll", + "ref/netstandard2.0/Microsoft.Win32.Registry.xml", + "runtimes/win/lib/net46/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/net461/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/net461/Microsoft.Win32.Registry.xml", + "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll", + "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.xml", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "MongoDB.Bson/2.24.0": { + "sha512": "n8CWaA4iTuoEQYv0+FSKNTX/hJozFQa5EgSILVNPhTGHcrbABHhpVrT1NwRRAAS6sUb8ZyhHmLPBa88LJemptA==", + "type": "package", + "path": "mongodb.bson/2.24.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.md", + "lib/net472/MongoDB.Bson.dll", + "lib/net472/MongoDB.Bson.xml", + "lib/netstandard2.0/MongoDB.Bson.dll", + "lib/netstandard2.0/MongoDB.Bson.xml", + "lib/netstandard2.1/MongoDB.Bson.dll", + "lib/netstandard2.1/MongoDB.Bson.xml", + "mongodb.bson.2.24.0.nupkg.sha512", + "mongodb.bson.nuspec", + "packageIcon.png" + ] + }, + "MongoDB.Driver/2.24.0": { + "sha512": "j1q11iMk3LN38ze6jgV1ATp+WKVVQbsGrhFkuOcHwRNtIk70TpLKjOD1Z3CCkyrzxCsUyhwk745tK2ASNOI4WA==", + "type": "package", + "path": "mongodb.driver/2.24.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.md", + "lib/net472/MongoDB.Driver.dll", + "lib/net472/MongoDB.Driver.xml", + "lib/netstandard2.0/MongoDB.Driver.dll", + "lib/netstandard2.0/MongoDB.Driver.xml", + "lib/netstandard2.1/MongoDB.Driver.dll", + "lib/netstandard2.1/MongoDB.Driver.xml", + "mongodb.driver.2.24.0.nupkg.sha512", + "mongodb.driver.nuspec", + "packageIcon.png" + ] + }, + "MongoDB.Driver.Core/2.24.0": { + "sha512": "UW0yadpMPi9+MtLHy6onpol3D9tXMRg61P0ROnij+h35EOr0vt/nxvlPrDcUjl3SvttvpsEXQKxb2lQShBA1dA==", + "type": "package", + "path": "mongodb.driver.core/2.24.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.md", + "THIRD-PARTY-NOTICES", + "lib/net472/MongoDB.Driver.Core.dll", + "lib/net472/MongoDB.Driver.Core.xml", + "lib/netstandard2.0/MongoDB.Driver.Core.dll", + "lib/netstandard2.0/MongoDB.Driver.Core.xml", + "lib/netstandard2.1/MongoDB.Driver.Core.dll", + "lib/netstandard2.1/MongoDB.Driver.Core.xml", + "mongodb.driver.core.2.24.0.nupkg.sha512", + "mongodb.driver.core.nuspec", + "packageIcon.png" + ] + }, + "MongoDB.Libmongocrypt/1.8.2": { + "sha512": "z/8JCULSHM1+mzkau0ivIkU9kIn8JEFFSkmYTSaMaWMMHt96JjUtMKuXxeGNGSnHZ5290ZPKIlQfjoWFk2sKog==", + "type": "package", + "path": "mongodb.libmongocrypt/1.8.2", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "License.txt", + "build/MongoDB.Libmongocrypt.targets", + "content/libmongocrypt.dylib", + "content/libmongocrypt.so", + "content/mongocrypt.dll", + "contentFiles/any/netstandard2.0/libmongocrypt.dylib", + "contentFiles/any/netstandard2.0/libmongocrypt.so", + "contentFiles/any/netstandard2.0/mongocrypt.dll", + "contentFiles/any/netstandard2.1/libmongocrypt.dylib", + "contentFiles/any/netstandard2.1/libmongocrypt.so", + "contentFiles/any/netstandard2.1/mongocrypt.dll", + "lib/netstandard2.0/MongoDB.Libmongocrypt.dll", + "lib/netstandard2.1/MongoDB.Libmongocrypt.dll", + "mongodb.libmongocrypt.1.8.2.nupkg.sha512", + "mongodb.libmongocrypt.nuspec", + "runtimes/linux/native/libmongocrypt.so", + "runtimes/osx/native/libmongocrypt.dylib", + "runtimes/win/native/mongocrypt.dll" + ] + }, + "SharpCompress/0.30.1": { + "sha512": "XqD4TpfyYGa7QTPzaGlMVbcecKnXy4YmYLDWrU+JIj7IuRNl7DH2END+Ll7ekWIY8o3dAMWLFDE1xdhfIWD1nw==", + "type": "package", + "path": "sharpcompress/0.30.1", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net461/SharpCompress.dll", + "lib/net5.0/SharpCompress.dll", + "lib/netcoreapp3.1/SharpCompress.dll", + "lib/netstandard2.0/SharpCompress.dll", + "lib/netstandard2.1/SharpCompress.dll", + "sharpcompress.0.30.1.nupkg.sha512", + "sharpcompress.nuspec" + ] + }, + "Snappier/1.0.0": { + "sha512": "rFtK2KEI9hIe8gtx3a0YDXdHOpedIf9wYCEYtBEmtlyiWVX3XlCNV03JrmmAi/Cdfn7dxK+k0sjjcLv4fpHnqA==", + "type": "package", + "path": "snappier/1.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "COPYING.txt", + "lib/net5.0/Snappier.dll", + "lib/net5.0/Snappier.xml", + "lib/netcoreapp3.0/Snappier.dll", + "lib/netcoreapp3.0/Snappier.xml", + "lib/netstandard2.0/Snappier.dll", + "lib/netstandard2.0/Snappier.xml", + "lib/netstandard2.1/Snappier.dll", + "lib/netstandard2.1/Snappier.xml", + "snappier.1.0.0.nupkg.sha512", + "snappier.nuspec" + ] + }, + "System.Buffers/4.5.1": { + "sha512": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "type": "package", + "path": "system.buffers/4.5.1", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net461/System.Buffers.dll", + "lib/net461/System.Buffers.xml", + "lib/netcoreapp2.0/_._", + "lib/netstandard1.1/System.Buffers.dll", + "lib/netstandard1.1/System.Buffers.xml", + "lib/netstandard2.0/System.Buffers.dll", + "lib/netstandard2.0/System.Buffers.xml", + "lib/uap10.0.16299/_._", + "ref/net45/System.Buffers.dll", + "ref/net45/System.Buffers.xml", + "ref/netcoreapp2.0/_._", + "ref/netstandard1.1/System.Buffers.dll", + "ref/netstandard1.1/System.Buffers.xml", + "ref/netstandard2.0/System.Buffers.dll", + "ref/netstandard2.0/System.Buffers.xml", + "ref/uap10.0.16299/_._", + "system.buffers.4.5.1.nupkg.sha512", + "system.buffers.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Memory/4.5.5": { + "sha512": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "type": "package", + "path": "system.memory/4.5.5", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net461/System.Memory.dll", + "lib/net461/System.Memory.xml", + "lib/netcoreapp2.1/_._", + "lib/netstandard1.1/System.Memory.dll", + "lib/netstandard1.1/System.Memory.xml", + "lib/netstandard2.0/System.Memory.dll", + "lib/netstandard2.0/System.Memory.xml", + "ref/netcoreapp2.1/_._", + "system.memory.4.5.5.nupkg.sha512", + "system.memory.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Runtime.CompilerServices.Unsafe/5.0.0": { + "sha512": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==", + "type": "package", + "path": "system.runtime.compilerservices.unsafe/5.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net45/System.Runtime.CompilerServices.Unsafe.dll", + "lib/net45/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/net461/System.Runtime.CompilerServices.Unsafe.dll", + "ref/net461/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard1.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", + "ref/netstandard2.1/System.Runtime.CompilerServices.Unsafe.dll", + "ref/netstandard2.1/System.Runtime.CompilerServices.Unsafe.xml", + "system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512", + "system.runtime.compilerservices.unsafe.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Security.AccessControl/5.0.0": { + "sha512": "dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==", + "type": "package", + "path": "system.security.accesscontrol/5.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net46/System.Security.AccessControl.dll", + "lib/net461/System.Security.AccessControl.dll", + "lib/net461/System.Security.AccessControl.xml", + "lib/netstandard1.3/System.Security.AccessControl.dll", + "lib/netstandard2.0/System.Security.AccessControl.dll", + "lib/netstandard2.0/System.Security.AccessControl.xml", + "lib/uap10.0.16299/_._", + "ref/net46/System.Security.AccessControl.dll", + "ref/net461/System.Security.AccessControl.dll", + "ref/net461/System.Security.AccessControl.xml", + "ref/netstandard1.3/System.Security.AccessControl.dll", + "ref/netstandard1.3/System.Security.AccessControl.xml", + "ref/netstandard1.3/de/System.Security.AccessControl.xml", + "ref/netstandard1.3/es/System.Security.AccessControl.xml", + "ref/netstandard1.3/fr/System.Security.AccessControl.xml", + "ref/netstandard1.3/it/System.Security.AccessControl.xml", + "ref/netstandard1.3/ja/System.Security.AccessControl.xml", + "ref/netstandard1.3/ko/System.Security.AccessControl.xml", + "ref/netstandard1.3/ru/System.Security.AccessControl.xml", + "ref/netstandard1.3/zh-hans/System.Security.AccessControl.xml", + "ref/netstandard1.3/zh-hant/System.Security.AccessControl.xml", + "ref/netstandard2.0/System.Security.AccessControl.dll", + "ref/netstandard2.0/System.Security.AccessControl.xml", + "ref/uap10.0.16299/_._", + "runtimes/win/lib/net46/System.Security.AccessControl.dll", + "runtimes/win/lib/net461/System.Security.AccessControl.dll", + "runtimes/win/lib/net461/System.Security.AccessControl.xml", + "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll", + "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.xml", + "runtimes/win/lib/netstandard1.3/System.Security.AccessControl.dll", + "runtimes/win/lib/uap10.0.16299/_._", + "system.security.accesscontrol.5.0.0.nupkg.sha512", + "system.security.accesscontrol.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "System.Security.Principal.Windows/5.0.0": { + "sha512": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA==", + "type": "package", + "path": "system.security.principal.windows/5.0.0", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "LICENSE.TXT", + "THIRD-PARTY-NOTICES.TXT", + "lib/net46/System.Security.Principal.Windows.dll", + "lib/net461/System.Security.Principal.Windows.dll", + "lib/net461/System.Security.Principal.Windows.xml", + "lib/netstandard1.3/System.Security.Principal.Windows.dll", + "lib/netstandard2.0/System.Security.Principal.Windows.dll", + "lib/netstandard2.0/System.Security.Principal.Windows.xml", + "lib/uap10.0.16299/_._", + "ref/net46/System.Security.Principal.Windows.dll", + "ref/net461/System.Security.Principal.Windows.dll", + "ref/net461/System.Security.Principal.Windows.xml", + "ref/netcoreapp3.0/System.Security.Principal.Windows.dll", + "ref/netcoreapp3.0/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/System.Security.Principal.Windows.dll", + "ref/netstandard1.3/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/de/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/es/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/fr/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/it/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/ja/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/ko/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/ru/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/zh-hans/System.Security.Principal.Windows.xml", + "ref/netstandard1.3/zh-hant/System.Security.Principal.Windows.xml", + "ref/netstandard2.0/System.Security.Principal.Windows.dll", + "ref/netstandard2.0/System.Security.Principal.Windows.xml", + "ref/uap10.0.16299/_._", + "runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.dll", + "runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.xml", + "runtimes/unix/lib/netcoreapp2.1/System.Security.Principal.Windows.dll", + "runtimes/unix/lib/netcoreapp2.1/System.Security.Principal.Windows.xml", + "runtimes/win/lib/net46/System.Security.Principal.Windows.dll", + "runtimes/win/lib/net461/System.Security.Principal.Windows.dll", + "runtimes/win/lib/net461/System.Security.Principal.Windows.xml", + "runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.dll", + "runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.xml", + "runtimes/win/lib/netcoreapp2.1/System.Security.Principal.Windows.dll", + "runtimes/win/lib/netcoreapp2.1/System.Security.Principal.Windows.xml", + "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll", + "runtimes/win/lib/uap10.0.16299/_._", + "system.security.principal.windows.5.0.0.nupkg.sha512", + "system.security.principal.windows.nuspec", + "useSharedDesignerContext.txt", + "version.txt" + ] + }, + "ZstdSharp.Port/0.7.3": { + "sha512": "U9Ix4l4cl58Kzz1rJzj5hoVTjmbx1qGMwzAcbv1j/d3NzrFaESIurQyg+ow4mivCgkE3S413y+U9k4WdnEIkRA==", + "type": "package", + "path": "zstdsharp.port/0.7.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/net461/ZstdSharp.dll", + "lib/net5.0/ZstdSharp.dll", + "lib/net6.0/ZstdSharp.dll", + "lib/net7.0/ZstdSharp.dll", + "lib/netcoreapp3.1/ZstdSharp.dll", + "lib/netstandard2.0/ZstdSharp.dll", + "lib/netstandard2.1/ZstdSharp.dll", + "zstdsharp.port.0.7.3.nupkg.sha512", + "zstdsharp.port.nuspec" + ] + }, + "Core/1.0.0": { + "type": "project", + "path": "../Core/Core.csproj", + "msbuildProject": "../Core/Core.csproj" } }, "projectFileDependencyGroups": { "net8.0": [ - "FluentValidation >= 11.9.0" + "Core >= 1.0.0", + "FluentValidation >= 11.9.0", + "MongoDB.Driver >= 2.24.0" ] }, "packageFolders": { @@ -75,7 +864,11 @@ "frameworks": { "net8.0": { "targetAlias": "net8.0", - "projectReferences": {} + "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": { @@ -91,6 +884,10 @@ "FluentValidation": { "target": "Package", "version": "[11.9.0, )" + }, + "MongoDB.Driver": { + "target": "Package", + "version": "[2.24.0, )" } }, "imports": [ diff --git a/backend/Application/obj/project.nuget.cache b/backend/Application/obj/project.nuget.cache index b4c0cd1..45a4961 100644 --- a/backend/Application/obj/project.nuget.cache +++ b/backend/Application/obj/project.nuget.cache @@ -1,10 +1,28 @@ { "version": 2, - "dgSpecHash": "rXP/XUA+gLF1LTBUfSmBlxMD/+bElZevz4HhuOPqJr7XT51+UQo0tuIFLOzZm3UUOnov+euuXJTlbY1G6ppwiw==", + "dgSpecHash": "+8cvg1kefgWQCHZNz0UFBqaMFHCU9vs6eKiSXlImrLEp7SlxQgKE4onuOThyjCArZTaU+iPlTxlBKu/wIdbkNg==", "success": true, "projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Application\\Application.csproj", "expectedPackageFiles": [ - "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\fluentvalidation\\11.9.0\\fluentvalidation.11.9.0.nupkg.sha512" + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\awssdk.core\\3.7.100.14\\awssdk.core.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\\fluentvalidation\\11.9.0\\fluentvalidation.11.9.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\2.0.0\\microsoft.extensions.logging.abstractions.2.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.win32.registry\\5.0.0\\microsoft.win32.registry.5.0.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\mongodb.bson\\2.24.0\\mongodb.bson.2.24.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\mongodb.driver\\2.24.0\\mongodb.driver.2.24.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\mongodb.driver.core\\2.24.0\\mongodb.driver.core.2.24.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\mongodb.libmongocrypt\\1.8.2\\mongodb.libmongocrypt.1.8.2.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\sharpcompress\\0.30.1\\sharpcompress.0.30.1.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\snappier\\1.0.0\\snappier.1.0.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.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.security.accesscontrol\\5.0.0\\system.security.accesscontrol.5.0.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\system.security.principal.windows\\5.0.0\\system.security.principal.windows.5.0.0.nupkg.sha512", + "C:\\Users\\Andrei Cerbu\\.nuget\\packages\\zstdsharp.port\\0.7.3\\zstdsharp.port.0.7.3.nupkg.sha512" ], "logs": [] } \ No newline at end of file diff --git a/backend/Application/obj/project.packagespec.json b/backend/Application/obj/project.packagespec.json index 885cd61..24c2585 100644 --- a/backend/Application/obj/project.packagespec.json +++ b/backend/Application/obj/project.packagespec.json @@ -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":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"FluentValidation":{"target":"Package","version":"[11.9.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"}} \ No newline at end of file +"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"}} \ No newline at end of file diff --git a/backend/Application/obj/rider.project.restore.info b/backend/Application/obj/rider.project.restore.info index a5fa0d5..c6138a4 100644 --- a/backend/Application/obj/rider.project.restore.info +++ b/backend/Application/obj/rider.project.restore.info @@ -1 +1 @@ -17122552827049708 \ No newline at end of file +17125075151933320 \ No newline at end of file diff --git a/backend/Core/Core.csproj b/backend/Core/Core.csproj index 1e2e361..2e8b113 100644 --- a/backend/Core/Core.csproj +++ b/backend/Core/Core.csproj @@ -1,13 +1,13 @@  - - net8.0 - enable - enable - + + net8.0 + enable + enable + - - - + + + diff --git a/backend/Core/Entities/Chat.cs b/backend/Core/Entities/Chat.cs index 06e3528..f49a8b1 100644 --- a/backend/Core/Entities/Chat.cs +++ b/backend/Core/Entities/Chat.cs @@ -12,13 +12,12 @@ public class Chat public Guid PatientId { get; set; } public Guid DoctorId { get; set; } - public List Messages { get; set; } = new List(); + public List Messages { get; set; } = new(); } public class Message { - [BsonRepresentation(BsonType.String)] - public Guid UserId { get; set; } + [BsonRepresentation(BsonType.String)] public Guid UserId { get; set; } public string Content { get; set; } -} +} \ No newline at end of file diff --git a/backend/Core/Entities/Doctor.cs b/backend/Core/Entities/Doctor.cs index e987ff8..01e3c06 100644 --- a/backend/Core/Entities/Doctor.cs +++ b/backend/Core/Entities/Doctor.cs @@ -9,10 +9,35 @@ public class Doctor Id = Guid.NewGuid(); } - [Key] - public Guid Id { get; private set; } - public string? Name { get; set; } - public string? Email { get; set; } - public string? Password { get; set; } - public string? Description { get; set; } -} + [Key] public Guid Id { get; private set; } + + public string? Name { get; private set; } + public string? Email { get; private set; } + public string? Password { get; private set; } + public string? Description { get; private set; } + + public void SetId(Guid id) + { + Id = id; + } + + public void SetName(string name) + { + Name = name; + } + + public void SetEmail(string email) + { + Email = email; + } + + public void SetPassword(string password) + { + Password = password; + } + + public void SetDescription(string? description) + { + Description = description; + } +} \ No newline at end of file diff --git a/backend/Core/Entities/MedicalHistory.cs b/backend/Core/Entities/MedicalHistory.cs index 9d4946d..8b15237 100644 --- a/backend/Core/Entities/MedicalHistory.cs +++ b/backend/Core/Entities/MedicalHistory.cs @@ -9,8 +9,8 @@ public class MedicalHistory Id = Guid.NewGuid(); } - [Key] - public Guid Id { get; private set; } + [Key] public Guid Id { get; private set; } + public Guid UserId { get; set; } - public byte[] Description { get; set; } = []; -} + public byte[] Content { get; set; } = []; +} \ No newline at end of file diff --git a/backend/Core/Entities/Pacient.cs b/backend/Core/Entities/Pacient.cs deleted file mode 100644 index 8dbb814..0000000 --- a/backend/Core/Entities/Pacient.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Core.Entities; - -public class Pacient -{ - public Pacient() - { - Id = Guid.NewGuid(); - } - - [Key] - public Guid Id { get; private set; } - public string? Name { get; set; } - public string? Email { get; set; } - public string? Password { get; set; } -} diff --git a/backend/Core/Entities/Patient.cs b/backend/Core/Entities/Patient.cs new file mode 100644 index 0000000..87a99d0 --- /dev/null +++ b/backend/Core/Entities/Patient.cs @@ -0,0 +1,32 @@ +using System.ComponentModel.DataAnnotations; + +namespace Core.Entities; + +public class Patient +{ + public Patient() + { + Id = Guid.NewGuid(); + } + + [Key] public Guid Id { get; private set; } + + public string? Name { get; private set; } + public string? Email { get; private set; } + public string? Password { get; private set; } + + public void SetName(string name) + { + Name = name; + } + + public void SetEmail(string email) + { + Email = email; + } + + public void SetPassword(string password) + { + Password = password; + } +} \ No newline at end of file diff --git a/backend/Core/bin/Debug/net8.0/Core.dll b/backend/Core/bin/Debug/net8.0/Core.dll index 1de9e46..02b0d46 100644 Binary files a/backend/Core/bin/Debug/net8.0/Core.dll and b/backend/Core/bin/Debug/net8.0/Core.dll differ diff --git a/backend/Core/bin/Debug/net8.0/Core.pdb b/backend/Core/bin/Debug/net8.0/Core.pdb index f9e0e04..fafb776 100644 Binary files a/backend/Core/bin/Debug/net8.0/Core.pdb and b/backend/Core/bin/Debug/net8.0/Core.pdb differ diff --git a/backend/Core/obj/Debug/net8.0/Core.AssemblyInfo.cs b/backend/Core/obj/Debug/net8.0/Core.AssemblyInfo.cs index 71c03fa..041072b 100644 --- a/backend/Core/obj/Debug/net8.0/Core.AssemblyInfo.cs +++ b/backend/Core/obj/Debug/net8.0/Core.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Core")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1206db932183801caeaefeb110af24b0147366c1")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ccec617a59a712428e67340dc46bebefb152aca")] [assembly: System.Reflection.AssemblyProductAttribute("Core")] [assembly: System.Reflection.AssemblyTitleAttribute("Core")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/backend/Core/obj/Debug/net8.0/Core.AssemblyInfoInputs.cache b/backend/Core/obj/Debug/net8.0/Core.AssemblyInfoInputs.cache index 3abbc50..9e003ed 100644 --- a/backend/Core/obj/Debug/net8.0/Core.AssemblyInfoInputs.cache +++ b/backend/Core/obj/Debug/net8.0/Core.AssemblyInfoInputs.cache @@ -1 +1 @@ -fe502cc2dabe7d620b411277254bf1f11fc89ea26c1bc414fe1e6489b02a08aa +232a219588f79d4fe98faad4c868c44fc40b96e3f6b7bc8086f4447599f3e74e diff --git a/backend/Core/obj/Debug/net8.0/Core.csproj.CoreCompileInputs.cache b/backend/Core/obj/Debug/net8.0/Core.csproj.CoreCompileInputs.cache index 2119781..d0352f9 100644 --- a/backend/Core/obj/Debug/net8.0/Core.csproj.CoreCompileInputs.cache +++ b/backend/Core/obj/Debug/net8.0/Core.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -ce18ed28752b8cf8d61854f33f1330028b638a171d8232431635f317dd6d517c +481a6e81c3fb29f18f770ac0db64e6d4af0d1f426e06832b919c28802ccff560 diff --git a/backend/Core/obj/Debug/net8.0/Core.dll b/backend/Core/obj/Debug/net8.0/Core.dll index 1de9e46..02b0d46 100644 Binary files a/backend/Core/obj/Debug/net8.0/Core.dll and b/backend/Core/obj/Debug/net8.0/Core.dll differ diff --git a/backend/Core/obj/Debug/net8.0/Core.pdb b/backend/Core/obj/Debug/net8.0/Core.pdb index f9e0e04..fafb776 100644 Binary files a/backend/Core/obj/Debug/net8.0/Core.pdb and b/backend/Core/obj/Debug/net8.0/Core.pdb differ diff --git a/backend/Core/obj/Debug/net8.0/Core.sourcelink.json b/backend/Core/obj/Debug/net8.0/Core.sourcelink.json index 4f61ed8..e351cc3 100644 --- a/backend/Core/obj/Debug/net8.0/Core.sourcelink.json +++ b/backend/Core/obj/Debug/net8.0/Core.sourcelink.json @@ -1 +1 @@ -{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/1206db932183801caeaefeb110af24b0147366c1/*"}} \ No newline at end of file +{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/2ccec617a59a712428e67340dc46bebefb152aca/*"}} \ No newline at end of file diff --git a/backend/Core/obj/Debug/net8.0/ref/Core.dll b/backend/Core/obj/Debug/net8.0/ref/Core.dll index 5f21501..57e2a13 100644 Binary files a/backend/Core/obj/Debug/net8.0/ref/Core.dll and b/backend/Core/obj/Debug/net8.0/ref/Core.dll differ diff --git a/backend/Core/obj/Debug/net8.0/refint/Core.dll b/backend/Core/obj/Debug/net8.0/refint/Core.dll index 5f21501..57e2a13 100644 Binary files a/backend/Core/obj/Debug/net8.0/refint/Core.dll and b/backend/Core/obj/Debug/net8.0/refint/Core.dll differ diff --git a/backend/Core/obj/rider.project.restore.info b/backend/Core/obj/rider.project.restore.info index f1b88e0..3b72989 100644 --- a/backend/Core/obj/rider.project.restore.info +++ b/backend/Core/obj/rider.project.restore.info @@ -1 +1 @@ -17122552827080702 \ No newline at end of file +17125075151943813 \ No newline at end of file diff --git a/backend/Infrastructure/DesignTimeDbContextFactory.cs b/backend/Infrastructure/DesignTimeDbContextFactory.cs index 729c6cc..c6050b0 100644 --- a/backend/Infrastructure/DesignTimeDbContextFactory.cs +++ b/backend/Infrastructure/DesignTimeDbContextFactory.cs @@ -2,7 +2,6 @@ using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.Configuration; - namespace Infrastructure.Data; public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory @@ -12,7 +11,7 @@ public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory options) : base(options) { } + public HealthcareManagerDatabase(DbContextOptions options) : base(options) + { + } - public DbSet Pacients { get; set; } + public DbSet Pacients { get; set; } public DbSet MedicalHistories { get; set; } public DbSet Doctors { get; set; } @@ -15,4 +17,4 @@ public class HealthcareManagerDatabase : DbContext { base.OnModelCreating(modelBuilder); } -} +} \ No newline at end of file diff --git a/backend/Infrastructure/Infrastructure.csproj b/backend/Infrastructure/Infrastructure.csproj index 90944bb..6b60d16 100644 --- a/backend/Infrastructure/Infrastructure.csproj +++ b/backend/Infrastructure/Infrastructure.csproj @@ -1,28 +1,28 @@  - - net8.0 - enable - enable - + + net8.0 + enable + enable + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + - - - - + + + + diff --git a/backend/Infrastructure/InfrastructureDI.cs b/backend/Infrastructure/InfrastructureDI.cs index c29feb6..440940c 100644 --- a/backend/Infrastructure/InfrastructureDI.cs +++ b/backend/Infrastructure/InfrastructureDI.cs @@ -1,32 +1,37 @@ -using Microsoft.EntityFrameworkCore; +using Application.Services.Database; +using Application.Services.HashingAlgorithms; +using Infrastructure.Data; +using Infrastructure.Services.HashingAlgorithms; +using Infrastructure.Services.MongoDB; +using Infrastructure.Services.PostgreSQL; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Infrastructure.Data; -using Infrastructure.Services.MongoDB; -using Application.Services.Database; -using Infrastructure.Services.PostgreSQL; - namespace Infrastructure; public static class DependencyInjection { - public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration) + public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, + IConfiguration configuration) { services.AddDbContext(options => options.UseNpgsql(configuration.GetConnectionString("HealthcareManagerDatabase"))); - - services.AddScoped(); + //PostgreSQL Services + services.AddScoped(); services.AddScoped(); services.AddScoped(); + // MongoDB Service var mongoDbConnection = configuration.GetConnectionString("MongoDBDatabase"); + services.AddSingleton(serviceProvider => new MongoDbService(mongoDbConnection)); - services.AddSingleton(serviceProvider => new MongoDbService(mongoDbConnection)); + // Other Services + services.AddScoped(); // services.AddScoped(); return services; } -} +} \ No newline at end of file diff --git a/backend/Infrastructure/MongoDBServices.cs b/backend/Infrastructure/MongoDBServices.cs deleted file mode 100644 index a96ccde..0000000 --- a/backend/Infrastructure/MongoDBServices.cs +++ /dev/null @@ -1,36 +0,0 @@ -using MongoDB.Driver; - -namespace Infrastructure.Services.MongoDB -{ - public class MongoDbService - { - private readonly IMongoDatabase _database; - - public MongoDbService(string connectionString) - { - var url = new MongoUrl(connectionString); - var client = new MongoClient(url); - _database = client.GetDatabase(url.DatabaseName); - } - - public IMongoCollection GetCollection(string collectionName) - { - return _database.GetCollection(collectionName); - } - - public async Task> FindAsync(string collectionName, List<(string FieldName, string Value)> criteria) - { - var collection = _database.GetCollection(collectionName); - - var filters = new List>(); - foreach (var (FieldName, Value) in criteria) - { - filters.Add(Builders.Filter.Eq(FieldName, Value)); - } - - var combinedFilter = Builders.Filter.And(filters); - - return await collection.Find(combinedFilter).ToListAsync(); - } - } -} diff --git a/backend/Infrastructure/Services/HashingAlgorithms/HashingAlgorithms.cs b/backend/Infrastructure/Services/HashingAlgorithms/HashingAlgorithms.cs new file mode 100644 index 0000000..d610eb3 --- /dev/null +++ b/backend/Infrastructure/Services/HashingAlgorithms/HashingAlgorithms.cs @@ -0,0 +1,19 @@ +using System.Security.Cryptography; +using System.Text; +using Application.Services.HashingAlgorithms; + +namespace Infrastructure.Services.HashingAlgorithms; + +public class HashingAlgorithms : IHashingAlgorithms +{ + public string? SHA256Algorithm(string? password) + { + if (password == null) return null; + + using (var sha256 = SHA256.Create()) + { + var bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(password)); + return Convert.ToBase64String(bytes); + } + } +} \ No newline at end of file diff --git a/backend/Infrastructure/Services/MongoDB/MongoDBServices.cs b/backend/Infrastructure/Services/MongoDB/MongoDBServices.cs new file mode 100644 index 0000000..633f2b9 --- /dev/null +++ b/backend/Infrastructure/Services/MongoDB/MongoDBServices.cs @@ -0,0 +1,53 @@ +using Application.Services.Database; +using MongoDB.Driver; + +namespace Infrastructure.Services.MongoDB; + +public class MongoDbService : IMongoDbService +{ + private readonly IMongoDatabase _database; + + public MongoDbService(string connectionString) + { + var url = new MongoUrl(connectionString); + var client = new MongoClient(url); + _database = client.GetDatabase(url.DatabaseName); + } + + public IMongoCollection GetCollection(string collectionName) + { + return _database.GetCollection(collectionName); + } + + public async Task> FindAsync(string collectionName, List<(string FieldName, string Value)> criteria) + { + var collection = _database.GetCollection(collectionName); + + var filters = new List>(); + foreach (var (FieldName, Value) in criteria) filters.Add(Builders.Filter.Eq(FieldName, Value)); + + var combinedFilter = Builders.Filter.And(filters); + + return await collection.Find(combinedFilter).ToListAsync(); + } + + public async Task AddAsync(string collectionName, T document) + { + var collection = _database.GetCollection(collectionName); + await collection.InsertOneAsync(document); + } + + public async Task ModifyAsync(string collectionName, string keyField, string keyValue, T document) + { + var collection = _database.GetCollection(collectionName); + var filter = Builders.Filter.Eq(keyField, keyValue); + await collection.ReplaceOneAsync(filter, document, new ReplaceOptions { IsUpsert = true }); + } + + public async Task DeleteAsync(string collectionName, string keyField, string keyValue) + { + var collection = _database.GetCollection(collectionName); + var filter = Builders.Filter.Eq(keyField, keyValue); + await collection.DeleteOneAsync(filter); + } +} \ No newline at end of file diff --git a/backend/Infrastructure/Services/PostgreSQL/BasePostgreSQLRepository.cs b/backend/Infrastructure/Services/PostgreSQL/BasePostgreSQLRepository.cs index fdd169f..d603b54 100644 --- a/backend/Infrastructure/Services/PostgreSQL/BasePostgreSQLRepository.cs +++ b/backend/Infrastructure/Services/PostgreSQL/BasePostgreSQLRepository.cs @@ -12,7 +12,7 @@ public class BasePostgreSQLRepository where T : class _context = context; } - public async Task GetByIdAsync(Guid id) + public async Task GetByIdAsync(Guid id) { return await _context.Set().FindAsync(id); } @@ -40,4 +40,4 @@ public class BasePostgreSQLRepository where T : class _context.Set().Remove(entity); await _context.SaveChangesAsync(); } -} +} \ No newline at end of file diff --git a/backend/Infrastructure/Services/PostgreSQL/DoctorRepository.cs b/backend/Infrastructure/Services/PostgreSQL/DoctorRepository.cs index 3d85cf7..7ae8122 100644 --- a/backend/Infrastructure/Services/PostgreSQL/DoctorRepository.cs +++ b/backend/Infrastructure/Services/PostgreSQL/DoctorRepository.cs @@ -5,8 +5,16 @@ using Microsoft.EntityFrameworkCore; namespace Infrastructure.Services.PostgreSQL; -public class DoctorRepository(HealthcareManagerDatabase context) : BasePostgreSQLRepository(context), IDoctorRepository +public class DoctorRepository(HealthcareManagerDatabase context) + : BasePostgreSQLRepository(context), IDoctorRepository { - public async Task FindByEmailAsync(string email) - => await _context.Doctors.FirstOrDefaultAsync(d => d.Email == email); -} + public async Task FindByEmailAsync(string email) + { + return await _context.Doctors.FirstOrDefaultAsync(d => d.Email == email); + } + + public async Task CredentialsMatch(string email, string password) + { + return _context.Doctors.Any(u => u.Email == email && u.Password == password); + } +} \ No newline at end of file diff --git a/backend/Infrastructure/Services/PostgreSQL/MedicalHistoryRepository.cs b/backend/Infrastructure/Services/PostgreSQL/MedicalHistoryRepository.cs index 44833f1..644e64a 100644 --- a/backend/Infrastructure/Services/PostgreSQL/MedicalHistoryRepository.cs +++ b/backend/Infrastructure/Services/PostgreSQL/MedicalHistoryRepository.cs @@ -12,6 +12,7 @@ public class MedicalHistoryRepository : BasePostgreSQLRepository } public async Task GetByUserIdAsync(Guid userId) - => await _context.MedicalHistories.FirstOrDefaultAsync(d => d.UserId == userId); - -} + { + return await _context.MedicalHistories.FirstOrDefaultAsync(d => d.UserId == userId); + } +} \ No newline at end of file diff --git a/backend/Infrastructure/Services/PostgreSQL/PacientRepository.cs b/backend/Infrastructure/Services/PostgreSQL/PacientRepository.cs deleted file mode 100644 index 65ba268..0000000 --- a/backend/Infrastructure/Services/PostgreSQL/PacientRepository.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Application.Services.Database; -using Core.Entities; -using Infrastructure.Data; -using Microsoft.EntityFrameworkCore; - -namespace Infrastructure.Services.PostgreSQL; - -public class PacientRepository(HealthcareManagerDatabase context) : BasePostgreSQLRepository(context), IPacientRepository -{ - public async Task FindByEmailAsync(string email) - => await _context.Pacients.FirstOrDefaultAsync(d => d.Email == email); -} diff --git a/backend/Infrastructure/Services/PostgreSQL/PatientRepository.cs b/backend/Infrastructure/Services/PostgreSQL/PatientRepository.cs new file mode 100644 index 0000000..b6c0bed --- /dev/null +++ b/backend/Infrastructure/Services/PostgreSQL/PatientRepository.cs @@ -0,0 +1,15 @@ +using Application.Services.Database; +using Core.Entities; +using Infrastructure.Data; +using Microsoft.EntityFrameworkCore; + +namespace Infrastructure.Services.PostgreSQL; + +public class PatientRepository(HealthcareManagerDatabase context) + : BasePostgreSQLRepository(context), IPatientRepository +{ + public async Task FindByEmailAsync(string email) + { + return await _context.Pacients.FirstOrDefaultAsync(d => d.Email == email); + } +} \ No newline at end of file diff --git a/backend/Infrastructure/bin/Debug/net8.0/Application.dll b/backend/Infrastructure/bin/Debug/net8.0/Application.dll index 3847881..bed3154 100644 Binary files a/backend/Infrastructure/bin/Debug/net8.0/Application.dll and b/backend/Infrastructure/bin/Debug/net8.0/Application.dll differ diff --git a/backend/Infrastructure/bin/Debug/net8.0/Application.pdb b/backend/Infrastructure/bin/Debug/net8.0/Application.pdb index 140769a..81cca86 100644 Binary files a/backend/Infrastructure/bin/Debug/net8.0/Application.pdb and b/backend/Infrastructure/bin/Debug/net8.0/Application.pdb differ diff --git a/backend/Infrastructure/bin/Debug/net8.0/Core.dll b/backend/Infrastructure/bin/Debug/net8.0/Core.dll index 1de9e46..02b0d46 100644 Binary files a/backend/Infrastructure/bin/Debug/net8.0/Core.dll and b/backend/Infrastructure/bin/Debug/net8.0/Core.dll differ diff --git a/backend/Infrastructure/bin/Debug/net8.0/Core.pdb b/backend/Infrastructure/bin/Debug/net8.0/Core.pdb index f9e0e04..fafb776 100644 Binary files a/backend/Infrastructure/bin/Debug/net8.0/Core.pdb and b/backend/Infrastructure/bin/Debug/net8.0/Core.pdb differ diff --git a/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.deps.json b/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.deps.json index 3d25267..6039032 100644 --- a/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.deps.json +++ b/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.deps.json @@ -12,6 +12,7 @@ "Core": "1.0.0", "Microsoft.EntityFrameworkCore": "8.0.3", "Microsoft.EntityFrameworkCore.Design": "8.0.3", + "Microsoft.EntityFrameworkCore.Relational": "8.0.3", "Microsoft.Extensions.Configuration": "8.0.0", "Microsoft.Extensions.Configuration.Json": "8.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0", @@ -806,7 +807,9 @@ }, "Application/1.0.0": { "dependencies": { - "FluentValidation": "11.9.0" + "Core": "1.0.0", + "FluentValidation": "11.9.0", + "MongoDB.Driver": "2.24.0" }, "runtime": { "Application.dll": {} diff --git a/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.dll b/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.dll index 4616341..8816b78 100644 Binary files a/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.dll and b/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.dll differ diff --git a/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.pdb b/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.pdb index 901d426..e5940d7 100644 Binary files a/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.pdb and b/backend/Infrastructure/bin/Debug/net8.0/Infrastructure.pdb differ diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfo.cs b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfo.cs index 6b8c9e8..03ef75b 100644 --- a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfo.cs +++ b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Infrastructure")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1206db932183801caeaefeb110af24b0147366c1")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ccec617a59a712428e67340dc46bebefb152aca")] [assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")] [assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfoInputs.cache b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfoInputs.cache index 49bb297..e24041d 100644 --- a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfoInputs.cache +++ b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.AssemblyInfoInputs.cache @@ -1 +1 @@ -ea468b679ae500ce31444c1c9d05c28c3066f2016f4f30d94e2abc7ebcedf3b9 +5c68101bdd997137e1cd8f3c58cb6d9e9b9d203289c90b0f6dca8b08cc72b5c9 diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.assets.cache b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.assets.cache index d70a05e..407305a 100644 Binary files a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.assets.cache and b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.assets.cache differ diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.AssemblyReference.cache b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.AssemblyReference.cache index 7191130..22bb3db 100644 Binary files a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.AssemblyReference.cache and b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.AssemblyReference.cache differ diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.CoreCompileInputs.cache b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.CoreCompileInputs.cache index 45bfe53..3d9c060 100644 --- a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.CoreCompileInputs.cache +++ b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -5afb3ed7d16a2df0400eb200d8278f7eab743b937793203fe737f90a0ba6f42f +8ecca766b80ccc6e510e107ea1369b5001c45e66e3507ff5e47c4d13fae048e4 diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.dll b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.dll index 4616341..8816b78 100644 Binary files a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.dll and b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.dll differ diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.pdb b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.pdb index 901d426..e5940d7 100644 Binary files a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.pdb and b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.pdb differ diff --git a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.sourcelink.json b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.sourcelink.json index 4f61ed8..e351cc3 100644 --- a/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.sourcelink.json +++ b/backend/Infrastructure/obj/Debug/net8.0/Infrastructure.sourcelink.json @@ -1 +1 @@ -{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/1206db932183801caeaefeb110af24b0147366c1/*"}} \ No newline at end of file +{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/2ccec617a59a712428e67340dc46bebefb152aca/*"}} \ No newline at end of file diff --git a/backend/Infrastructure/obj/Debug/net8.0/ref/Infrastructure.dll b/backend/Infrastructure/obj/Debug/net8.0/ref/Infrastructure.dll index e0747e0..3a85117 100644 Binary files a/backend/Infrastructure/obj/Debug/net8.0/ref/Infrastructure.dll and b/backend/Infrastructure/obj/Debug/net8.0/ref/Infrastructure.dll differ diff --git a/backend/Infrastructure/obj/Debug/net8.0/refint/Infrastructure.dll b/backend/Infrastructure/obj/Debug/net8.0/refint/Infrastructure.dll index e0747e0..3a85117 100644 Binary files a/backend/Infrastructure/obj/Debug/net8.0/refint/Infrastructure.dll and b/backend/Infrastructure/obj/Debug/net8.0/refint/Infrastructure.dll differ diff --git a/backend/Infrastructure/obj/Infrastructure.csproj.nuget.dgspec.json b/backend/Infrastructure/obj/Infrastructure.csproj.nuget.dgspec.json index 3a8bfbe..0cc01fe 100644 --- a/backend/Infrastructure/obj/Infrastructure.csproj.nuget.dgspec.json +++ b/backend/Infrastructure/obj/Infrastructure.csproj.nuget.dgspec.json @@ -27,7 +27,11 @@ "frameworks": { "net8.0": { "targetAlias": "net8.0", - "projectReferences": {} + "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": { @@ -43,6 +47,10 @@ "FluentValidation": { "target": "Package", "version": "[11.9.0, )" + }, + "MongoDB.Driver": { + "target": "Package", + "version": "[2.24.0, )" } }, "imports": [ @@ -179,6 +187,10 @@ "target": "Package", "version": "[8.0.3, )" }, + "Microsoft.EntityFrameworkCore.Relational": { + "target": "Package", + "version": "[8.0.3, )" + }, "Microsoft.Extensions.Configuration": { "target": "Package", "version": "[8.0.0, )" diff --git a/backend/Infrastructure/obj/project.assets.json b/backend/Infrastructure/obj/project.assets.json index 287a8f3..11a694e 100644 --- a/backend/Infrastructure/obj/project.assets.json +++ b/backend/Infrastructure/obj/project.assets.json @@ -1310,7 +1310,9 @@ "type": "project", "framework": ".NETCoreApp,Version=v8.0", "dependencies": { - "FluentValidation": "11.9.0" + "Core": "1.0.0", + "FluentValidation": "11.9.0", + "MongoDB.Driver": "2.24.0" }, "compile": { "bin/placeholder/Application.dll": {} @@ -3448,6 +3450,7 @@ "Core >= 1.0.0", "Microsoft.EntityFrameworkCore >= 8.0.3", "Microsoft.EntityFrameworkCore.Design >= 8.0.3", + "Microsoft.EntityFrameworkCore.Relational >= 8.0.3", "Microsoft.Extensions.Configuration >= 8.0.0", "Microsoft.Extensions.Configuration.Json >= 8.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions >= 8.0.0", @@ -3511,6 +3514,10 @@ "target": "Package", "version": "[8.0.3, )" }, + "Microsoft.EntityFrameworkCore.Relational": { + "target": "Package", + "version": "[8.0.3, )" + }, "Microsoft.Extensions.Configuration": { "target": "Package", "version": "[8.0.0, )" diff --git a/backend/Infrastructure/obj/project.nuget.cache b/backend/Infrastructure/obj/project.nuget.cache index 2bbcb3e..1237d21 100644 --- a/backend/Infrastructure/obj/project.nuget.cache +++ b/backend/Infrastructure/obj/project.nuget.cache @@ -1,6 +1,6 @@ { "version": 2, - "dgSpecHash": "t1Lh/p64WBrnORW6635pkHOABwC1ZyTNJVZj9jg7WdG5XARaLlgRGmknylIsriNV03uXj4BqkWcEhJWh1UsLNg==", + "dgSpecHash": "iwi/5xNtgWqhK31wqOr9WG6iDQW0uTBS41AXw9EdTi0QL3UPkJdVquF7OuGqSc48sG+mLp/gC3DLdj3TQId54g==", "success": true, "projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj", "expectedPackageFiles": [ diff --git a/backend/Infrastructure/obj/project.packagespec.json b/backend/Infrastructure/obj/project.packagespec.json index 1284fc7..b07bb8e 100644 --- a/backend/Infrastructure/obj/project.packagespec.json +++ b/backend/Infrastructure/obj/project.packagespec.json @@ -1 +1 @@ -"restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj","projectName":"Infrastructure","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\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\\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":{"Microsoft.EntityFrameworkCore":{"target":"Package","version":"[8.0.3, )"},"Microsoft.EntityFrameworkCore.Design":{"include":"Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive","suppressParent":"All","target":"Package","version":"[8.0.3, )"},"Microsoft.Extensions.Configuration":{"target":"Package","version":"[8.0.0, )"},"Microsoft.Extensions.Configuration.Json":{"target":"Package","version":"[8.0.0, )"},"Microsoft.Extensions.Options.ConfigurationExtensions":{"target":"Package","version":"[8.0.0, )"},"MongoDB.Driver":{"target":"Package","version":"[2.24.0, )"},"Npgsql.EntityFrameworkCore.PostgreSQL":{"target":"Package","version":"[8.0.2, )"}},"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"}} \ No newline at end of file +"restore":{"projectUniqueName":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj","projectName":"Infrastructure","projectPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\Infrastructure.csproj","outputPath":"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\Infrastructure\\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\\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":{"Microsoft.EntityFrameworkCore":{"target":"Package","version":"[8.0.3, )"},"Microsoft.EntityFrameworkCore.Design":{"include":"Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive","suppressParent":"All","target":"Package","version":"[8.0.3, )"},"Microsoft.EntityFrameworkCore.Relational":{"target":"Package","version":"[8.0.3, )"},"Microsoft.Extensions.Configuration":{"target":"Package","version":"[8.0.0, )"},"Microsoft.Extensions.Configuration.Json":{"target":"Package","version":"[8.0.0, )"},"Microsoft.Extensions.Options.ConfigurationExtensions":{"target":"Package","version":"[8.0.0, )"},"MongoDB.Driver":{"target":"Package","version":"[2.24.0, )"},"Npgsql.EntityFrameworkCore.PostgreSQL":{"target":"Package","version":"[8.0.2, )"}},"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"}} \ No newline at end of file diff --git a/backend/Infrastructure/obj/rider.project.restore.info b/backend/Infrastructure/obj/rider.project.restore.info index ea3c7ff..d0283bc 100644 --- a/backend/Infrastructure/obj/rider.project.restore.info +++ b/backend/Infrastructure/obj/rider.project.restore.info @@ -1 +1 @@ -17122552827017860 \ No newline at end of file +17125075152023106 \ No newline at end of file