Adding users endpoint to return all users to authorized users

This commit is contained in:
hz
2025-05-13 15:10:28 -07:00
parent be255ef384
commit a923dfadc2
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -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);