0% found this document useful (0 votes)
3 views3 pages

software_architecture

The document outlines the software architecture for a system that includes tables for Users, Leads, Jobs, Messages, and Invoices, detailing their structures and relationships. It also provides a RESTful API structure for user authentication, lead management, job management, messaging, and invoicing functionalities. Each table is defined with relevant fields and constraints to support the application's operations.

Uploaded by

Sugumar Mca P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

software_architecture

The document outlines the software architecture for a system that includes tables for Users, Leads, Jobs, Messages, and Invoices, detailing their structures and relationships. It also provides a RESTful API structure for user authentication, lead management, job management, messaging, and invoicing functionalities. Each table is defined with relevant fields and constraints to support the application's operations.

Uploaded by

Sugumar Mca P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Software Architecture Document

# Users Table
CREATE TABLE Users (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(255),
role ENUM('customer', 'employee', 'admin', 'marketing') NOT NULL
);

# Leads Table
CREATE TABLE Leads (
id SERIAL PRIMARY KEY,
customer_id INT REFERENCES Users(id),
status ENUM('cold', 'warm', 'hot', 'converted') DEFAULT 'cold',
created_by INT REFERENCES Users(id),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

# Jobs Table
CREATE TABLE Jobs (
id SERIAL PRIMARY KEY,
title VARCHAR(255),
description TEXT,
customer_id INT REFERENCES Users(id),
assigned_to INT REFERENCES Users(id),
status ENUM('pending', 'in_progress', 'completed', 'invoiced') DEFAULT
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

# Messages Table (Chat System)


CREATE TABLE Messages (
id SERIAL PRIMARY KEY,
sender_id INT REFERENCES Users(id),
receiver_id INT REFERENCES Users(id),
job_id INT REFERENCES Jobs(id),
message TEXT,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

# Invoices Table
CREATE TABLE Invoices (
id SERIAL PRIMARY KEY,
job_id INT REFERENCES Jobs(id),
customer_id INT REFERENCES Users(id),
amount DECIMAL(10,2),
status ENUM('pending', 'paid') DEFAULT 'pending',
payment_details TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

# API Endpoints (RESTful Structure)


## User Authentication
POST /api/auth/register --> Register a new user
POST /api/auth/login --> User login

## Lead Management
POST /api/leads --> Create a new lead
GET /api/leads --> List all leads
PUT /api/leads/{id} --> Update lead status

## Job Management
POST /api/jobs --> Create a job
GET /api/jobs --> List jobs
PUT /api/jobs/{id} --> Update job status

## Messaging System
POST /api/messages --> Send message
GET /api/messages/{job_id} --> Get chat history for a job

## Invoicing
POST /api/invoices --> Generate an invoice
GET /api/invoices --> List invoices
PUT /api/invoices/{id} --> Update invoice status

You might also like