@@ -89,9 +89,9 @@ public ResponseEntity<Product> registerProduct( @Parameter(description="Object T
89
89
if (productService .existsProduct (product .getTitle ())) {
90
90
return new ResponseEntity <Product >(product ,HttpStatus .NOT_ACCEPTABLE );
91
91
}
92
- product .setImg0 (false );
93
92
product .setImg1 (false );
94
93
product .setImg2 (false );
94
+ product .setImg3 (false );
95
95
productService .save (product );
96
96
product = productService .getProductByTitle (product .getTitle ());
97
97
URI location = fromCurrentRequest ().path ("/{id}" ).buildAndExpand (product .getIdproduct ()).toUri ();
@@ -208,15 +208,15 @@ public ResponseEntity<Product> replaceProduct( @Parameter(description="id of Pro
208
208
content = @ Content
209
209
)
210
210
})
211
- @ GetMapping ("/{id}/image0 " )
211
+ @ GetMapping ("/{id}/image1 " )
212
212
public ResponseEntity <Object > getImage0 ( @ Parameter (description ="id of Product to be searched" ) @ PathVariable int id ) throws SQLException {
213
213
Optional <Product > product = productService .getProductById (id );
214
214
if (product .isPresent ()) {
215
- if (product .get ().getImage0 () != null ) {
216
- Resource file = new InputStreamResource (product .get ().getImage0 ().getBinaryStream ());
215
+ if (product .get ().getImage1 () != null ) {
216
+ Resource file = new InputStreamResource (product .get ().getImage1 ().getBinaryStream ());
217
217
return ResponseEntity .ok ()
218
218
.header (HttpHeaders .CONTENT_TYPE , "image/jpeg" )
219
- .contentLength (product .get ().getImage0 ().length ())
219
+ .contentLength (product .get ().getImage1 ().length ())
220
220
.body (file );
221
221
}else {
222
222
return ResponseEntity .noContent ().build ();
@@ -246,15 +246,15 @@ public ResponseEntity<Object> getImage0( @Parameter(description="id of Product t
246
246
content = @ Content
247
247
)
248
248
})
249
- @ GetMapping ("/{id}/image1 " )
249
+ @ GetMapping ("/{id}/image2 " )
250
250
public ResponseEntity <Object > getImage1 ( @ Parameter (description ="id of Product to be searched" ) @ PathVariable int id ) throws SQLException {
251
251
Optional <Product > product = productService .getProductById (id );
252
252
if (product .isPresent ()) {
253
- if (product .get ().getImage1 () != null ) {
254
- Resource file = new InputStreamResource (product .get ().getImage1 ().getBinaryStream ());
253
+ if (product .get ().getImage2 () != null ) {
254
+ Resource file = new InputStreamResource (product .get ().getImage2 ().getBinaryStream ());
255
255
return ResponseEntity .ok ()
256
256
.header (HttpHeaders .CONTENT_TYPE , "image/jpeg" )
257
- .contentLength (product .get ().getImage1 ().length ())
257
+ .contentLength (product .get ().getImage2 ().length ())
258
258
.body (file );
259
259
}else {
260
260
return ResponseEntity .noContent ().build ();
0 commit comments