Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

I. Problem

The current system only supports file image upload. There are many issues will arise with it in the future with the current implementation. Because the image upload API can only handle Post request which makes it not restful apiAPI. The first sub-task is to make image upload api become restful. So any person can query  API restful. Having image API to be restful increases consistency with other API endpoints. So as an API user, I can query for an image with an ID and it will return URL pointing to the location of that image. The functionality of the image api API will stay the same, but it will be easier for admin to delete the image that is not being referenced anywhere in platform.

II. Idea

...


Shortly with the introduction of badges and documents upload, we will need

...

an attachment system for the user to

...

easily manage all

...

their content uploaded. The design of the system will include another field in person schema which will be an array of attachments. So the user can

...

reuse their uploaded assets for a new opportunity

...

or a new activity.

A person record will

...

contain a lot of attachments which could be CV file, avatar, banner profile image, etc. This could be easier for a user to have a page that they can manage things that they uploaded. The idea of an attachment management system comes from CMS where user can upload or remove attachment uploaded. However, the user can also use an external link which will cause some issue.
III .  Proposed Solution

Create  a new database schema to help user to manage all file they uploaded. The proposed solution will consist of adding a new Mongo Schema. For now, we can call it Attachment. The reason for that is because of each of the file uploaded to the platform, we have to efficiently manage the data, eliminating junk data in the platform that is not referenced anywhere.


Having an attachment object in place, we use Mongoosecrudify to create a restful API to manage attachment record. The relation of the attachment object with person record is many to one, ie: each person will have one or many attachments uploaded.

Attachment schema for Mongo DB:

FieldDescription
IDAuto generated by Mongoose
File NameWhen user upload a file or multiple files, each of the file will have a name of it. This will be useful for user to remember what file they have uploaded
Type For simplicity, we will only have 2 type which are documents and pictures. The field cloud be an enum type of those 2
MetaData

This meta data will contain information such as id of user who upload the image, the date and time of the file uploaded. Meta data will be helpful when

u23322ser deleted

user removed from the system. The system would just find  all reference of the that user id  and delete all database record about it