Add self-service profile and account deletion APIs
This commit is contained in:
@@ -22,11 +22,19 @@ public class UserService
|
||||
public async Task<User?> GetByUsernameAsync(string username) =>
|
||||
await _col.Find(u => u.Username == username).FirstOrDefaultAsync();
|
||||
|
||||
public async Task<User?> GetByIdAsync(string id) =>
|
||||
await _col.Find(u => u.Id == id).FirstOrDefaultAsync();
|
||||
|
||||
public async Task<User?> GetByEmailAsync(string email) =>
|
||||
await _col.Find(u => u.Email == email).FirstOrDefaultAsync();
|
||||
|
||||
public Task CreateAsync(User user) => _col.InsertOneAsync(user);
|
||||
|
||||
public Task UpdateAsync(User user) =>
|
||||
_col.ReplaceOneAsync(u => u.Id == user.Id, user);
|
||||
|
||||
public Task DeleteAsync(string id) => _col.DeleteOneAsync(u => u.Id == id);
|
||||
|
||||
public Task<List<User>> GetAllAsync() =>
|
||||
_col.Find(FilterDefinition<User>.Empty).ToListAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user