Package no.idata1002.group19.web.api
Class BudgetController
java.lang.Object
no.idata1002.group19.web.api.BudgetController
@RestController
@RequestMapping("/budgets")
@CrossOrigin
public class BudgetController
extends Object
Represents a Budget Controller class which provides RESTful
services to the Spring Boot application at the /budgets endpoint.
- Since:
- 16.04.2023
- Version:
- 16.04.2023
- Author:
- Group19
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?>
addBudget
(BudgetCredentials credentials) Adds a new budget to the system using the BudgetService and returns an appropriate HTTP response.org.springframework.http.ResponseEntity<String>
delete
(long id) Deletes a budget with the specified ID using the BudgetService and returns an appropriate HTTP response.Retrieves a list of all budgets from the TransactionService and returns them as an HTTP response.org.springframework.http.ResponseEntity<String>
update
(long id, BudgetCredentials credentials) Updates a budget with the specified ID using the BudgetService and returns an appropriate HTTP response.
-
Constructor Details
-
BudgetController
public BudgetController()
-
-
Method Details
-
getBudgets
Retrieves a list of all budgets from the TransactionService and returns them as an HTTP response.- Returns:
- ResponseEntityinvalid input: '<'List
> - an HTTP response containing a list of all budgets
-
addBudget
@PostMapping("") public org.springframework.http.ResponseEntity<?> addBudget(@RequestBody BudgetCredentials credentials) Adds a new budget to the system using the BudgetService and returns an appropriate HTTP response.- Parameters:
budget
- - the budget object representing the budget to add.- Returns:
- ResponseEntity - an HTTP response indicating whether the budget was added successfully.
-
update
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<String> update(@PathVariable long id, @RequestBody BudgetCredentials credentials) Updates a budget with the specified ID using the BudgetService and returns an appropriate HTTP response.- Parameters:
id
- - the ID of the budget to update.budget
- - the budget object representing the updated budget.- Returns:
- ResponseEntity - an HTTP response indicating whether the budget was updated successfully.
-
delete
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<String> delete(@PathVariable long id) Deletes a budget with the specified ID using the BudgetService and returns an appropriate HTTP response.- Parameters:
id
- - the ID of the budget to delete.- Returns:
- ResponseEntity - an HTTP response indicating whether the budget was deleted successfully.
-