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 dashboard with 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. Admins can also see a button for creating a new category.

image

A delete-button will appear by hovering over the category tile (admin feature).

image

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

image

All users can use the search bar to search for specific messages that they have access to.

image

Admin users can create a new public or private category.

image

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

image

Category pages display all threads within a category, with edit and delete options available for threads created by the logged-in user. In the main view, users can see all messages in the selected thread, along with a kebab menu for editing or deleting their own messages. An 'Edited' tag will appear on threads and messages that have been modified.

image

Possible improvements

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