mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-01 17:19:56 -06:00
Major Features: - Add project costs feature with full CRUD operations - Implement toast notification system for better user feedback - Enhance analytics dashboard with improved visualizations - Add OIDC authentication improvements and debug tools Improvements: - Enhance reports with new filtering and export capabilities - Update command palette with additional shortcuts - Improve mobile responsiveness across all pages - Refactor UI components for consistency Removals: - Remove license server integration and related dependencies - Clean up unused license-related templates and utilities Technical Changes: - Add new migration 018 for project_costs table - Update models: Project, Settings, User with new relationships - Refactor routes: admin, analytics, auth, invoices, projects, reports - Update static assets: CSS improvements, new JS modules - Enhance templates: analytics, admin, projects, reports Documentation: - Add comprehensive documentation for project costs feature - Document toast notification system with visual guides - Update README with new feature descriptions - Add migration instructions and quick start guides - Document OIDC improvements and Kanban enhancements Files Changed: - Modified: 56 files (core app, models, routes, templates, static assets) - Deleted: 6 files (license server integration) - Added: 28 files (new features, documentation, migrations)
71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Time Tracker Application Entry Point
|
|
"""
|
|
|
|
import os
|
|
from app import create_app, db
|
|
from app.models import User, Project, TimeEntry, Task, Settings, Invoice, InvoiceItem, Client
|
|
|
|
app = create_app()
|
|
|
|
@app.shell_context_processor
|
|
def make_shell_context():
|
|
"""Add database models to Flask shell context"""
|
|
return {
|
|
'db': db,
|
|
'User': User,
|
|
'Project': Project,
|
|
'TimeEntry': TimeEntry,
|
|
'Task': Task,
|
|
'Settings': Settings,
|
|
'Invoice': Invoice,
|
|
'InvoiceItem': InvoiceItem,
|
|
'Client': Client
|
|
}
|
|
|
|
@app.cli.command()
|
|
def init_db():
|
|
"""Initialize the database with tables and default data"""
|
|
from app.models import Settings, User
|
|
|
|
# Create all tables
|
|
db.create_all()
|
|
|
|
# Initialize settings if they don't exist
|
|
if not Settings.query.first():
|
|
settings = Settings()
|
|
db.session.add(settings)
|
|
db.session.commit()
|
|
print("Database initialized with default settings")
|
|
|
|
# Create admin user if it doesn't exist
|
|
admin_username = os.getenv('ADMIN_USERNAMES', 'admin').split(',')[0]
|
|
if not User.query.filter_by(username=admin_username).first():
|
|
admin_user = User(username=admin_username, role='admin')
|
|
db.session.add(admin_user)
|
|
db.session.commit()
|
|
print(f"Created admin user: {admin_username}")
|
|
|
|
print("Database initialization complete!")
|
|
|
|
@app.cli.command()
|
|
def create_admin():
|
|
"""Create an admin user"""
|
|
username = input("Enter admin username: ").strip()
|
|
if not username:
|
|
print("Username cannot be empty")
|
|
return
|
|
|
|
if User.query.filter_by(username=username).first():
|
|
print(f"User {username} already exists")
|
|
return
|
|
|
|
user = User(username=username, role='admin')
|
|
db.session.add(user)
|
|
db.session.commit()
|
|
print(f"Created admin user: {username}")
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=8080, debug=os.getenv('FLASK_DEBUG', 'false').lower() == 'true')
|