Skip to content

Tim-Quattrochi/Second-Chance-Digital

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FSFI

Description

Important: Currently to use the 'test_gemini' command, you need to create a superuser in the backend to add questions to the database. The command requires a user ID parameter and will generate content based on the user's answers to questions. The command will automatically create GeneratedContent entries in the database with the generated content. This solution is not ideal, and is only temporary. If you need assistance with this process, Tim can help. As of 05/14/25.

Prerequisites

Table of Contents

Setup

Clone the repository

git clone git@github.com:NC-6-2-Capstones/FSFI.git
cd FSFI

Frontend Setup

cd frontend
npm install

Copy the .env.example to .env in the frontend folder:

  • Mac/Linux:
    cp .env.example .env
  • Windows (cmd):
    copy .env.example .env

Set the VITE_BASE_URL in .env to your backend URL (e.g., http://localhost:8000/api).

Run the frontend development server:

npm run dev

Open your browser to http://localhost:5173.

Backend Setup

cd backend

Install dependencies

  • Using Poetry (recommended):

    poetry install
    poetry shell
    • poetry add $(cat requirements.txt | grep -v '^#') #Adds dependencies from requirments.txt if using poetry instead of pip
  • Or using pip:

    pip install -r requirements.txt

Configure environment variables

Copy .env.example to .env:

  • Mac/Linux:
    cp .env.example .env
  • Windows (cmd):
    copy .env.example .env

Edit .env and set your credentials:

GOOGLE_API_KEY=your_gemini_api_key_here
POSTGRES_DB=your_db_name
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
DB_HOST=localhost

Run migrations

python manage.py migrate

Seed the database with questions

The application will automatically check if questions need to be seeded when the server starts and after database migrations are applied. If no questions exist in the database, it will automatically populate them.

Alternatively, you can manually seed the questions using:

python manage.py seed_questions

This command will populate the database with predefined questions that users will answer, including:

  • Goal setting for online presence
  • Accomplishments to highlight
  • Values to associate with their name
  • Skills and industries to feature
  • Personality traits
  • Causes they're passionate about
  • Preferred content voice
  • Topics and people to avoid mentioning

Start the Django server

python manage.py runserver

(Optional) Test Gemini API integration

python manage.py test_gemini userId

Technologies

  • Frontend : React,JavaScript,Typescript,React Router,Axios, ShadCN, Tailwind CSS.

  • Backend : Django, Django REST Framework, rest_framework_simplejwt(Token based login), Python Gemini SDK

  • Database : PostgreSQL

  • Other : python-decouple,gunicorn,etc..

Links

Back-End

Authentication

  • POST /api/token/ - Get JWT access and refresh tokens
  • POST /api/token/refresh/ - Refresh JWT token
  • POST /api/signup/ - Create a new user account

Tasks

  • GET /api/tasks/ - List user tasks
  • POST /api/tasks/ - Create a new task (user auto-set)
  • GET /api/tasks/{id}/ - Get specific task
  • PUT/PATCH /api/tasks/{id}/ - Update a task
  • DELETE /api/tasks/{id}/ - Delete a task

User Profiles

  • GET /api/user-profile/ - List current user profile
  • GET /api/user-profile/{id}/ - Retrieve specific user profile
  • PUT/PATCH /api/user-profile/{id}/ - Update a user profile
  • DELETE /api/user-profile/{id}/ - Delete a user profile

Saved Links

  • GET /api/saved-links/ - List all user's saved links
  • POST /api/saved-links/ - Create a new saved link
  • GET /api/saved-links/{id}/ - Retrieve a specific saved link
  • PUT/PATCH /api/saved-links/{id}/ - Update a saved link
  • DELETE /api/saved-links/{id}/ - Delete a saved link

Questions

  • GET /api/questions/ - List all questions
  • POST /api/questions/ - Create a new question
  • GET /api/questions/{id}/ - Retrieve a specific question
  • PUT/PATCH /api/questions/{id}/ - Update a question
  • DELETE /api/questions/{id}/ - Delete a question
  • POST /api/questions/{id}/answer/ - Submit an answer to a specific question
  • POST /api/questions/bulk-answer/ - Submit multiple answers at once

Answers

  • GET /api/answers/ - List all of current user's answers
  • POST /api/answers/ - Create a new answer
  • GET /api/answers/{id}/ - Retrieve a specific answer
  • PUT/PATCH /api/answers/{id}/ - Update an answer
  • DELETE /api/answers/{id}/ - Delete an answer

User Answers Optimized

  • GET /api/my-answers/ - Get optimized list of user answers
    • Query Parameters:
      • question_id - Filter by specific question
      • sort - Sort by 'question' or 'id'
      • include_unanswered - Include unanswered questions (true/false)

Generated Content

  • GET /api/generated-content/ - List user's generated content
  • POST /api/generated-content/ - Generate new content using Gemini AI
    • Returns 403 Forbidden if user hasn't completed at least 2 tasks AND saved at least one link since their last content generation
  • GET /api/generated-content/{id}/ - Retrieve specific generated content
  • PUT/PATCH /api/generated-content/{id}/ - Update generated content
  • DELETE /api/generated-content/{id}/ - Delete generated content

Front-End

Contributing

Contributions are welcome! Please feel free to submit a pull request if you would like to add new features, fix bugs, or improve the project.

Credits/Acknowledgements

We would like to extend our gratitude to the contributors, mentors, and the open-source community for their support and resources throughout the development of this project:

  • Open Source Community: Thank you for the invaluable tools, libraries, and documentation that made this project possible.
  • Mentors and Peers: Special thanks to those who provided feedback, ideas, and encouragement during the development process.
  • Content Creators and Educators: Appreciation for the tutorials, blog posts, and videos that guided the implementation of various features.

License

N/A.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6