mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-05 17:42:10 +00:00
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:
parent
6f8f67735a
commit
60fc933da7
6 changed files with 8 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/Account")]
|
[Route("api/Account")]
|
||||||
|
[Route("api/accounts")]
|
||||||
public class AccountController : ControllerBase
|
public class AccountController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _db;
|
private readonly ApplicationDbContext _db;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ namespace Api.SeaHavenIndustries.Controllers
|
||||||
//[Authorize] // Removed for testing
|
//[Authorize] // Removed for testing
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/Contact")]
|
[Route("api/Contact")]
|
||||||
|
[Route("api/contacts")]
|
||||||
public class ContactController : Controller
|
public class ContactController : Controller
|
||||||
{
|
{
|
||||||
private readonly UserManager<ApplicationUser> _userManager;
|
private readonly UserManager<ApplicationUser> _userManager;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/Employee")]
|
[Route("api/Employee")]
|
||||||
|
[Route("api/employees")]
|
||||||
public class EmployeeController : Controller
|
public class EmployeeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _db;
|
private readonly ApplicationDbContext _db;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/FollowUp")]
|
[Route("api/FollowUp")]
|
||||||
|
[Route("api/followups")]
|
||||||
public class FollowUpController : ControllerBase
|
public class FollowUpController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _db;
|
private readonly ApplicationDbContext _db;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/PMSchedule")]
|
[Route("api/PMSchedule")]
|
||||||
|
[Route("api/pmschedules")]
|
||||||
public class PMScheduleController : ControllerBase
|
public class PMScheduleController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _db;
|
private readonly ApplicationDbContext _db;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ namespace Api.SeaHavenIndustries.Controllers
|
||||||
// [Authorize]
|
// [Authorize]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/WorkOrder")]
|
[Route("api/WorkOrder")]
|
||||||
|
[Route("api/workorders")]
|
||||||
public class WorkOrderController : Controller
|
public class WorkOrderController : Controller
|
||||||
{
|
{
|
||||||
private readonly UserManager<ApplicationUser> _userManager;
|
private readonly UserManager<ApplicationUser> _userManager;
|
||||||
|
|
@ -544,8 +545,8 @@ namespace Api.SeaHavenIndustries.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet("{id:int}")]
|
||||||
[Route("GetWorkorderById")]
|
[HttpGet("GetWorkorderById")]
|
||||||
public async Task<IActionResult> GetWorkorderById(int id)
|
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
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue