Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TradeOffStackAPI/Controllers/DepartmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public async Task<IActionResult> Update(Guid id, [FromBody] Department departmen
return BadRequest("Object ID does not match route ID.");

var response = await _service.UpdateDepartmentAsync(id, department);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpDelete("{id}")]
[Authorize(Roles = Roles.AdminOrTester)]
public async Task<IActionResult> Delete(Guid id)
{
var response = await _service.DeleteDepartmentAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}
}
6 changes: 3 additions & 3 deletions TradeOffStackAPI/Controllers/EquipmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public async Task<IActionResult> Update(Guid id, [FromBody] Equipment equipment)
return BadRequest("Object ID does not match route ID.");

var response = await _service.UpdateEquipmentAsync(id, equipment);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpDelete("{id}")]
[Authorize(Roles = Roles.AdminOrTester)]
public async Task<IActionResult> Delete(Guid id)
{
var response = await _service.DeleteEquipmentAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPost("{id}/licenses/{licenseId}")]
Expand All @@ -88,6 +88,6 @@ public async Task<IActionResult> AssignLicense(Guid id, Guid licenseId)
public async Task<IActionResult> RevokeLicense(Guid id, Guid licenseId)
{
var response = await _service.RevokeLicenseAsync(id, licenseId);
return response.Success ? NoContent() : BadRequest(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : BadRequest(new { message = response.Message });
}
}
8 changes: 4 additions & 4 deletions TradeOffStackAPI/Controllers/MaintenanceRequestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,29 @@ public async Task<IActionResult> Update(Guid id, [FromBody] MaintenanceRequest r
return BadRequest("Object ID does not match route ID.");

var response = await _service.UpdateRequestAsync(id, request);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPost("{id}/complete")]
public async Task<IActionResult> Complete(Guid id, [FromBody] CompleteMaintenanceDto? body)
{
var response = await _service.CompleteRequestAsync(id, body?.TechnicianNotes);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPost("{id}/cancel")]
public async Task<IActionResult> Cancel(Guid id)
{
var response = await _service.CancelRequestAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpDelete("{id}")]
[Authorize(Roles = Roles.AdminOrManagerOrTester)]
public async Task<IActionResult> Delete(Guid id)
{
var response = await _service.DeleteRequestAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}
}

Expand Down
12 changes: 6 additions & 6 deletions TradeOffStackAPI/Controllers/ReservationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,21 @@ public async Task<IActionResult> Update(Guid id, [FromBody] Reservation reservat
return BadRequest("Object ID does not match route ID.");

var response = await _service.UpdateReservationAsync(id, reservation);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPost("{id}/return")]
public async Task<IActionResult> Return(Guid id)
{
var response = await _service.ReturnEquipmentAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPost("{id}/cancel")]
public async Task<IActionResult> Cancel(Guid id)
{
var response = await _service.CancelReservationAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPost("{id}/approve")]
Expand All @@ -111,7 +111,7 @@ public async Task<IActionResult> Approve(Guid id)
{
if (_currentUser.UserId == null) return Unauthorized();
var response = await _service.ApproveReservationAsync(id, _currentUser.UserId.Value);
return response.Success ? NoContent() : BadRequest(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : BadRequest(new { message = response.Message });
}

public class RejectionDto { public string Reason { get; set; } = string.Empty; }
Expand All @@ -122,13 +122,13 @@ public async Task<IActionResult> Reject(Guid id, [FromBody] RejectionDto dto)
{
if (_currentUser.UserId == null) return Unauthorized();
var response = await _service.RejectReservationAsync(id, _currentUser.UserId.Value, dto.Reason);
return response.Success ? NoContent() : BadRequest(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : BadRequest(new { message = response.Message });
}

[HttpDelete("{id}")]
public async Task<IActionResult> Delete(Guid id)
{
var response = await _service.DeleteReservationAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}
}
6 changes: 3 additions & 3 deletions TradeOffStackAPI/Controllers/SaaSController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<IActionResult> DeleteProvider(Guid id)
{
var response = await _saasService.DeleteProviderAsync(id);
if (!response.Success) return BadRequest(new { message = response.Message });
return NoContent();
return Ok(new { message = "Success" });
}

[HttpGet("subscriptions")]
Expand Down Expand Up @@ -86,7 +86,7 @@ public async Task<IActionResult> DeleteSubscription(Guid id)
{
var response = await _saasService.DeleteSubscriptionAsync(id);
if (!response.Success) return NotFound(new { message = response.Message });
return NoContent();
return Ok(new { message = "Success" });
}

[HttpGet("assignments")]
Expand Down Expand Up @@ -118,6 +118,6 @@ public async Task<IActionResult> UnassignUser(Guid id)
{
var response = await _saasService.UnassignUserAsync(id);
if (!response.Success) return NotFound(new { message = response.Message });
return NoContent();
return Ok(new { message = "Success" });
}
}
4 changes: 2 additions & 2 deletions TradeOffStackAPI/Controllers/SoftwareLicenseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public async Task<IActionResult> Update(Guid id, [FromBody] SoftwareLicense lice
return BadRequest("Object ID does not match route ID.");

var response = await _service.UpdateAsync(id, license);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpDelete("{id}")]
[Authorize(Roles = Roles.AdminOrTester)]
public async Task<IActionResult> Delete(Guid id)
{
var response = await _service.DeleteAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}
}
4 changes: 2 additions & 2 deletions TradeOffStackAPI/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public async Task<IActionResult> Update(Guid id, [FromBody] User user)
}

var response = await _service.UpdateUserAsync(id, user);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}

[HttpPut("{id}/change-password")]
Expand Down Expand Up @@ -145,7 +145,7 @@ public async Task<IActionResult> ChangePassword(Guid id, [FromBody] ChangePasswo
public async Task<IActionResult> Delete(Guid id)
{
var response = await _service.DeleteUserAsync(id);
return response.Success ? NoContent() : NotFound(new { message = response.Message });
return response.Success ? Ok(new { message = "Success" }) : NotFound(new { message = response.Message });
}
}

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ services:
db:
condition: service_healthy
environment:
ConnectionStrings__DefaultConnection: Host=db;Database=tradeoffstack;Username=${POSTGRES_USER:-tradeoff_admin};Password=${POSTGRES_PASSWORD:-Tr@de0ff_Secure!2026_Db#X9}
ConnectionStrings__CoreConnection: Host=db;Database=tradeoffstack_core;Username=${POSTGRES_USER:-tradeoff_admin};Password=${POSTGRES_PASSWORD:-Tr@de0ff_Secure!2026_Db#X9}
ConnectionStrings__AssetConnection: Host=db;Database=tradeoffstack_assetportal;Username=${POSTGRES_USER:-tradeoff_admin};Password=${POSTGRES_PASSWORD:-Tr@de0ff_Secure!2026_Db#X9}
JWT_SECRET_KEY: ${JWT_SECRET_KEY:-Tr@de0ff_Super_Secret_Key_For_JWT_Auth_2026!}
ASPNETCORE_ENVIRONMENT: Production
restart: always
Expand Down
Loading