Skip to content

Backend Code Documentation

alanpear edited this page Dec 18, 2025 · 3 revisions

Authentication & User Management

.registerUser.py

  • The backend for signup.html
  • Makes sure data exists in both the auth provider and the database
  • Hashes Password, Cognito Sign-Up, and DynamoDB Storage

.updatePasswordHash.py

  • Keeps the database in sync when a user resets their password
  • Used after a successful Forgot Password flow

.getQRSecret.py

  • The first step in enabling Multi-Factor Authentication
  • It uses Cognito's associate_software_token to generate a secret code
  • The frontend uses this code to generate the QR code that users scan with Google Authenticator

.verifyTOTP.py

  • Verifies the 6-digit code from the user's authenticator app
  • Used during both setup and login
  • It uses verify_software_token to validate the code against the user's session

Core Business Logic

.TireSearchFunction.cjs

  • Finds tires for a specific vehicle
  • Queries the VehicleTireSizes DynamoDB table to find the correct tire size

Vehicle Management

.saveVehicle.py

  • Saves a vehicle to the user's history
  • Checks the TireShop-Vehicles table for duplicates first
  • If not it generates a unique vehicleId and saves the record with a timestamp

.getVehicles.py

  • Retrieves the user's vehicle list
  • Scans the TireShop-Vehicles table for all items matching the username

.deleteVehicle.py

  • Deletes a saved vehicle
  • Accepts a vehicleId and permanently removes that item from the TireShop-Vehicles table

Utility & Analytics

.LogActivityFunction.cjs

  • Tracks user behavior for analytics or debugging
  • Writes an event log (User ID, Page, Action, Timestamp) to the UserActivityLogs DynamoDB table

Clone this wiki locally