In saas project starter, why store uploadUrl in database

Here is a snippet from the Prisma file of https://wasp-lang.dev/blog/2024/01/30/open-saas-free-open-source-starter-react-nodejs Why does uploadUrl get stored? It expires after an hour, so seems like a waste of storage space.
model File {
id String @id @default(uuid())
createdAt DateTime @default(now())

user User @relation(fields: [userId], references: [id])
userId String

name String
type String
key String
uploadUrl String
}
model File {
id String @id @default(uuid())
createdAt DateTime @default(now())

user User @relation(fields: [userId], references: [id])
userId String

name String
type String
key String
uploadUrl String
}
1 Reply
kapa.ai
kapa.ai2mo ago
Hi @Trigaten. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The uploadUrl field in the File model is likely used to store the pre-signed URL for uploading a file. This URL is generated when a file upload is initiated and is used to upload the file directly to a storage service like AWS S3. While it's true that these pre-signed URLs do expire (typically after an hour), they are crucial for the time they are active. They provide a secure way to upload files directly to a storage service without needing to expose sensitive credentials. Once the file is uploaded, the URL can indeed be discarded. However, storing it in the database might be useful for debugging purposes or to keep a record of upload attempts. It could also be used to retry the upload if it fails within the expiry time. Remember, this is a general explanation based on typical usage of pre-signed URLs. The exact reason why uploadUrl is stored in the File model in the context of the Wasp's open-saas starter project could vary based on specific requirements of the project. For more information on handling file uploads in Wasp, you can refer to this Discord support thread (https://discord.com/channels/686873244791210014/1202924566029012992). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Want results from more Discord servers?
Add your server