Skip to content

Riveong/Audit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Audit Checklist App

Node.js React PostgreSQL Express.js TailwindCSS JWT

License Version Status Maintenance

A comprehensive web application for managing grooming audit checklists, tracking violations, and monitoring inspection progress across multiple sites.

πŸš€ Features

  • User Authentication: Secure login system with JWT tokens
  • Site Management: Add, view, and delete inspection sites
  • Violation Management: Create and manage violation types with drag-and-drop ordering
  • Checklist Management: Create inspection checklists with image uploads
  • Progress Tracking: Mark violations as found/not found with notes
  • Status Management: Mark checklists as completed
  • Advanced Filtering: Filter by site, completion status, and search terms
  • Statistics Dashboard: Overview of completion rates, violation rates, and overdue items
  • Responsive Design: Works on desktop and mobile devices

πŸ› οΈ Tech Stack

Backend

Node.js Express PostgreSQL JWT

  • Node.js with Express.js
  • PostgreSQL (Neon Database)
  • JWT for authentication
  • Multer for file uploads
  • bcryptjs for password hashing

Frontend

React Vite TailwindCSS Axios

  • React with Vite
  • Tailwind CSS for styling
  • Axios for API calls
  • React Hooks for state management

πŸ“‹ Prerequisites

Node.js Required npm Required PostgreSQL Required

  • Node.js (v14 or higher)
  • npm or yarn
  • PostgreSQL database (or Neon account)

πŸ”§ Installation

Setup Time

1. Clone the repository

git clone <repository-url>
cd BASIC-GROOMING/Audit-Checklist-App

2. Backend Setup

cd "checklist app/api"
npm install

Create a .env file in the api directory:

cp .env.example .env

Update the .env file with your database credentials:

DB_HOST=your-database-host
DB_PORT=5432
DB_NAME=your-database-name
DB_USER=your-database-user
DB_PASSWORD=your-database-password
PORT=3001
JWT_SECRET=your-jwt-secret-key

3. Frontend Setup

cd "../src"
npm install

4. Database Setup

Auto Setup

The application will automatically create the required tables on first run:

  • grm_sites - Site management
  • grm_violations - Violation types
  • grm_checklist - Inspection checklists
  • grm_checklist_progress - Progress tracking
  • grm_users - User authentication

πŸš€ Running the Application

Development Port 3001 Port 5173

Start the Backend Server

cd "checklist app/api"
npm start

Server will run on http://localhost:3001

Start the Frontend Development Server

cd "checklist app/src"
npm run dev

Frontend will run on http://localhost:5173

πŸ“Š Database Schema

PostgreSQL Tables

Sites (grm_sites)

  • id - Primary key
  • sites - Site name
  • created_at - Timestamp

Violations (grm_violations)

  • id - Primary key
  • violations - Violation description
  • order_index - For custom ordering
  • created_at - Timestamp

Checklists (grm_checklist)

  • id - Primary key
  • name - Checklist name
  • site - Associated site
  • violations - Array of violation IDs
  • img_url - Image path
  • status - Completion status
  • created_at - Creation timestamp
  • updated_at - Last update timestamp

Progress (grm_checklist_progress)

  • id - Primary key
  • checklist_id - Foreign key to checklist
  • violation_id - Foreign key to violation
  • is_checked - Boolean for violation found
  • notes - Additional notes
  • checked_at - Timestamp when marked

Users (grm_users)

  • id - Primary key
  • username - Unique username
  • password - Hashed password
  • role - User role
  • created_at - Registration timestamp

πŸ”‘ API Endpoints

REST API JWT Protected

Authentication

  • POST /api/auth/login - User login

Sites

  • GET /api/sites - Get all sites
  • POST /api/sites - Create new site (protected)
  • DELETE /api/sites/:id - Delete site (protected)

Violations

  • GET /api/violations - Get all violations
  • POST /api/violations - Create violation (protected)
  • DELETE /api/violations/:id - Delete violation (protected)
  • PUT /api/violations/order - Update violation order (protected)

Checklists

  • GET /api/checklists - Get all checklists
  • GET /api/checklists/:id - Get checklist by ID
  • POST /api/checklists - Create checklist (protected)
  • PUT /api/checklists/:id - Update checklist (protected)
  • DELETE /api/checklists/:id - Delete checklist (protected)
  • PUT /api/checklists/:id/complete - Mark as completed (protected)

Progress

  • PUT /api/checklists/:checklistId/progress/:violationId - Update progress (protected)
  • GET /api/checklists/:checklistId/progress - Get progress
  • POST /api/checklists/:checklistId/reset - Reset progress (protected)

πŸ”’ Authentication

JWT

The application uses JWT tokens for authentication. Protected routes require a valid token in the Authorization header:

Authorization: Bearer <jwt-token>

πŸ“ Project Structure

Structure

BASIC-GROOMING/
└── Audit-Checklist-App/
    └── checklist app/
        β”œβ”€β”€ api/                 # Backend server
        β”‚   β”œβ”€β”€ controller.js    # Route controllers
        β”‚   β”œβ”€β”€ authController.js # Authentication logic
        β”‚   β”œβ”€β”€ db.js           # Database connection
        β”‚   β”œβ”€β”€ app.js          # Express app setup
        β”‚   β”œβ”€β”€ auth-migrate.js # Auth table migration
        β”‚   └── uploads/        # File uploads directory
        └── src/                # Frontend React app
            β”œβ”€β”€ components/     # React components
            β”œβ”€β”€ pages/         # Page components
            β”œβ”€β”€ services/      # API services
            └── main.jsx       # App entry point

🎯 Usage

User Friendly

  1. Login: Use the authentication system to access admin features
  2. Manage Sites: Add locations where inspections will be conducted
  3. Setup Violations: Define the types of violations to check for
  4. Create Checklists: Create inspection checklists for specific sites
  5. Conduct Inspections: Mark violations as found/not found with optional notes
  6. Track Progress: Monitor completion rates and violation statistics
  7. Complete Inspections: Mark checklists as completed when done

πŸ”„ Features in Detail

Features

Violation Management

  • Drag and drop to reorder violations
  • Custom violation descriptions
  • Bulk management capabilities

Progress Tracking

  • Real-time progress updates
  • Notes for each violation
  • Reset functionality for re-inspections

Status Management

  • Due date tracking (1 week after creation)
  • Overdue indicators
  • Completion status badges

Filtering & Search

  • Filter by site, completion status
  • Sort by various criteria
  • Search by name or site

🀝 Contributing

Contributions Welcome PRs Welcome

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

πŸ“ License

MIT License

This project is licensed under the MIT License.

πŸ› Known Issues

Issues

  • File upload size limited to 5MB
  • Only image files supported for checklist attachments

Made with Love Built for Auditing

About

A comprehensive web application for managing grooming audit checklists, tracking violations, and monitoring inspection progress across multiple sites.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages