My Wiki!

**This is an old revision of the document!**

Local dev environment

Front-end

.env file

#export API_HOST=https://api.dev.x-hr.ai  --> use dev stack backend
export API_HOST=http://localhost:8080 --> use local backend (devlocal repo, identitiy-management-service?? as proxy)

AI agent

platform-frontend-app/src/shared/services/sse/SseServiceImpl.ts:54-56

        //const baseUrl = this.getBaseUrl()
        const baseUrl = "http://localhost:8080" --> Agent-service backend
        const url = `${baseUrl}${path}

identitiy-management-service

Database Setup

I've successfully inserted the dummy user into the local database. Here's what was done:

  1. Created a demo company: - ID: e388a122-4a87-498f-925e-520bbf200ce3 - Name: “Demo Company” - Domain: “demo.com”
  2. Created the demo user: - ID: df109bb1-e781-4b45-b4e8-f7731aec674f - Full Name: “Demo User” - Email: demo@demo.com - Password: DemoDemo (bcrypt hashed) - Status: ACTIVE - Group Type: EMPLOYEE - Email Verified: true - No password change required

Login Credentials

You can now login to the application using: - Email: demo@demo.com - Password: DemoDemo

Database Connection Details

  • Host: localhost:5432
  • Database: authdb
  • Username: admin
  • Password: secret

The user is active and ready for testing the login functionality. The password has been properly hashed using bcrypt for security.

Scripts:

#!/bin/bash

# Database setup script for demo user
# Usage: ./setup-demo-db.sh

DB_HOST="localhost"
DB_PORT="5432"
DB_NAME="authdb"
DB_USER="admin"
DB_PASSWORD="secret"

# Generate UUIDs
COMPANY_UUID=$(python3 -c "import uuid; print(str(uuid.uuid4()))")
USER_UUID=$(python3 -c "import uuid; print(str(uuid.uuid4()))")

# Hash the password
HASHED_PASSWORD=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b'DemoDemo', bcrypt.gensalt()).decode('utf-8'))")

echo "Generated Company UUID: $COMPANY_UUID"
echo "Generated User UUID: $USER_UUID"
echo "Hashed Password: $HASHED_PASSWORD"

# Insert company
echo "Inserting demo company..."
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "
INSERT INTO \"public\".\"companies\" (\"id_company\", \"name\", \"domain_name\", \"supported_login_methods\", \"self_signup_allowed\", \"created_at\", \"updated_at\", \"employee_id_generation_config\", \"logo\")
VALUES ('$COMPANY_UUID', 'Demo Company', 'demo.com', '{}', true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'SYSTEM_GENERATION', NULL);
"

if [ $? -eq 0 ]; then
    echo "Company inserted successfully."
else
    echo "Failed to insert company."
    exit 1
fi

# Insert user
echo "Inserting demo user..."
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "
INSERT INTO \"public\".\"users\" (\"id_user\", \"full_name\", \"email\", \"status\", \"fk_company\", \"source\", \"password\", \"requires_password_change\", \"last_password_change_at\", \"email_verification_required\", \"email_verified\", \"created_at\", \"updated_at\", \"fk_employee\", \"group_type\", \"avatar\", \"onboarding_authorization_completed\")
VALUES ('$USER_UUID', 'Demo User', 'demo@demo.com', 'ACTIVE', '$COMPANY_UUID', 'LOCAL', '$HASHED_PASSWORD', false, NULL, false, false, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, 'EMPLOYEE', NULL, false);
"

if [ $? -eq 0 ]; then
    echo "User inserted successfully."
    echo "Demo login credentials:"
    echo "Email: demo@demo.com"
    echo "Password: DemoDemo"
else
    echo "Failed to insert user."
    exit 1
fi

echo "Demo database setup completed!"

Navigation