Created by Kyra Evjen, Beth Nipper, and Ken Dompier
This project is a commission tracker web application designed to help users manage their commissions, portfolios, and payments efficiently.
- Kyra: Backend, Javascript, CRUD Implementation
- Beth: Backend, Javascript, CRUD Implementation
- Ken: Frontend, Javascript, Stylizing & CSS
- Ensure all requirements are installed.
- Create a folder named 'logs' and add an 'app.log' file to store logs.
- Create an
.envfile with your MongoDB connection,MONGO_URI, and aSECRET_KEY. - Create virtual environment with
python -m venv venv. - Activate the virtual environment with
.\venv\scripts\activate. - Run the application using Uvicorn:
uvicorn main:app --reload.
Login Page
Commission Page
Payments Page
Portfolio Page
Add Commission Model
Add Portfolio Item Model

- Add Commission:
POST /commissions - Get Commissions:
GET /commissions - Get Commission by ID:
GET /commissions/{id} - Update Commission:
PUT /commissions/{commission_id} - Delete Commission:
DELETE /commissions/{commission_id}
- Console Logging: Logs are displayed on the console.
- File Logging: Logs are saved to a file named
app.login thelogsdirectory. Log files are rotated daily.
/: Displays the login page./commissions: Handles commission-related operations./portfolios: Handles portfolio-related operations./payments: Handles payment-related operations./users: Handles user-related operations.
main.py: Contains the FastAPI application setup.commission.py: Defines commission-related endpoints and logic.portfolio.py: Defines portfolio-related endpoints and logic.payment.py: Defines payment-related endpoints and logic.user.py: Defines user-related endpoints and logic.frontend/: Contains frontend files (e.g., HTML, CSS, JavaScript).
model.py
Represents a commission with the following fields:
_id: Commission IDmongodb_id: MongoDB ID (aliased as_id)title: Commission titledescription: Commission descriptionstatus: Commission statuswidth: Width of the status barcolor: Color of the status bardate: Date commission started
Commission Request Model
Represents a request body for creating or updating a commission with the following fields:
title: Commission titledescription: Commission descriptionstatus: Commission statuswidth: Width of the status barcolor: Color of the status bardate: Date commission started
User Model
Represents a user with the following fields:
username: User's usernamepassword: User's password
Portfolio Model
Represents a portfolio with the following fields:
_id: Portfolio IDmongodb_id: MongoDB ID (aliased as_id)name: Portfolio Item nameimage: URL of the portfolio imagedescription: Item description
Portfolio Request Model
Represents a request body for creating or updating a portfolio with the following fields:
name: Portfolio item nameimage: URL of the portfolio imagedescription: Item description
Payment Model
Represents a payment with the following fields:
_id: Payment IDmongodb_id: MongoDB ID (aliased as_id)status: Payment statusamount: Payment amount
Payment Request Model
Represents a request body for creating or updating a payment with the following fields:
status: Payment statusamount: Payment amount
payment.py
Routes
POST /payments
- Creates a new payment.
GET /payments
- Retrieves all payments.
GET /payments/{id}
- Retrieves a payment by its ID.
PUT /payments/{payment_id}
- Updates a payment by its ID.
DELETE /payments/{payment_id}
- Deletes a payment by its ID.
portoflio.py
Routes
POST /portfolios
- Creates a new portfolio.
GET /portfolios
- Retrieves all portfolios.
GET /portfolios/{id}
- Retrieves a portfolio by its ID.
PUT /portfolios/{portfolio_id}
- Updates a portfolio by its ID.
DELETE /portfolios/{portfolio_id}
- Deletes a portfolio by its ID.
security.py
- The hash_password function takes a plain text password as input and returns its hashed version.
- The verify_password function takes a plain text password and its hashed version as inputs and returns True if the password matches the hash, otherwise False.
user_manager.py
- User Creation and authentication
- MongoDB integration for storin guser data securely
- Password hashing for enhanced security
user.py API Endpoints
POST /signup: Create a new user account.
- Request Body: JSON object containing username and password.
- Response: JSON object with message and user ID.
POST /login: Log in with existing user credentials.
- Request Body: JSON object containing username and password.
- Response: JSON object with message, username, and JWT token.
GET /users/me: Get details of the current logged-in user.
- Authentication: Bearer token.
- Response: JSON object with user details.
Authentication Authentication is done using JWT (JSON Web Tokens). The SECRET_KEY provided in the .env file is used to encode and decode JWT tokens. User passwords are hashed using bcrypt for security.
Plans to implement functional Admin/User roles are reminent in the user.py code, but are not currently functional. It is a feature to be added in the future.
- Ensure the HTML file contains elements with specific IDs for login and signup forms.
- Interacts with a backend server for user authentication. Requires endpoints
/loginand/signupon the server.
loginUser(username, password): Sends a login request to the/loginendpoint.signupUser(username, password): Sends a signup request to the/signupendpoint.
- Attached to form submission events for login and signup.
- Additional listeners for toggling between login and signup forms.
- Navbar: Navigation links to different sections of the application.
- Title: Displays the title of the page ("Commissions").
- Add New Commission Button: Triggers modal for adding a new commission.
- Commissions Display Area: Displays the list of commissions.
- Modal for Adding a New Commission
- Modal for Editing a Commission
- Deleting a Commission (feature to be added in the future)
- Handles user interactions, data management, and API requests.
- Manages portfolio items: fetching, adding, editing, and deleting.
- Similar to main.js & index.html, but tailored for portfolio management.
- Manages payment transactions: fetching, adding, editing, and deleting.
- Similar to portfolio.js & portfolio.html, but for payments.
- Defines styles specific to portfolio pages.
- Defines general styles for the application.
- Contains sounds for the application.
- Contains visual assets, including GIFs.
