Database Structure and User Roles For DoveLinker
Database Structure and User Roles For DoveLinker
DoveLinker
Overview
This document outlines the database structure necessary for the DoveLinker platform,
focusing on user roles, their permissions, and data requirements. This will serve as a
foundational resource for developers to implement the system efficiently.
User Roles
DoveLinker will have six key user roles, each with specific permissions and
responsibilities:
DOVE-LINKERS
iii. Phone Number
iv. Home Address
v. Profile Image
vi. Vehicle Plate Number
vii. Associated Logistics Company
2. Normal Users (Customers)
a. Responsibilities:
i. Browse products from partner vendors.
ii. Place orders and make payments.
iii. Provide feedback and ratings.
b. Required Information:
i. Name
ii. Email
iii. Phone Number
iv. Delivery Address
v. Profile Image (optional)
3. Vendors (Partner Store Owners)
a. Responsibilities:
i. Manage product listings and inventory.
ii. Accept or reject incoming orders.
iii. View sales analytics and performance.
b. Required Information:
i. Store Name
ii. Contact Person
iii. Email
iv. Phone Number
v. Physical Store Address
vi. Profile Image
4. Workers (InStore Staff)
a. Responsibilities:
i. Assist in inventory management.
ii. Prepare orders for pickup by riders.
iii. Provide realtime updates on product availability.
b. Required Information:
i. Name
ii. Email
iii. Phone Number
iv. Assigned Store
5. Logistics Companies
a. Responsibilities:
i. Manage rider registrations.
DOVE-LINKERS
ii. Validate rider details for security.
b. Required Information:
i. Company Name
ii. Contact Person
iii. Email
iv. Phone Number
v. Address
6. Admin (System Administrators)
a. Responsibilities:
i. Manage user accounts across all roles.
ii. Oversee platform operations.
iii. Generate reports and analytics.
b. Required Information:
i. Admin Name
ii. Email
iii. Phone Number
iv. User Role (Admin, Support, etc.)
v. Profile Image
DOVE-LINKERS
Database Structure
1. Users Table
a. Columns:
i. UserID (Primary Key, Unique Identifier)
DOVE-LINKERS
ii. UserRole (e.g., Rider, User, Vendor, Worker, Logistics Company,
Admin)
iii. Name
iv. Email (Unique)
v. Phone Number
vi. Password (hashed for security)
vii. Profile Image (URL)
2. Products Table:
a. Columns:
i. ProductID (Primary Key)
ii. VendorID (Foreign Key linked to Users Table)
iii. Product Name
iv. Description
v. Price
vi. Available Quantity
vii. Image URL
3. Orders Table
a. Columns:
i. OrderID (Primary Key)
ii. UserID (Foreign Key linked to Users Table)
iii. ProductID (Foreign Key linked to Products Table)
iv. Quantity
v. Status (Pending, In Progress, Completed, Cancelled)
vi. Total Amount
vii. Delivery Address
viii. Created At (timestamp)
ix. Updated At (timestamp)
4. Rider Availability Table
a. Columns:
i. AvailabilityID (Primary Key)
ii. RiderID (Foreign Key linked to Users Table)
iii. AvailableStatus (Available, Unavailable)
iv. LastUpdated (timestamp)
5. Store Inventory Table
a. Columns:
i. InventoryID (Primary Key)
ii. VendorID (Foreign Key linked to Users Table)
iii. ProductID (Foreign Key linked to Products Table)
iv. Quantity Available
v. LastUpdated (timestamp)
DOVE-LINKERS
2. For the Find Riders section
DOVE-LINKERS
5. Privacy Considerations:
Ensure that personal information is protected and that any shared data complies
with privacy regulations.
By implementing these elements, we'll create a feature that not only tracks ride history
for users but also provides valuable insights for drivers, enhancing the overall user
experience on the "Find Riders" page. Focus on usability and clarity to ensure both
parties can efficiently access their respective data.
Explanation of Relationships
1. Users Collection: The Users collection contains all user information, including
different roles like Riders, Normal Users, Vendors, Workers, and Admins. Each
user document has fields like:
a. _id: A unique identifier for each user.
b. role: Specifies the user's role (e.g., vendor, rider).
c. name, email, phoneNumber, profileImage, etc.: Basic information about
the user.
DOVE-LINKERS
Summary of Relationships
Visualizing Relationships
1. Simplicity: Easier to manage and query users. All user-related data is in one
place, which can simplify operations like authentication and authorization.
DOVE-LINKERS
2. Uniformity: Easy to add new user roles or make changes to existing roles
without altering the database structure significantly.
3. Flexibility: Having one collection allows for a more dynamic schema where you
can easily adjust fields (using an `additionalData` field, for example) to
accommodate any user type.
Cons:
1. Sparse Data: Different user types may have widely varying fields—this could
lead to many unused or null fields in documents, which can waste space and
complicate validation.
2. Performance: As the collection grows, queries might take longer due to the
varied structures and indexing might also become more complicated.
Pros:
1. Specialization: Each collection can have a tailored schema specific to the user
type, which can result in clearer validation rules and better-organized data.
2. Performance: Collections can be optimized for the specific needs of each user
type, leading to potentially faster queries and more efficient indexing.
DOVE-LINKERS
Cons:
2. Difficult Common Operations: Actions that need to involve multiple user types
(like pulling all users for a dashboard) might require more complex aggregations
or multiple queries.
3. Higher Overhead: If you need to introduce new user types, you would have to
create additional collections and potentially refactor parts of your application.
DOVE-LINKERS