From 60fc933da74879efe96e5ff08b52fc96b345b1ed Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:32:28 -0400 Subject: [PATCH] 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 --- Api.SeaHavenIndustries/Controllers/AccountController.cs | 1 + Api.SeaHavenIndustries/Controllers/ContactController.cs | 1 + Api.SeaHavenIndustries/Controllers/EmployeeController.cs | 1 + Api.SeaHavenIndustries/Controllers/FollowUpController.cs | 1 + Api.SeaHavenIndustries/Controllers/PMScheduleController.cs | 1 + Api.SeaHavenIndustries/Controllers/WorkOrderController.cs | 5 +++-- 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Api.SeaHavenIndustries/Controllers/AccountController.cs b/Api.SeaHavenIndustries/Controllers/AccountController.cs index 3c489ca..efa6d39 100644 --- a/Api.SeaHavenIndustries/Controllers/AccountController.cs +++ b/Api.SeaHavenIndustries/Controllers/AccountController.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore; [ApiController] [Route("api/Account")] +[Route("api/accounts")] public class AccountController : ControllerBase { private readonly ApplicationDbContext _db; diff --git a/Api.SeaHavenIndustries/Controllers/ContactController.cs b/Api.SeaHavenIndustries/Controllers/ContactController.cs index 998ac9e..d48795c 100644 --- a/Api.SeaHavenIndustries/Controllers/ContactController.cs +++ b/Api.SeaHavenIndustries/Controllers/ContactController.cs @@ -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 _userManager; diff --git a/Api.SeaHavenIndustries/Controllers/EmployeeController.cs b/Api.SeaHavenIndustries/Controllers/EmployeeController.cs index ac227d1..bc2109f 100644 --- a/Api.SeaHavenIndustries/Controllers/EmployeeController.cs +++ b/Api.SeaHavenIndustries/Controllers/EmployeeController.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore; [ApiController] [Route("api/Employee")] +[Route("api/employees")] public class EmployeeController : Controller { private readonly ApplicationDbContext _db; diff --git a/Api.SeaHavenIndustries/Controllers/FollowUpController.cs b/Api.SeaHavenIndustries/Controllers/FollowUpController.cs index ef819bc..751f27d 100644 --- a/Api.SeaHavenIndustries/Controllers/FollowUpController.cs +++ b/Api.SeaHavenIndustries/Controllers/FollowUpController.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore; [ApiController] [Route("api/FollowUp")] +[Route("api/followups")] public class FollowUpController : ControllerBase { private readonly ApplicationDbContext _db; diff --git a/Api.SeaHavenIndustries/Controllers/PMScheduleController.cs b/Api.SeaHavenIndustries/Controllers/PMScheduleController.cs index 5d60530..b6833d3 100644 --- a/Api.SeaHavenIndustries/Controllers/PMScheduleController.cs +++ b/Api.SeaHavenIndustries/Controllers/PMScheduleController.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore; [ApiController] [Route("api/PMSchedule")] +[Route("api/pmschedules")] public class PMScheduleController : ControllerBase { private readonly ApplicationDbContext _db; diff --git a/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs b/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs index c9f62fa..e66e402 100644 --- a/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs +++ b/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs @@ -19,6 +19,7 @@ namespace Api.SeaHavenIndustries.Controllers // [Authorize] [ApiController] [Route("api/WorkOrder")] + [Route("api/workorders")] public class WorkOrderController : Controller { private readonly UserManager _userManager; @@ -544,8 +545,8 @@ namespace Api.SeaHavenIndustries.Controllers } } - [HttpGet] - [Route("GetWorkorderById")] + [HttpGet("{id:int}")] + [HttpGet("GetWorkorderById")] public async Task 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