Add lowercase route aliases for all controllers

- services/api.js uses lowercase routes (/api/workorders, /api/employees, etc.)
- Add matching [Route] attributes to WorkOrder, Employee, Contact, Account, FollowUp, PMSchedule controllers
- Add [HttpGet("{id:int}")] to WorkOrderController for REST-style get by ID
This commit is contained in:
Adam Moussa 2026-04-16 17:32:28 -04:00
parent 6f8f67735a
commit 60fc933da7
6 changed files with 8 additions and 2 deletions

View file

@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
[ApiController]
[Route("api/Account")]
[Route("api/accounts")]
public class AccountController : ControllerBase
{
private readonly ApplicationDbContext _db;

View file

@ -11,6 +11,7 @@ namespace Api.SeaHavenIndustries.Controllers
//[Authorize] // Removed for testing
[ApiController]
[Route("api/Contact")]
[Route("api/contacts")]
public class ContactController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;

View file

@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
[ApiController]
[Route("api/Employee")]
[Route("api/employees")]
public class EmployeeController : Controller
{
private readonly ApplicationDbContext _db;

View file

@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
[ApiController]
[Route("api/FollowUp")]
[Route("api/followups")]
public class FollowUpController : ControllerBase
{
private readonly ApplicationDbContext _db;

View file

@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
[ApiController]
[Route("api/PMSchedule")]
[Route("api/pmschedules")]
public class PMScheduleController : ControllerBase
{
private readonly ApplicationDbContext _db;

View file

@ -19,6 +19,7 @@ namespace Api.SeaHavenIndustries.Controllers
// [Authorize]
[ApiController]
[Route("api/WorkOrder")]
[Route("api/workorders")]
public class WorkOrderController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;
@ -544,8 +545,8 @@ namespace Api.SeaHavenIndustries.Controllers
}
}
[HttpGet]
[Route("GetWorkorderById")]
[HttpGet("{id:int}")]
[HttpGet("GetWorkorderById")]
public async Task<IActionResult> GetWorkorderById(int id)
{
var exist = await _db.workOrders.Include(w => w.Locations).Include(w => w.Comments).Include(w => w.Quotes).Where(w => w.Id == id).Select(s => new