API Traieste
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Infrastructure.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Core.Entities;
|
||||
using Application.Endpoints.Doctors.Login;
|
||||
using Application.Services.Database;
|
||||
|
||||
namespace HealthcareManager.API.Controllers
|
||||
{
|
||||
@@ -11,11 +9,11 @@ namespace HealthcareManager.API.Controllers
|
||||
[Route("api/[controller]")]
|
||||
public class DoctorsController : ControllerBase
|
||||
{
|
||||
private readonly HealthcareManagerContext _context;
|
||||
private readonly IDoctorRepository _database;
|
||||
|
||||
public DoctorsController(HealthcareManagerContext context)
|
||||
public DoctorsController(IDoctorRepository database)
|
||||
{
|
||||
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
_database = database ?? throw new ArgumentNullException(nameof(database));
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
@@ -25,9 +23,17 @@ namespace HealthcareManager.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<Doctor>> PostDoctor(Doctor doctor)
|
||||
public async Task<ActionResult<Doctor>> Login(DoctorLoginDTO doctor)
|
||||
{
|
||||
return NotFound();
|
||||
var handler = new DoctorLoginHandler(_database);
|
||||
var response = handler.Handle(doctor).Result;
|
||||
|
||||
if(!response.Success)
|
||||
{
|
||||
return Unauthorized(response.Message);
|
||||
}
|
||||
|
||||
return Ok(response.Message);
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
|
||||
@@ -28,13 +28,13 @@ app.MapControllers();
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var services = scope.ServiceProvider;
|
||||
var dbContext = services.GetRequiredService<HealthcareManagerContext>(); // Directly resolving your DbContext
|
||||
var dbContext = services.GetRequiredService<HealthcareManagerDatabase>(); // Directly resolving your DbContext
|
||||
EnsureDatabaseCreated(dbContext);
|
||||
}
|
||||
|
||||
app.Run();
|
||||
|
||||
static void EnsureDatabaseCreated(HealthcareManagerContext dbContext)
|
||||
static void EnsureDatabaseCreated(HealthcareManagerDatabase dbContext)
|
||||
{
|
||||
// Checking for pending migrations is more efficient than applying migrations unconditionally
|
||||
if (dbContext.Database.GetPendingMigrations().Any())
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"FluentValidation/11.9.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/FluentValidation.dll": {
|
||||
"assemblyVersion": "11.0.0.0",
|
||||
"fileVersion": "11.9.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore/8.0.3": {
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore.Abstractions": "8.0.3",
|
||||
@@ -367,7 +375,7 @@
|
||||
},
|
||||
"Application/1.0.0": {
|
||||
"dependencies": {
|
||||
"Core": "1.0.0"
|
||||
"FluentValidation": "11.9.0"
|
||||
},
|
||||
"runtime": {
|
||||
"Application.dll": {}
|
||||
@@ -425,6 +433,13 @@
|
||||
"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.EntityFrameworkCore/8.0.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -103,11 +103,7 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
@@ -124,6 +120,12 @@
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"FluentValidation": {
|
||||
"target": "Package",
|
||||
"version": "[11.9.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
|
||||
@@ -14,7 +14,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+041abb59007874167884872bc1a73e753930824b")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+22f171b5600c0f2fcef2f7c927f96f78a59a27a4")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("API")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
c1b3efba5e30e064f696242b7a7b9581636fa9df6b695c893c47a18e71a82313
|
||||
3fb6d13e7b959d2a75e5b49727917d1360eaac6268eb218b39eaf9332a168329
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
207814169de56165806bf70065da089115ed45a84b56b1987cb76592e92957c0
|
||||
86f413f204b6bbdb2571f35c8208d17a18ef4d7252c53266660048227508f093
|
||||
|
||||
@@ -14,10 +14,8 @@ C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Swashbuckle.AspNetCore.Swagger.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Swashbuckle.AspNetCore.SwaggerGen.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Swashbuckle.AspNetCore.SwaggerUI.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Application.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Core.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Infrastructure.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Application.pdb
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Infrastructure.pdb
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Core.pdb
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\obj\Debug\net8.0\API.csproj.AssemblyReference.cache
|
||||
@@ -55,3 +53,6 @@ C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\runtimes\linux\native\libmongocrypt.so
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\runtimes\osx\native\libmongocrypt.dylib
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\runtimes\win\native\mongocrypt.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\FluentValidation.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Application.dll
|
||||
C:\Users\Andrei Cerbu\Documents\FACULTATE\CC-FinalProj\backend\API\bin\Debug\net8.0\Application.pdb
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/041abb59007874167884872bc1a73e753930824b/*"}}
|
||||
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/22f171b5600c0f2fcef2f7c927f96f78a59a27a4/*"}}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -47,6 +47,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"FluentValidation/11.9.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net8.0/FluentValidation.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/FluentValidation.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore/8.0.3": {
|
||||
"type": "package",
|
||||
"dependencies": {
|
||||
@@ -844,7 +857,7 @@
|
||||
"type": "project",
|
||||
"framework": ".NETCoreApp,Version=v8.0",
|
||||
"dependencies": {
|
||||
"Core": "1.0.0"
|
||||
"FluentValidation": "11.9.0"
|
||||
},
|
||||
"compile": {
|
||||
"bin/placeholder/Application.dll": {}
|
||||
@@ -965,6 +978,31 @@
|
||||
"lib/netstandard2.1/DnsClient.xml"
|
||||
]
|
||||
},
|
||||
"FluentValidation/11.9.0": {
|
||||
"sha512": "VneVlTvwYDkfHV5av3QrQ0amALgrLX6LV94wlYyEsh0B/klJBW7C8y2eAtj5tOZ3jH6CAVpr4s1ZGgew/QWyig==",
|
||||
"type": "package",
|
||||
"path": "fluentvalidation/11.9.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"README.md",
|
||||
"fluent-validation-icon.png",
|
||||
"fluentvalidation.11.9.0.nupkg.sha512",
|
||||
"fluentvalidation.nuspec",
|
||||
"lib/net5.0/FluentValidation.dll",
|
||||
"lib/net5.0/FluentValidation.xml",
|
||||
"lib/net6.0/FluentValidation.dll",
|
||||
"lib/net6.0/FluentValidation.xml",
|
||||
"lib/net7.0/FluentValidation.dll",
|
||||
"lib/net7.0/FluentValidation.xml",
|
||||
"lib/net8.0/FluentValidation.dll",
|
||||
"lib/net8.0/FluentValidation.xml",
|
||||
"lib/netstandard2.0/FluentValidation.dll",
|
||||
"lib/netstandard2.0/FluentValidation.xml",
|
||||
"lib/netstandard2.1/FluentValidation.dll",
|
||||
"lib/netstandard2.1/FluentValidation.xml"
|
||||
]
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore/8.0.3": {
|
||||
"sha512": "QUPQbeq4yCjgIL/6PzkhfwhljXmai3CNOsErWFJ/WJ1Z41V8+At0Bi4PT8/2pX25kPgf83g0CUKIZd0QbeKT4A==",
|
||||
"type": "package",
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "+Eo3ZlVadsh0g5psDAeY3ENyxpEyjMxHkip+uq7b97ZgVc5Me7Ppg9PPAgVp4tu3qiHCCwLc+HCJkXjapcyV1w==",
|
||||
"dgSpecHash": "dVAkg1LDfFAQCVAzH3Iq8cH7RsYPVxlIIVBGC3uX42Jb0TpaBL8XV3mfJaWQObtkI2P97JwR5Lqi19zLWR0gTw==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\backend\\API\\API.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"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.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",
|
||||
|
||||
Reference in New Issue
Block a user