Sprint 2 | Admin | Book C.R.U.D | Book image database addition
To-Do:
-
Implement an endpoint to receive a picture file for a book
-
Validate the picture file format upon upload
-
Extract metadata from the picture file to identify the related book
-
Check if the book already exists in the database
-
If the book exists, update the book's picture
-
If the book does not exist, add the new book and associate the picture with it
-
Handle invalid or corrupted picture files
-
Return appropriate error messages for invalid uploads or books not found
The service receives a picture file for a book, which is processed and stored in the database.
The system validates whether the book exists before adding or updating the picture.
Given a valid picture file for an existing book is sent to the upload endpoint
When the picture file is uploaded to the service
Then the service should extract metadata to identify the book
And check if the book exists in the database
And if the book exists, the service updates the book's picture with the new file
Given a valid picture file for a new book is sent to the upload endpoint
When the picture file is uploaded to the service
Then the service should extract metadata to identify the book
And if the book does not exist in the database, it should be added
And the new picture should be associated with the new book in the database
Given a picture file for a non-existent or invalid book is sent to the upload endpoint
When the picture file is uploaded to the service
Then the service should return an error response indicating the book was not found in the system
Given an invalid or corrupted picture file is sent to the upload endpoint
When the file is uploaded to the service
Then the service should return an error response indicating the picture file could not be processed