As a logged in user I can post image snapshots so that I can share my nostalgic memories with other site users
Acceptance Criteria
An image and snapshot title should be compulsory fields when creating a post
A drop down menu should be available to select a genre for the snapshot
A more detailed description should be an optional field
The image file size permitted should be limited to ensure upload times are quick and do not keep the user waiting
Once a snapshot has been created, it should appear as part of the snapshot feed on the home page for all site users
Tasks
[x] Define the validate_image method in the snapshots serializers file, with logic to check for file size, height and width. If the image cannot be validated, return a message with instructions/feedback for the user.
[x] Add SnapshotCreateForm to src/pages/snapshots folder
[x] Make use of useState hook to store and set errors, eras, genres, categories and snapshotData.
[x] Write function to fetch and set eras, genres and categories. Call these on mount using the useEffect hook. (This is so these can be made available as options in the form drop down menu)
[x] Write handleChange and handleChangeImage functions to handle changes to the form state
[x] Write handleSubmit function that saves the form data and posts this data to the /snapshots/ DRF API endpoint
[x] return form with all required fields and call handler functions where required
The final acceptance criteria of displaying the newly created snapshot on the home page will be handled as part of the Homepage Snapshot Feed user story #9
EPIC: #12
As a logged in user I can post image snapshots so that I can share my nostalgic memories with other site users
Acceptance Criteria
Tasks
/snapshots/
DRF API endpoint