Adopting an agile approach, this blogpost details the breakdown of adding a feature that gives the users the ability to share the files they uploaded with other users i.e. social file share feature. This is for the file sharing app that is shown here on Github.

Summary

A user is able to share the file uploaded with other users.

Feature details and rules

For this feature, let’s define two roles namely owner and viewer. The owner is the person who uploaded the file, and the viewer is the person who the file is shared with.

  • The owner has admin access to the file e.g. they can edit, delete or share the file
  • The viewer only has read access to the file e.g. they can only download the file

p.s. notifying the viewer that owner deleted a file can be a future enhancement for this feature. In addition, the viewer then re-sharing that file with others can also be a future enhancement.

Solution – social file share feature

Add a property owner to the file model.

Overview

Once the user uploads a file, the following will happen,

  1. It will create an entry of the files uploaded in the user table
  2. The actual file will be saved in the folder by username on AWS S3
  3. The user can delegate access to that file (initially, limited to download i.e. read-only)
  4. The list of files uploaded by the user should also fetch the list of files the user has access to
  5. A user can only delete the file that the user owns
  6. User cannot delete the files shared with them

Backend changes

  1. Modify the current version of the API to rename Asset or Document to File
  2. Modify the table names and rename them accordingly in AWS DynamoDB console
  3. Maybe add an extra instance variable to the FileUser table called Owner? (to confirm)
  4. Update the Postman test data and do e2e changes.
  5. Investigate, if instead of saving a list of strings for files uploaded can we reuse the File object such that FileUser has a List of files?

UI changes

  1. The user has an extra button in the UI called share
  2. There is a drop-down for users to share the file to

Time estimate

An estimate of the time it would require facilitating adding file sharing capability on the backend.

It would take anywhere between 2.5 to 4 days, anywhere between 20 – 32 hours.

Conclusion

Hope you found this blogpost useful, and you can find the full source code for this entire app which includes the code for the dependencies can be found here on Github.

If you have any questions on this, feel free to leave a comment on this post or send me an email directly.

If you find any of my posts useful and want to support me, you can buy me a coffee 🙂

https://www.buymeacoffee.com/bhumansoni

While you are here, maybe try one of my apps for the iPhone.

Products – My Day To-Do (mydaytodo.com)

Here are some of my other bloposts on Java

How to build a full stack Spring boot API with ReactJS frontend – My Day To-Do (mydaytodo.com)

How to call REST API with WebClient – My Day To-Do (mydaytodo.com)

How to build a jokes client in Java Spring Boot with RestTemplate – My Day To-Do (mydaytodo.com)

Have a read of some of my other posts on AWS

Deploy NodeJS, Typescript app on AWS Elastic beanstalk – (mydaytodo.com)

How to deploy spring boot app to AWS & serve via https – My Day To-Do (mydaytodo.com)

Categories: agileJava

0 Comments

Leave a Reply

Avatar placeholder
Verified by MonsterInsights