Slight refactor and finish enforcement on endpoints

This commit is contained in:
FeTetra 2024-12-23 00:30:37 -05:00
commit f6cbafd524
7 changed files with 78 additions and 35 deletions

View file

@ -24,8 +24,6 @@ public class EnterLevelController : ControllerBase
{
private readonly DatabaseContext database;
private static readonly bool emailEnforcementEnabled = EnforceEmailConfiguration.Instance.EnableEmailEnforcement;
public EnterLevelController(DatabaseContext database)
{
this.database = database;
@ -41,9 +39,6 @@ public class EnterLevelController : ControllerBase
if (SlotHelper.IsTypeInvalid(slotType)) return this.BadRequest();
// Return bad request on unverified email if enforcement is enabled
if (emailEnforcementEnabled && !user.EmailAddressVerified) return this.BadRequest();
// don't count plays for developer slots
if (slotType == "developer") return this.Ok();
@ -117,9 +112,6 @@ public class EnterLevelController : ControllerBase
if (SlotHelper.IsTypeInvalid(slotType)) return this.BadRequest();
// Return bad request on unverified email if enforcement is enabled
if (emailEnforcementEnabled && !user.EmailAddressVerified) return this.BadRequest();
if (slotType == "developer") return this.Ok();
SlotEntity? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == slotId);