This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 01:03:59 +03:00
parent b48d5ee19e
commit 61a55fa735
50 changed files with 80 additions and 52 deletions
@@ -9,7 +9,7 @@ public class HealthcareManagerDatabase : DbContext
{
}
public DbSet<Patient> Pacients { get; set; }
public DbSet<Patient> Patients { get; set; }
public DbSet<MedicalHistory> MedicalHistories { get; set; }
public DbSet<Doctor> Doctors { get; set; }
@@ -32,7 +32,7 @@ namespace Infrastructure.Migrations
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
Description = table.Column<byte[]>(type: "bytea", nullable: false)
Content = table.Column<byte[]>(type: "bytea", nullable: false)
},
constraints: table =>
{
@@ -40,7 +40,7 @@ namespace Infrastructure.Migrations
});
migrationBuilder.CreateTable(
name: "Pacients",
name: "Patients",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
@@ -64,7 +64,7 @@ namespace Infrastructure.Migrations
name: "MedicalHistories");
migrationBuilder.DropTable(
name: "Pacients");
name: "Patients");
}
}
}
@@ -51,7 +51,7 @@ namespace Infrastructure.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<byte[]>("Description")
b.Property<byte[]>("Content")
.IsRequired()
.HasColumnType("bytea");
@@ -63,7 +63,7 @@ namespace Infrastructure.Migrations
b.ToTable("MedicalHistories");
});
modelBuilder.Entity("Core.Entities.Pacient", b =>
modelBuilder.Entity("Core.Entities.Patient", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -80,7 +80,7 @@ namespace Infrastructure.Migrations
b.HasKey("Id");
b.ToTable("Pacients");
b.ToTable("Patients");
});
#pragma warning restore 612, 618
}
@@ -1,4 +1,5 @@
using Application.Services.Database;
using MongoDB.Bson;
using MongoDB.Driver;
namespace Infrastructure.Services.MongoDB;
@@ -9,9 +10,16 @@ public class MongoDbService : IMongoDbService
public MongoDbService(string connectionString)
{
var url = new MongoUrl(connectionString);
var client = new MongoClient(url);
_database = client.GetDatabase(url.DatabaseName);
var settings = MongoClientSettings.FromConnectionString(connectionString);
settings.ServerApi = new ServerApi(ServerApiVersion.V1);
var _database = new MongoClient(settings);
try {
var result = _database.GetDatabase("admin").RunCommand<BsonDocument>(new BsonDocument("ping", 1));
Console.WriteLine("Pinged your deployment. You successfully connected to MongoDB!");
} catch (Exception ex) {
Console.WriteLine(ex);
}
}
public IMongoCollection<T> GetCollection<T>(string collectionName)
@@ -10,6 +10,6 @@ public class PatientRepository(HealthcareManagerDatabase context)
{
public async Task<Patient?> FindByEmailAsync(string email)
{
return await _context.Pacients.FirstOrDefaultAsync(d => d.Email == email);
return await _context.Patients.FirstOrDefaultAsync(d => d.Email == email);
}
}
@@ -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+2ccec617a59a712428e67340dc46bebefb152aca")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b48d5ee19e5228d9bcb979f2140f996fe7a12723")]
[assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")]
[assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
5c68101bdd997137e1cd8f3c58cb6d9e9b9d203289c90b0f6dca8b08cc72b5c9
1eff5085180ba5a7e0c455493bf156ab7c10e42899382b41bdf7799d2b2ca6d6
@@ -1 +1 @@
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/2ccec617a59a712428e67340dc46bebefb152aca/*"}}
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/b48d5ee19e5228d9bcb979f2140f996fe7a12723/*"}}