Class ImageController
- java.lang.Object
-
- edu.cnm.deepdive.albuquirky.controller.ImageController
-
@RestController @RequestMapping("/images") @ExposesResourceFor(Image.class) public class ImageController extends ObjectThe ImageController class is the @RestController that maps the endpoints of "/images" for the communication between the server-side and client-side forImage
-
-
Constructor Summary
Constructors Constructor Description ImageController(ImageService imageService, ProductService productService)Constructs the instances ofImageServiceobject andProductServiceobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<Long>deleteImage(long imageId, Image image, Profile profile)The Delete method that returns a response entity indicating success or failure.StringgetDescription(long imageId)The Get method which returns the description of an image.ImagegetImage(long imageId)The Get method for retrieving anImageobject by its ID.List<Image>getProductImages(long productId)Imagepost(Image image)The Post method for creating a new image.StringupdateDescription(String description, long imageId)The Put method which allows updating the description of an image.
-
-
-
Constructor Detail
-
ImageController
public ImageController(ImageService imageService, ProductService productService)
Constructs the instances ofImageServiceobject andProductServiceobject.- Parameters:
imageService- The instance ofImageServiceto initialize.productService- The instance ofProductServiceto initialize.
-
-
Method Detail
-
getProductImages
@GetMapping(value="/{productId:\\d+}", produces="application/json") public List<Image> getProductImages(@PathVariable long productId)
-
post
@PostMapping(consumes={"application/json","text/plain"}, produces={"application/json","text/plain"}) public Image post(@RequestBody Image image)The Post method for creating a new image.
-
getImage
@GetMapping(value="/{imageId:\\d+}", produces="application/json") public Image getImage(@PathVariable long imageId)The Get method for retrieving anImageobject by its ID.
-
deleteImage
@DeleteMapping(value="/{imageId:\\d+}", consumes="application/json") public org.springframework.http.ResponseEntity<Long> deleteImage(@PathVariable long imageId, Image image, Profile profile)The Delete method that returns a response entity indicating success or failure.
-
getDescription
@GetMapping(value="/{imageId:\\d+}/description", produces="application/json") public String getDescription(@PathVariable long imageId)The Get method which returns the description of an image.
-
updateDescription
@PutMapping(value="/{imageId:\\d+}/description", consumes={"application/json","text/plain"}, produces={"application/json","text/plain"}) public String updateDescription(@RequestBody String description, @PathVariable long imageId)The Put method which allows updating the description of an image.
-
-