Construct a micro-service that, when given an link to a pdf document:
- stores the document in local storage and
- generates a thumbnail for the document
- Typescript
- Node
- Expose an endpoint where an API consumer can POST a PDF.
- The PDF should be specified as a URL in the message body, not a file upload
- The endpoint should respond immediately after receiving the link, without waiting for the PDF to be processed
- Expose an endpoint which returns a list of PDFs and their associated thumbnails (both as URLs).
These are optional, do as many as you can/want
- Detect duplicates
- Push a webhook to notify the API client of the successful processing.
- POST <base_url>/pdfs
- minimal validation : type = pdf -> 422 if invalid
- bdd : uuid in table "thumbnail_generation_requests"
- starts async processing then returns 201 {id: uuid}
- Processing
- save pdf in file system with naming "id.pdf".
- first page extraction, conversion to png scaled to 256x256px
- save png in file system with naming "id.png"
- insert a end of processing event in the bdd table named "successful_thumbnail_jobs"
- GET <base_url>/pdfs-thumbnails
- sql SELECT * from successfull_thumbnail_jobs
- response [{id: uuid, pdf_url: <base_url>/pdfs/:id, thumbnail_url: <base_url>/pdfs/:id/thumbnail}]
- GET <base_url>/pdfs/:id
- GET <base_url>/pdfs/:id/thumbnail
You should see this challenge as a way to showcase your software engineering skills in a professional environment.