Refactor controllers to improve route clarity and consistency by adding route parameters and updating method signatures

This commit is contained in:
2025-11-13 22:17:59 +00:00
parent 76bebc68b7
commit 7c29302153
41 changed files with 160 additions and 139 deletions

View File

@@ -52,7 +52,7 @@ public class InstructionSetsController(MarechaiContext context) : ControllerBase
})
.ToListAsync();
[HttpGet]
[HttpGet("{id:int}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
@@ -108,7 +108,7 @@ public class InstructionSetsController(MarechaiContext context) : ControllerBase
return model.Id;
}
[HttpDelete]
[HttpDelete("{id:int}")]
[Authorize(Roles = "Admin,UberAdmin")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
@@ -130,10 +130,10 @@ public class InstructionSetsController(MarechaiContext context) : ControllerBase
return Ok();
}
[HttpGet]
[HttpGet("verify-unique/{name}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public bool VerifyUnique(string name) =>
!context.InstructionSets.Any(i => string.Equals(i.Name, name, StringComparison.InvariantCultureIgnoreCase));
!context.InstructionSets.Any(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
}