Adding users endpoint to return all users to authorized users
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using GameAuthApi.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@@ -19,6 +20,9 @@ public class UserService
|
||||
public async Task<User> GetByUsernameAsync(string username) =>
|
||||
await _users.Find(u => u.Username == username).FirstOrDefaultAsync();
|
||||
|
||||
public async Task<List<User>> GetAllAsync() =>
|
||||
await _users.Find(_ => true).ToListAsync();
|
||||
|
||||
public async Task CreateAsync(User user) =>
|
||||
await _users.InsertOneAsync(user);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user