Skip to content

Atif1299/Full-Stack-AI-Powered-Admin-Client-Hub

Repository files navigation

Reviewer's Guide

This PR revamps the landing page with interactive visuals and streamlined styling, refactors the client dashboard for async API interactions, introduces full MongoDB integration via Mongoose (with Client and Admin models, connection logic, and REST endpoints), and updates project configuration and dependencies for seamless development and deployment.

Sequence diagram for async client dashboard API interactions

sequenceDiagram
    actor User
    participant Browser
    participant Server
    participant MongoDB
    User->>Browser: Fill credentials/upload/config forms
    Browser->>Server: POST /client/:id/credentials
    Server->>MongoDB: Save credentials
    MongoDB-->>Server: Success/Error
    Server-->>Browser: JSON response
    Browser->>Server: POST /client/:id/upload
    Server->>MongoDB: Save file info
    MongoDB-->>Server: Success/Error
    Server-->>Browser: JSON response
    Browser->>Server: POST /client/:id/config
    Server->>MongoDB: Save campaign config
    MongoDB-->>Server: Success/Error
    Server-->>Browser: JSON response
Loading

Entity relationship diagram for Client and Admin models in MongoDB

erDiagram
    CLIENT {
      string clientId PK "Unique client identifier"
      string name
      string email
      string status
      string plan
      date createdAt
      date updatedAt
      date lastLogin
    }
    CLIENT_CREDENTIALS {
      string platform
      string username
      string password
      boolean isActive
      date lastTested
      string connectionStatus
    }
    CLIENT_CAMPAIGNS {
      string name
      string automationType
      string instructions
      string status
      date createdAt
      date lastRun
    }
    CLIENT_UPLOADED_FILES {
      string fileName
      string originalName
      number fileSize
      string fileType
      date uploadDate
      number processedRows
      number validRows
      string status
    }
    CLIENT_ACTIVITY_LOGS {
      string type
      string message
      string details
      date timestamp
    }
    ADMIN {
      string username PK
      string email
      string password
      string role
      boolean isActive
      date lastLogin
      number loginAttempts
      date lockUntil
      date createdAt
      date updatedAt
    }
    ADMIN_ACTIVITY_LOGS {
      string action
      string targetType
      string targetId
      string details
      string ipAddress
      date timestamp
    }
    CLIENT ||--o{ CLIENT_CREDENTIALS : has
    CLIENT ||--o{ CLIENT_CAMPAIGNS : has
    CLIENT ||--o{ CLIENT_UPLOADED_FILES : has
    CLIENT ||--o{ CLIENT_ACTIVITY_LOGS : has
    ADMIN ||--o{ ADMIN_ACTIVITY_LOGS : has
Loading

Class diagram for Client and Admin Mongoose models

classDiagram
    class Client {
      +String clientId
      +String name
      +String email
      +[Credential] credentials
      +[Campaign] campaigns
      +[UploadedFile] uploadedFiles
      +[ActivityLog] activityLogs
      +String status
      +String plan
      +Date createdAt
      +Date updatedAt
      +Date lastLogin
      +addActivityLog(type, message, details)
      +static findByClientId(clientId)
    }
    class Credential {
      +String platform
      +String username
      +String password
      +Boolean isActive
      +Date lastTested
      +String connectionStatus
    }
    class Campaign {
      +String name
      +String automationType
      +String instructions
      +String status
      +Date createdAt
      +Date lastRun
    }
    class UploadedFile {
      +String fileName
      +String originalName
      +Number fileSize
      +String fileType
      +Date uploadDate
      +Number processedRows
      +Number validRows
      +String status
    }
    class ActivityLog {
      +String type
      +String message
      +String details
      +Date timestamp
    }
    class Admin {
      +String username
      +String email
      +String password
      +String role
      +[String] permissions
      +Boolean isActive
      +Date lastLogin
      +Number loginAttempts
      +Date lockUntil
      +[AdminActivityLog] activityLogs
      +comparePassword(candidatePassword)
      +incLoginAttempts()
      +resetLoginAttempts()
      +addActivityLog(action, targetType, targetId, details, ipAddress)
      +static findByUsername(username)
      +static findByEmail(email)
    }
    class AdminActivityLog {
      +String action
      +String targetType
      +String targetId
      +String details
      +String ipAddress
      +Date timestamp
    }
    Client "1" o-- "many" Credential
    Client "1" o-- "many" Campaign
    Client "1" o-- "many" UploadedFile
    Client "1" o-- "many" ActivityLog
    Admin "1" o-- "many" AdminActivityLog
Loading

File-Level Changes

Change Details Files
Enhanced landing page with interactive visuals and new sections
  • Expanded CSS custom properties, nav/hero styling, and responsive rules in style.css
  • Appended comprehensive styles for particles background, floating community, AI agents, workflow, terminal, and animations
  • Modified home.ejs to insert particles canvas, workflow steps, terminal section, community block, AI agent cards, and animation script
  • Created landing-page.js to drive the particle animation background
public/css/style.css
views/home.ejs
public/js/landing-page.js
Refactored client dashboard scripts and templates for async API calls
  • Removed legacy test-connection logic and CSS rules
  • Converted save/upload/config buttons to async/await fetch requests with input validation, loading states, and error handling
  • Updated client-layout.ejs and header.ejs to include new scripts and reorganized layout structure
  • Cleaned up client-dashboard.css and client/dashboard.ejs to reflect removed features
public/js/client-dashboard.js
views/layouts/client-layout.ejs
views/partials/header.ejs
views/client/dashboard.ejs
public/css/client-dashboard.css
Integrated MongoDB with Mongoose models and REST API routes
  • Implemented database.js to connect via dotenv with robust mongoose options and graceful shutdown
  • Added Client and Admin schemas/models with password hashing, enums, indexes, and activity log methods
  • Extended routes/client.js to handle client creation, credentials, file uploads, configuration, and log retrieval
  • Introduced initDatabase script and MongoDB setup guide documentation
config/database.js
models/Client.js
models/Admin.js
routes/client.js
scripts/initDatabase.js
MONGODB_SETUP.md
Updated project configuration with new dependencies and startup scripts
  • Added mongoose, dotenv, bcryptjs, nodemon to package.json and defined dev/init-db scripts
  • Modified server.js to load environment variables and establish database connection on startup
package.json
server.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors