Overview
ShareHub is a full stack web application designed to allow users to upload, organize, and share various types of files (photos, videos, documents, etc.). Users can create instances, group files within these instances, and share access with others. This document provides an overview of the data model used in ShareHub.
Data Entities
Users
Collection Name:users
Description: Stores information about each user in the system.
Field | Type | Description |
id | string | Primary key, unique identifier for the user |
username | string | User's unique username |
email | string | User's email address |
fullname | string | User's full name |
instances | ObjectId[] | References to instances owned by the user |
avatar | url | URL of the user's avatar |
avatar_public_id | string | Public ID for the avatar in Cloudinary |
coverImage | url | URL of the user's cover image |
coverImage_public_id | string | Public ID for the cover image in Cloudinary |
password | string | User's password (hashed) |
refreshToken | string | Token for refreshing authentication |
createdAt | Date | Timestamp of when the user was created |
updatedAt | Date | Timestamp of the last update |
Instances
Collection Name:instances
Description: Represents a collection of groups and files created by a user.
Field | Type | Description |
id | string | Primary key, unique identifier for the instance |
title | string | Title of the instance |
password | string | Password for accessing the instance |
group | ObjectId[] | References to groups within the instance |
owner | ObjectId | References the user who owns the instance |
description | string | Description of the instance |
comments | ObjectId[] | References to comments within the instance |
createdAt | Date | Timestamp of when the instance was created |
updatedAt | Date | Timestamp of the last update |
Groups
Collection Name:groups
Description: Organizes files within an instance into categories.
Field | Type | Description |
id | string | Primary key, unique identifier for the group |
name | string | Name of the group |
videofiles | ObjectId[] | References to video files in the group |
docfiles | ObjectId[] | References to document files in the group |
imagefiles | ObjectId[] | References to image files in the group |
createdAt | Date | Timestamp of when the group was created |
updatedAt | Date | Timestamp of the last update |
Comments
Collection Name:comments
Description: Stores comments made by users on instances.
Field | Type | Description |
id | string | Primary key, unique identifier for the comment |
content | string | Content of the comment |
owner | ObjectId | References the user who made the comment |
instanceId | ObjectId | References the instance the comment belongs to |
createdAt | Date | Timestamp of when the comment was created |
updatedAt | Date | Timestamp of the last update |
Videos
Collection Name:videos
Description: Stores information about video files.
Field | Type | Description |
id | string | Primary key, unique identifier for the video |
owner | ObjectId | References the user who owns the video |
group | ObjectId | References the group the video belongs to |
title | string | Title of the video |
videofile | url | URL of the video file |
videofile_public_id | string | Public ID for the video file in Cloudinary |
createdAt | Date | Timestamp of when the video was created |
updatedAt | Date | Timestamp of the last update |
Documents
Collection Name:docs
Description: Stores information about document files.
Field | Type | Description |
id | string | Primary key, unique identifier for the document |
owner | ObjectId | References the user who owns the document |
group | ObjectId | References the group the document belongs to |
title | string | Title of the document |
docfile | url | URL of the document file |
docfile_public_id | string | Public ID for the document file in Cloudinary |
createdAt | Date | Timestamp of when the document was created |
updatedAt | Date | Timestamp of the last update |
Images
Collection Name:images
Description: Stores information about image files.
Field | Type | Description |
id | string | Primary key, unique identifier for the image |
owner | ObjectId | References the user who owns the image |
group | ObjectId | References the group the image belongs to |
title | string | Title of the image |
imagefile | url | URL of the image file |
imagefile_public_id | string | Public ID for the image file in Cloudinary |
createdAt | Date | Timestamp of when the image was created |
updatedAt | Date | Timestamp of the last update |
Relationships
Users to Instances: A user can own multiple instances.
users.instances
referencesinstances.id
Instances to Groups: An instance can contain multiple groups.
instances.group
referencesgroups.id
Instances to Users: An instance is owned by a user.
instances.owner
referencesusers.id
Groups to Videos: A group can contain multiple video files.
groups.videofiles
referencesvideos.id
Groups to Documents: A group can contain multiple document files.
groups.docfiles
referencesdocs.id
Groups to Images: A group can contain multiple image files.
groups.imagefiles
referencesimages.id
Videos to Users: A video file is owned by a user.
videos.owner
referencesusers.id
Documents to Users: A document file is owned by a user.
docs.owner
referencesusers.id
Images to Users: An image file is owned by a user.
images.owner
referencesusers.id
Comments to Users: A comment is made by a user.
comments.owner
referencesusers.id
Comments to Instances: A comment belongs to an instance.
comments.instanceId
referencesinstances.id
Instances to Comments: An instance can have multiple comments.
instances.comments
referencescomments.id
Key Points
User Instances: A user can have multiple instances.
Instance Groups: Each instance can have multiple groups.
Group Files: Each group can store different types of files such as videos, documents, and images.
Instance Comments: Users can comment on instances.
References
๐ Hello, I'm Aditya Verma ๐
โ๏ธ If you liked this article, consider sharing it with others.
๐ฅฐ Thank You for reading.