Add comment by AI
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using LiteDB;
|
||||
using LiteDB;
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainService.Repositories;
|
||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||
@@ -11,6 +11,10 @@ namespace skydiveLogs_api.Infrastructure
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserRepository"/> class
|
||||
/// </summary>
|
||||
/// <param name="dataProvider">The data provider to use for data access</param>
|
||||
public UserRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
@@ -21,6 +25,11 @@ namespace skydiveLogs_api.Infrastructure
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new user to the database
|
||||
/// </summary>
|
||||
/// <param name="newUser">The user instance to add</param>
|
||||
/// <returns>The number of rows affected (0 if insert failed)</returns>
|
||||
public int Add(User newUser)
|
||||
{
|
||||
int result;
|
||||
@@ -38,26 +47,50 @@ namespace skydiveLogs_api.Infrastructure
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all users from the database
|
||||
/// </summary>
|
||||
/// <returns>A collection of all user instances</returns>
|
||||
public IEnumerable<User> GetAll()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a user by its unique identifier
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the user</param>
|
||||
/// <returns>The user instance or null if not found</returns>
|
||||
public User GetById(int id)
|
||||
{
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a user by their login credentials
|
||||
/// </summary>
|
||||
/// <param name="login">The user's login</param>
|
||||
/// <param name="password">The user's password</param>
|
||||
/// <returns>The user instance or null if not found</returns>
|
||||
public User GetByLogin(string login, string password)
|
||||
{
|
||||
return _col.FindOne(u => u.Login == login && u.Password == password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total count of users in the database
|
||||
/// </summary>
|
||||
/// <returns>The total number of users</returns>
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing user in the database
|
||||
/// </summary>
|
||||
/// <param name="updated">The user instance to update</param>
|
||||
/// <returns>True if the update was successful, false otherwise</returns>
|
||||
public bool Update(User updated)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -72,4 +105,4 @@ namespace skydiveLogs_api.Infrastructure
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user