Source Code For Major - Free Lance Websites in SQL F...
Source Code For Major - Free Lance Websites in SQL F...
freelancing websites is not possible due to intellectual property and security reasons. Their
source code remains private.
However, we can create a sample SQL schema to represent data relevant to a freelancing
platform:
-- Database: freelancing_platform
-- Table: users
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
first_name VARCHAR(255),
last_name VARCHAR(255),
about_me TEXT,
skills TEXT,
location VARCHAR(255),
hourly_rate DECIMAL(10,2),
user_type ENUM('client', 'freelancer'), -- Client or Freelancer
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Table: projects
CREATE TABLE projects (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
category VARCHAR(255), -- Category of project (e.g., Web
Development, Design)
budget DECIMAL(10,2),
posted_by INT NOT NULL, -- Foreign key referencing users.id
(client)
assigned_to INT, -- Foreign key referencing users.id
(freelancer) - null if not assigned
status ENUM('open', 'in_progress', 'completed'),
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Table: proposals
CREATE TABLE proposals (
id INT AUTO_INCREMENT PRIMARY KEY,
project_id INT NOT NULL, -- Foreign key referencing projects.id
freelancer_id INT NOT NULL, -- Foreign key referencing users.id
proposed_rate DECIMAL(10,2),
cover_letter TEXT,
submitted_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Table: reviews
CREATE TABLE reviews (
id INT AUTO_INCREMENT PRIMARY KEY,
project_id INT NOT NULL, -- Foreign key referencing projects.id
reviewer_id INT NOT NULL, -- Foreign key referencing users.id
(client or freelancer)
reviewed_id INT NOT NULL, -- Foreign key referencing users.id
(freelancer or client)
rating INT, -- Rating (e.g., 1-5 stars)
comment TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Table: payments
CREATE TABLE payments (
id INT AUTO_INCREMENT PRIMARY KEY,
project_id INT NOT NULL, -- Foreign key referencing projects.id
freelancer_id INT NOT NULL, -- Foreign key referencing users.id
amount DECIMAL(10,2),
payment_method VARCHAR(255),
payment_date DATETIME,
status ENUM('pending', 'completed')
);
Explanation:
● users: Stores user information like username, email, password, profile details, and user
type (client or freelancer).
● projects: Represents projects posted on the platform with details like title, description,
category, budget, client (posted_by), assigned freelancer (assigned_to), and status (open,
in_progress, completed).
● proposals: Captures proposals submitted by freelancers for projects, including proposed
rate and cover letter.
● reviews: Stores project-related reviews left by either clients or freelancers for each other.
● payments: Tracks payments made to freelancers for completed projects.
Important Note: This is a sample schema. Real-world freelancing platforms might have
additional tables and functionalities.
● https://github.com/EdsonPetry/whats-cooking
● https://github.com/jrs-coding-school/jrs-watch-shop-api-2022-cohort-1-group-project