Progress Overhaul + Profile Page and a LOT more! (#4262)

Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo
2025-12-09 10:00:11 -07:00
committed by GitHub
parent 4ac13f1f25
commit 9f29fa593d
645 changed files with 25585 additions and 4805 deletions
+8 -16
View File
@@ -1,11 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
using API.Data.ManualMigrations;
using API.DTOs;
using API.DTOs.Progress;
using API.Entities;
using API.Middleware;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
@@ -14,24 +10,20 @@ namespace API.Controllers;
#nullable enable
public class AdminController : BaseApiController
public class AdminController(UserManager<AppUser> userManager) : BaseApiController
{
private readonly UserManager<AppUser> _userManager;
public AdminController(UserManager<AppUser> userManager)
{
_userManager = userManager;
}
/// <summary>
/// Checks if an admin exists on the system. This is essentially a check to validate if the system has been setup.
/// Checks if an admin exists on the system. This is essentially a check to validate if the system has been set up.
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[SkipDeviceTracking]
[HttpGet("exists")]
public async Task<ActionResult<bool>> AdminExists()
{
var users = await _userManager.GetUsersInRoleAsync(PolicyConstants.AdminRole);
var users = await userManager.GetUsersInRoleAsync(PolicyConstants.AdminRole);
return users.Count > 0;
}
}