Git Product home page Git Product logo

hackerschool / hs-tms Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 2.55 MB

HackerSchool's Treasury Management System: the main control system for treasury inside HackerSchool, which can read billing documents and write to a treasury balance

Home Page: https://hs-tms.ngfg.pt/

License: Apache License 2.0

Dockerfile 0.32% JavaScript 87.64% HTML 0.15% CSS 7.89% PLpgSQL 3.72% Shell 0.27%
file-manager treasury email-template pdf-generation nodejs plotly-js reactjs oauth2

hs-tms's Introduction

HS-TMS

HackerSchool's Treasury Management System: the main control system for the treasury inside HackerSchool, which can read billing documents and write to a treasury balance.

You can check out the app as a demo user in the current deployment.

Some of its key features:

  • Supports authentication via FenixEdu and also allows for authentication as a demo user.
  • Lets the users create reminders for treasury-related events, sending email notifications when they are reaching their due date
  • Transactions and Projects management
    • The transactions can be filtered by several criteria and then be printed to a PDF report, making periodical reports easy to create.
    • When creating a transaction, a PDF receipt may be attached, which will be available for download later
  • Data visualization through different types of charts
  • Every week, a summary of all the changes done to the system is sent via email
  • Remote access to server logs, allowing for easy activity monitoring and debugging

The app currently has five panels:

  • Dashboard: allows for a quick system overview, providing information such as the total balance, number of active projects, recent transactions, and upcoming reminders.
  • Transactions: shows all the transactions according to the specified filters and lets the user create, edit, or delete transactions as well as print a PDF report of the selected transactions.
  • Projects: displays the existing projects given the applied filters and allows the user to create, edit, or delete them.
  • Charts: several charts that help manage projects and their earnings/costs by providing different views of the treasury and ways to compare projects and periods.
  • Settings: lets the user manage the authorized members in the system and check the server logs remotely to check errors and activity in the backend.

Getting Started

Prerequisites:

  • Git for cloning the repo
  • Docker to run the project in a containerized environment
    • Docker Desktop is an all-in-one solution that provides a GUI that makes managing containers, images, and volumes easier.

Installation:

  1. Clone this repository
  2. Copy .env.example to .env
  3. Copy frontend/.env.example to frontend/.env
  4. Copy backend/.env.example to backend/.env
    • If you only want to log in as a demo user, set the following variables:
      • SESSION_SECRET=example
      • FENIX_CLIENT_ID=example
      • FENIX_CLIENT_SECRET=example
      • RESEND_API_KEY=example
    • If you want to log in using FenixEdu and use Resend to send summary/reminder emails, you'll need to set up FENIX_CLIENT_ID, FENIX_CLIENT_SECRET, and RESEND_API_KEY with your credentials. It is advised to set SESSION_SECRET to a bigger string of random characters to increase security, since it is used to sign cookies.
  5. Run docker compose up --build at the project root to create and run all the containers
    • add -d to detach the process from the terminal at the end
  6. Since we're using HTTPS, to ensure everything runs as expected, you need to import the caddy certificate to your browser:
    • To get the certificate, run docker cp hs-tms_caddy:/data/caddy/pki/authorities/local/root.crt ., which will place it in your current directory
    • Install it in your browser as an authority certificate. The procedure should be similar to this:
      1. Settings > Security > Manage certificates > Authorities > import
      2. Restart the browser to ensure the certificate is loaded
  7. If you'll be using FenixEdu authentication, you need to first add your username to the authorized people list (after having access to the system, you won't need to repeat this step to add other people, you can do it from inside the app in the 'Settings' tab)
    • run docker exec -it hs-tms_postgres psql -U postgres postgres -c "CALL create_user('#istID', '#Name');"
      • #istID follows the syntax ist1xxx
      • #Name can be your first and last name.

hs-tms's People

Contributors

alfigueiras avatar dependabot[bot] avatar filipe-varela avatar fmata97 avatar gui-alm avatar nunogoncalves03 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hs-tms's Issues

Date discrepancy: pg module query result differs from database value

When using the pg module in Node.js to query a resource with a date column, the retrieved date value is different from the expected value. For example, if the date column in the database has '2023-05-21' stored, the pg module query result is '2023-05-20T23:00:00.000Z'.

Create a trigger function to update the balance column in the transactions table

Currently, the transactions table has the value and balance columns. The balance column is supposed to represent the balance of the organization after each transaction, where balance = previous transaction's balance + value.

However, the balance column is not updated automatically after each transaction is inserted into the table.

We should create a trigger function that updates the balance column automatically after each INSERT operation on the transactions table.

Dockerize project

We need to dockerize our project to make it more portable and easier to deploy. Dockerization will also help us ensure consistent behavior across different environments.

Fix listTransactions function

This function is not working properly when filtering transactions made by certain projects.
For example, if we have the following projects and transactions:

Projects:
[
  { id: 1, name: 'Project 1', active: true },
  { id: 2, name: 'Project 2', active: true },
  { id: 3, name: 'Project 3', active: true }
]

Transactions:
[
  {
    id: 1,
    date: '2023-04-29',
    description: 'Transaction 1',
    value: '1000',
    file_path: 'file1.pdf',
    has_nif: true,
    projects: 'Project 1 / Project 2 / Project 3'
  }
]

If we call it to get only the transactions made by Project 1 and Project 2, it returns

[
  {
    id: 1,
    date: '2023-04-29',
    description: 'Transaction 1',
    value: '1000',
    file_path: 'file1.pdf',
    has_nif: true,
    projects: 'Project 1 / Project 2'
  }
]

instead of

[
  {
    id: 1,
    date: '2023-04-29',
    description: 'Transaction 1',
    value: '1000',
    file_path: 'file1.pdf',
    has_nif: true,
    projects: 'Project 1 / Project 2 / Project 3'
  }
]

(the projects field should include all projects linked to that transaction)

Not being able to distinguish an unauthorized user from one who hasn't tried to log in

From the frontend POV, it would be helpful to distinguish users who have tried to log in but are not authorized from those who haven't tried, so the authentication error is not displayed to those who haven't tried to log in.

Setting the API to return different error codes depending on whether an error occurred, the user is unauthorized, or not authenticated would suffice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.