Closed JonPeeAir closed 2 weeks ago
We are able to save the file in the S3 and the metadata in the MongoDB.
However it throws an 500 error that we need to dig a little deeper.
Also, it is not saving the last modified and the size. It might be some problem with the Book class that I will investigate.
Regarding the metadata. It seems solid.
The implementation for this will be pretty similar to Fragments in CCP
this task needs:
116
117
Before implementing endpoint, we need to create
Book
classBook
must have the following attributes:id: string
- random UUID for bookownerId: string
- hashed email of usercreated: date
- date createdupdated: date
- date updatedtype: string
- "epub" or "pdf"size: int
- size of the filetitle: string
- book's titleauthor: string
- book's authorimgUrl: string [default: null]
- book's cover image (aws url)Book
must have the following methods:setBookContent(bookFile)
<email hash>/<book UUID>
save()
<email hash>/images/<book UUID>.jpg|png|whatever
imgUrl
to point to the public url for the recently uploaded imageImplementing
POST /book
multipart/form-data
file
form field: the book filemetadata
form field: the book metadataBook
object using file info and metadataBook.setBookContent(file)
book.save()
id: string
- random UUID for bookownerId: string
- hashed email of usercreated: date
- date createdupdated: date
- date updatedtype: string
- "epub" or "pdf"size: int
- size of the filetitle: string
- book's titleauthor: string
- book's authorimgUrl: string [default: null]
- book's cover imageSample code on how to receive
multipart/form-data
from chatgptHow to call api using curl