ShareHub Data Model

ShareHub Data Model

ยท

6 min read

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.

FieldTypeDescription
idstringPrimary key, unique identifier for the user
usernamestringUser's unique username
emailstringUser's email address
fullnamestringUser's full name
instancesObjectId[]References to instances owned by the user
avatarurlURL of the user's avatar
avatar_public_idstringPublic ID for the avatar in Cloudinary
coverImageurlURL of the user's cover image
coverImage_public_idstringPublic ID for the cover image in Cloudinary
passwordstringUser's password (hashed)
refreshTokenstringToken for refreshing authentication
createdAtDateTimestamp of when the user was created
updatedAtDateTimestamp of the last update

Instances

Collection Name:instances
Description: Represents a collection of groups and files created by a user.

FieldTypeDescription
idstringPrimary key, unique identifier for the instance
titlestringTitle of the instance
passwordstringPassword for accessing the instance
groupObjectId[]References to groups within the instance
ownerObjectIdReferences the user who owns the instance
descriptionstringDescription of the instance
commentsObjectId[]References to comments within the instance
createdAtDateTimestamp of when the instance was created
updatedAtDateTimestamp of the last update

Groups

Collection Name:groups
Description: Organizes files within an instance into categories.

FieldTypeDescription
idstringPrimary key, unique identifier for the group
namestringName of the group
videofilesObjectId[]References to video files in the group
docfilesObjectId[]References to document files in the group
imagefilesObjectId[]References to image files in the group
createdAtDateTimestamp of when the group was created
updatedAtDateTimestamp of the last update

Comments

Collection Name:comments
Description: Stores comments made by users on instances.

FieldTypeDescription
idstringPrimary key, unique identifier for the comment
contentstringContent of the comment
ownerObjectIdReferences the user who made the comment
instanceIdObjectIdReferences the instance the comment belongs to
createdAtDateTimestamp of when the comment was created
updatedAtDateTimestamp of the last update

Videos

Collection Name:videos
Description: Stores information about video files.

FieldTypeDescription
idstringPrimary key, unique identifier for the video
ownerObjectIdReferences the user who owns the video
groupObjectIdReferences the group the video belongs to
titlestringTitle of the video
videofileurlURL of the video file
videofile_public_idstringPublic ID for the video file in Cloudinary
createdAtDateTimestamp of when the video was created
updatedAtDateTimestamp of the last update

Documents

Collection Name:docs
Description: Stores information about document files.

FieldTypeDescription
idstringPrimary key, unique identifier for the document
ownerObjectIdReferences the user who owns the document
groupObjectIdReferences the group the document belongs to
titlestringTitle of the document
docfileurlURL of the document file
docfile_public_idstringPublic ID for the document file in Cloudinary
createdAtDateTimestamp of when the document was created
updatedAtDateTimestamp of the last update

Images

Collection Name:images
Description: Stores information about image files.

FieldTypeDescription
idstringPrimary key, unique identifier for the image
ownerObjectIdReferences the user who owns the image
groupObjectIdReferences the group the image belongs to
titlestringTitle of the image
imagefileurlURL of the image file
imagefile_public_idstringPublic ID for the image file in Cloudinary
createdAtDateTimestamp of when the image was created
updatedAtDateTimestamp of the last update

Relationships

  • Users to Instances: A user can own multiple instances.

  • Instances to Groups: An instance can contain multiple groups.

  • Instances to Users: An instance is owned by a user.

  • Groups to Videos: A group can contain multiple video files.

  • Groups to Documents: A group can contain multiple document files.

    • groups.docfiles references docs.id
  • Groups to Images: A group can contain multiple image files.

  • Videos to Users: A video file is owned by a user.

  • Documents to Users: A document file is owned by a user.

  • Images to Users: An image file is owned by a user.

  • Comments to Users: A comment is made by a user.

  • Comments to Instances: A comment belongs to an instance.

  • Instances to Comments: An instance can have multiple comments.

Key Points

  1. User Instances: A user can have multiple instances.

  2. Instance Groups: Each instance can have multiple groups.

  3. Group Files: Each group can store different types of files such as videos, documents, and images.

  4. Instance Comments: Users can comment on instances.


References

Eraser.io data model


๐Ÿ‘‹ Hello, I'm Aditya Verma ๐Ÿ˜

โœŒ๏ธ If you liked this article, consider sharing it with others.

๐Ÿฅฐ Thank You for reading.

ย