avanine / tsoha-chat-app

Tietokannat ja web-ohjelmointi 2024
0 stars 0 forks source link

Chat App

Pylint

A chat application built with Flask and PostgreSQL, featuring categories, threads, and messages. Categories contain discussion threads, which consist of messages. Users must be logged in to view and participate in discussions. The app supports both regular users and administrators, with admins having additional privileges like managing categories and creating private categories.

Table of Contents

Current Progress

Visitors are able to register either as an admin or regular user, and log in with the username and password that they created. Possible error messages: username already in use, passwords don't match, incorrect username or password.

image

After logging in, there is a list of categories that the user has access to, including the amount of threads and messages, as well as the time of last message for each category. Clicking on the category name opens up the category page (not fully done yet). Admins can also see a button for creating a new category.

image (2)

All users can see their username and role, and log out using the menu at the top right of the page.

image (3)

Admin users can create a new public or private category.

image (4)

If they choose to create a private category, they are able to select the users that they want to give access to.

image (5)

Next Steps

How to Test

The app was originally deployed to Fly.io, but due to very unclear pricing, I have taken it down. This means that the app will have to be tested locally.

  1. Clone the repository and navigate to the root directory

  2. Create a .env file with the following variables, changing the values to your own

DATABASE_URL=postgresql:///yourlocaldatabaseaddress
SECRET_KEY=supersecret
  1. Activate Python's virtual environment and install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r ./requirements.txt
  1. Specify database schema
psql < schema.sql
  1. Run the app 🦄
flask run

Features

General User Features

Admin Features

Tech Stack

Database Structure

database-structure