A todo and personal organisation app
README.md

Toadist Server#

This directory contains the Dart backend server for the Toadist application.

Admin User Management Scripts#

This server includes several pre-compiled administrative tools specifically designed to easily manage registered users interacting with the database. These scripts act as a secure, backend-only fallback to reset credentials without relying on an external email server.

Because these commands interact exclusively via the server's internal link to the PostgreSQL database on the Docker bridge network, they must be run directly inside the running toadist-server Docker container.

1. List All Users#

Use this script to get an overview of all active users in the database, including their unique IDs, usernames, emails, and account creation timestamps.

docker compose exec server /app/bin/list_users

2. Search For User#

Use this script to retrieve specific profile data on a single user. You can pass either the exact username or the email address.

# Example: searching by username
docker compose exec server /app/bin/search_user testuser

# Example: searching by email
docker compose exec server /app/bin/search_user testuser@example.com

3. Reset Password#

Use this script to forcefully reset a user's password. The script fetches the user by either username or email, generates a new cryptographic salt, hashes the updated password securely using the Argon2 algorithm, explicitly updates the database, and finally forcefully invalidates/revokes any active JWT Refresh sessions utilizing the old credentials.

docker compose exec server /app/bin/reset_password <username_or_email> <new_secure_password123>

Security Note: Passwords via this script enforce a strict minimum of 8 characters.


Running Automated Tests for Admin Scripts#

Integration tests have been provided for these features within server/test/integration/admin_scripts_test.dart.

Because the underlying Dart test framework requires similar isolated execution scopes against the database networking to adequately assess functionality, the local codebase integrates compiling the test file into a functional binary and executing it within the container.

To successfully run and test the admin scripts integration logic:

# From the project root

# 1. Compile the test binary locally
cd server && dart compile exe test/integration/admin_scripts_test.dart -o bin/admin_test && cd ..

# 2. Inject binary into live container 
docker compose cp server/bin/admin_test server:/app/bin/admin_test

# 3. Fire the test execution isolated payload
docker compose exec server /app/bin/admin_test