Skip to content
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

Merged
merged 12 commits into from
Mar 24, 2024
Merged

Blob storage setup #94

merged 12 commits into from
Mar 24, 2024

Conversation

kaiyangzheng
Copy link
Collaborator

@kaiyangzheng kaiyangzheng commented Mar 6, 2024

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

Copy link

vercel bot commented Mar 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mfa-form-automator ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 24, 2024 1:24am

@kaiyangzheng kaiyangzheng changed the title first draft Blob storage setup Mar 6, 2024
Copy link
Contributor

@AnshulShirude AnshulShirude left a 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';
Copy link
Contributor

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":
Copy link
Contributor

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.

Copy link
Contributor

@justagoodfriend justagoodfriend left a 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);
Copy link
Contributor

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');
Copy link
Contributor

@justagoodfriend justagoodfriend Mar 23, 2024

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?

Copy link
Collaborator Author

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

Copy link
Contributor

@justagoodfriend justagoodfriend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kaiyangzheng kaiyangzheng merged commit 8667c72 into main Mar 24, 2024
7 checks passed
@kaiyangzheng kaiyangzheng deleted the azure-storage-blob-sas branch March 24, 2024 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants