-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blob storage setup #94
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…hat allows form operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left 2 comments. Looks good!
@@ -166,7 +166,7 @@ async function upsertFormInstance(formInstanceData: FormInstanceData) { | |||
|
|||
async function main() { | |||
const testFormLink = | |||
'https://s29.q4cdn.com/175625835/files/doc_downloads/test.pdf'; | |||
'Form_Template Test _547fba69-490e-40af-8f72-70eab3815e0e'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this some sort of a key? Should we be committing this?
yarn.lock
Outdated
@@ -3215,6 +3312,11 @@ | |||
consola "^2.15.0" | |||
node-fetch "^2.6.1" | |||
|
|||
"@opentelemetry/api@^1.0.1": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is opentelemetry used for? Do we need it? Same goes for some of the dependencies below excluding the azure ones.
…into azure-storage-blob-sas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mocking of the storage looks good to me for most part
@@ -55,6 +56,7 @@ export const CreateFormTemplateModal = ({ | |||
|
|||
const [pdf, setPdf] = useState<string | ArrayBuffer | null>(null); | |||
const [pdfName, setPdfName] = useState<string | null>(null); | |||
const [pdfFile, setPdfFile] = useState<File | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm noticing is that this state is not getting reset after a file upload, for instance if you create a template where you load in a template and try to upload another template the previous state is still there, which allows you to bypass the !pdfFile check as well although the form preview is blank, could we reset this state?
const submitFormTemplate = async () => | ||
const submitFormTemplate = async () => { | ||
if (!pdfFile) { | ||
throw new Error('No PDF file uploaded'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also is it better to throw a toast error here, or should we change this logic to something like the form signature fields where this needs field to present otherwise the create template form button is disabled until then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should already be disabled as of now I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description/Problem
Closes story
Setup uploading and downloading files from azure blob storage
Solution
Create a storage service that can upload and download files from the blob storage connection string. Created useStorage hook that calls useEffect to fetch the blob with authentication (unique connection string).
Dependencies
[x] This PR adds new dependencies
Testing
Upload and download forms