Class ClothingItemController
java.lang.Object
com.needleandstitch.pavuk.controller.ClothingItemController
@Controller
@RequestMapping("/clothing-items")
@CrossOrigin
public class ClothingItemController
extends Object
REST controller for managing ClothingItem objects.
This class provides endpoints for handling clothing item-related operations such as retrieving clothing items, creating new items, updating existing ones, and deleting them.
Endpoints:
- GET /clothing-items Retrieve all roles
- GET /clothing-items/{id} Retrieve a role by its ID
- POST /clothing-items Create a new role
- PUT /clothing-items/{id} Update an existing role
- DELETE /clothing-items/{id} Delete a role
- Since:
- 15.12.2024
- Version:
- 1.0.0
- Author:
- Needle & Stitch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<Void> createClothingItem
(ClothingItem clothingItem) Endpoint to create a new clothing item.org.springframework.http.ResponseEntity
<Void> Endpoint to delete a clothing item by its ID.org.springframework.http.ResponseEntity
<List<ClothingItem>> Retrieves all clothing items.org.springframework.http.ResponseEntity
<ClothingItem> Endpoint to retrieve a clothing item by its ID.org.springframework.http.ResponseEntity
<ClothingItem> updateClothingItem
(Long id, ClothingItem clothingItem) Endpoint to update an existing clothing item by its ID.
-
Constructor Details
-
ClothingItemController
public ClothingItemController()
-
-
Method Details
-
getAllClothingItems
@GetMapping public org.springframework.http.ResponseEntity<List<ClothingItem>> getAllClothingItems()Retrieves all clothing items.- Returns:
- A ResponseEntity containing a list of all ClothingItem objects.
-
getClothingItemById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<ClothingItem> getClothingItemById(@PathVariable Long id) Endpoint to retrieve a clothing item by its ID.- Parameters:
id
- The ID of the clothing item.- Returns:
- A ResponseEntity containing the ClothingItem object if found or a 404 Not Found status if the object does not exist.
-
createClothingItem
@PostMapping public org.springframework.http.ResponseEntity<Void> createClothingItem(@RequestBody ClothingItem clothingItem) Endpoint to create a new clothing item.- Parameters:
clothingItem
- The ClothingItem object to create.- Returns:
- A ResponseEntity with a 201 Created status if successful.
-
updateClothingItem
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<ClothingItem> updateClothingItem(@PathVariable Long id, @RequestBody ClothingItem clothingItem) Endpoint to update an existing clothing item by its ID.- Parameters:
id
- The ID of the clothing item to update.clothingItem
- The updated ClothingItem object.- Returns:
- A ResponseEntity with a 200 OK status if successful, or a 404 Not Found status if the item does not exist.
-
deleteClothingItem
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> deleteClothingItem(@PathVariable Long id) Endpoint to delete a clothing item by its ID.- Parameters:
id
- The ID of the clothing item to delete.- Returns:
- A ResponseEntity with a 204 No Content status if successful, or a 404 Not Found status if not.
-