Commit 494d83a8 authored by cann-alberto's avatar cann-alberto
Browse files

Added UserService

parent 75e98a73
using MMM_Server.Models;
using MMM_Server.Services;
using Microsoft.AspNetCore.Mvc;
using MMM_Server.Models.Utils;
namespace MMM_Server.Controllers;
......
......@@ -7,5 +7,8 @@
public string DatabaseName { get; set; } = null!;
public string ProfilesCollectionName { get; set; } = null!;
public string UsersCollectionName { get; set; } = null!;
}
}
......@@ -8,5 +8,7 @@ namespace MMM_Server.Models
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string? Id { get; set; }
}
}
namespace MMM_Server.Models.Utils
{
public class RegistrationInfo
{
public PersonalProfileData newProfile { get; set; } = null!;
public User newUser { get; set; } = null!;
public Device newdevice { get; set; } = null!;
public Persona newPersona { get; set; } = null!;
}
}
......@@ -12,39 +12,3 @@ public class PersonalProfileService : MongoDbService<PersonalProfile>
}
}
/*
public class PersonalProfileService
{
private readonly IMongoCollection<PersonalProfile> _profilesCollection;
public PersonalProfileService(
IOptions<MMMDatabaseSettings> profileDatabaseSettings)
{
var mongoClient = new MongoClient(
profileDatabaseSettings.Value.ConnectionString);
var mongoDatabase = mongoClient.GetDatabase(
profileDatabaseSettings.Value.DatabaseName);
_profilesCollection = mongoDatabase.GetCollection<PersonalProfile>(
profileDatabaseSettings.Value.ProfilesCollectionName);
}
public async Task<List<PersonalProfile>> GetAsync() =>
await _profilesCollection.Find(_ => true).ToListAsync();
public async Task CreateAsync(PersonalProfile newProfile) =>
await _profilesCollection.InsertOneAsync(newProfile);
//public async Task<PersonalProfileData?> GetAsync(string id) =>
// await _profilesCollection.Find(x => x.Id == id).FirstOrDefaultAsync();
//public async Task UpdateAsync(string id, PersonalProfileData updatedProfile) =>
// await _profilesCollection.ReplaceOneAsync(x => x.Id == id, updatedProfile);
//public async Task RemoveAsync(string id) =>
// await _profilesCollection.DeleteOneAsync(x => x.Id == id);
}*/
using MMM_Server.Models;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
namespace MMM_Server.Services;
public class UserService : MongoDbService<User>
{
public UserService(IOptions<MMMDatabaseSettings> userDatabaseSettings)
: base(userDatabaseSettings, userDatabaseSettings.Value.UsersCollectionName)
{
}
}
......@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MMM-Server")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4533ac4fba6ed3ae5a653c9810331805a472adc4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+75e98a7308933539e2f1211349c223a96e759e80")]
[assembly: System.Reflection.AssemblyProductAttribute("MMM-Server")]
[assembly: System.Reflection.AssemblyTitleAttribute("MMM-Server")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
b8555282181aca913b09b645a1e9970ad2c3362d226694cf8d50ee96f31c4fac
0586c5593d3bb6f0e04431341b6db6648e2c89725d17c8715a947f802fd0bd6b
b87c4c295b5b8e9bb5da08a641a2db75a76f1d74707d38db40e8ab96b21f1286
f3090db165d798249403588c92253ba1b37bb26d044967bdc45fa549cad6d92e
{"documents":{"C:\\Users\\lab2a\\Documents\\Visual Studio 2022\\Projects\\MPAI-MMM\\MMM-Server\\*":"https://raw.githubusercontent.com/cann-alberto/MPAI-MMM/4533ac4fba6ed3ae5a653c9810331805a472adc4/*"}}
\ No newline at end of file
{"documents":{"C:\\Users\\lab2a\\Documents\\Visual Studio 2022\\Projects\\MPAI-MMM\\MMM-Server\\*":"https://raw.githubusercontent.com/cann-alberto/MPAI-MMM/75e98a7308933539e2f1211349c223a96e759e80/*"}}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment