hack4impact-uiuc / 3dp4me

3dp4me-git-master.hack4impact1.vercel.app
7 stars 0 forks source link

Add picture support #141

Closed mattwalo32 closed 3 years ago

mattwalo32 commented 3 years ago

We should add a field that allows users to take a picture of the patient and view it on the dashboard.

mattwalo32 commented 3 years ago

Create a new picture field. Here are the steps involved in adding any new field

  1. In the backend constants.js, make sure your field exists in fieldEnum. In your case, PHOTO already exists, so nothing to do.

  2. In the frontend constants.js, make sure your field exists in FIELD_TYPES. When you add the field, make sure the value exactly matches whats on the backend.

  3. Now we need to define what data is actually going to be stored in this field in the backend. I think we don't need to do anything special here.... the value can just be an array of file schemas, just like our fieldEnum.FILE type. Go into generateFieldSchema in metadata.js and add a case for fieldEnum.PHOTO where you define what the schema will look like.

  4. Now you can get to the bulk of the work on the frontend. Create a new PhotoField component in the Fields folder on the frontend. Then go into StepField.js and add a case for the photo where you return your new photo field. So now if you encounter a step with a fieldType of PHOTO, your component will be rendered!

Here's some things I'd recommend:

mattwalo32 commented 3 years ago

Closing to split this into two smaller tasks