api cu adaugare/revocare acces
This commit is contained in:
@@ -30,12 +30,14 @@ public static class DependencyInjection
|
||||
|
||||
// Extract MongoDB database names
|
||||
var healthcareManagerDatabaseName = configuration.GetValue<string>("HealthcareManagerDatabase:Name");
|
||||
var medicalHistoryCollectionName = configuration.GetValue<string>("HealthcareManagerDatabase:MedicalRecordCollectionName");
|
||||
var medicalHistoryCollectionName =
|
||||
configuration.GetValue<string>("HealthcareManagerDatabase:MedicalRecordCollectionName");
|
||||
var chatCollectionName = configuration.GetValue<string>("HealthcareManagerDatabase:ChatCollectionName");
|
||||
|
||||
// Register MongoDB services
|
||||
services.AddSingleton<IMedicalHistoryMongoDbService>(serviceProvider =>
|
||||
new MedicalHistoryMongoDbService(mongoDbConnectionString, healthcareManagerDatabaseName, medicalHistoryCollectionName));
|
||||
new MedicalHistoryMongoDbService(mongoDbConnectionString, healthcareManagerDatabaseName,
|
||||
medicalHistoryCollectionName));
|
||||
|
||||
services.AddSingleton<IChatMongoDbService>(serviceProvider =>
|
||||
new ChatMongoDbService(mongoDbConnectionString, healthcareManagerDatabaseName, chatCollectionName));
|
||||
@@ -47,7 +49,7 @@ public static class DependencyInjection
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
private static string ExtractMongoDbDatabaseName(string connectionString)
|
||||
{
|
||||
var connectionStringBuilder = new MongoUrlBuilder(connectionString);
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace Infrastructure.Services.MongoDB;
|
||||
|
||||
public class ChatMongoDbService : MongoDbService, IChatMongoDbService
|
||||
{
|
||||
public ChatMongoDbService(string connectionString, string databaseName, string collectionName)
|
||||
public ChatMongoDbService(string connectionString, string databaseName, string collectionName)
|
||||
: base(connectionString, databaseName, collectionName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Implement additional methods specific to Chat database if needed
|
||||
}
|
||||
@@ -4,10 +4,10 @@ namespace Infrastructure.Services.MongoDB;
|
||||
|
||||
public class MedicalHistoryMongoDbService : MongoDbService, IMedicalHistoryMongoDbService
|
||||
{
|
||||
public MedicalHistoryMongoDbService(string connectionString, string databaseName, string collectionName)
|
||||
public MedicalHistoryMongoDbService(string connectionString, string databaseName, string collectionName)
|
||||
: base(connectionString, databaseName, collectionName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Implement additional methods specific to Medical History database if needed
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace Infrastructure.Services.MongoDB
|
||||
{
|
||||
_databaseName = databaseName;
|
||||
_collectionName = collectionName;
|
||||
|
||||
|
||||
Console.WriteLine($"Connection string: {connectionString}");
|
||||
Console.WriteLine($"Database Name: {databaseName}");
|
||||
Console.WriteLine($"Collection Name: {collectionName}");
|
||||
@@ -23,12 +23,12 @@ namespace Infrastructure.Services.MongoDB
|
||||
settings.ServerApi = new ServerApi(ServerApiVersion.V1);
|
||||
_database = new MongoClient(settings);
|
||||
|
||||
try
|
||||
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)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
@@ -71,4 +71,4 @@ namespace Infrastructure.Services.MongoDB
|
||||
await collection.DeleteOneAsync(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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+61a55fa7353346bdad2d677f0ec3c044c3aa87d5")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b4eca98e0a616e4db63ed57610d69f27f43f4765")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
08604fac7a3083586b55565c1ab1f39ea8637dd70dd31c4daa6a7693d2108c04
|
||||
8b677799af22dda0302ef21ae1f9e90a373b1470f2b8b3c1bb091bfa2a802d38
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/61a55fa7353346bdad2d677f0ec3c044c3aa87d5/*"}}
|
||||
{"documents":{"C:\\Users\\Andrei Cerbu\\Documents\\FACULTATE\\CC-FinalProj\\*":"https://raw.githubusercontent.com/andrei-mihnea-cerbu/CC-FinalProj/b4eca98e0a616e4db63ed57610d69f27f43f4765/*"}}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user