mobile-responsive-layout #9

Merged
ryan merged 9 commits from mobile-responsive-layout into main 2025-10-29 21:15:14 -04:00
Showing only changes of commit 5e7ac28b6f - Show all commits

View File

@@ -1,16 +1,21 @@
# GENERATED BY CLAUDE # GENERATED BY CLAUDE
import os
import sys import sys
import uuid import uuid
import asyncio import asyncio
from tortoise import Tortoise from tortoise import Tortoise
from blueprints.users.models import User from blueprints.users.models import User
# Database configuration with environment variable support
DATABASE_PATH = os.getenv("DATABASE_PATH", "database/raggr.db")
DATABASE_URL = os.getenv("DATABASE_URL", f"sqlite://{DATABASE_PATH}")
async def add_user(username: str, email: str, password: str): async def add_user(username: str, email: str, password: str):
"""Add a new user to the database""" """Add a new user to the database"""
await Tortoise.init( await Tortoise.init(
db_url="sqlite://database/raggr.db", db_url=DATABASE_URL,
modules={ modules={
"models": [ "models": [
"blueprints.users.models", "blueprints.users.models",
@@ -56,7 +61,7 @@ async def add_user(username: str, email: str, password: str):
async def list_users(): async def list_users():
"""List all users in the database""" """List all users in the database"""
await Tortoise.init( await Tortoise.init(
db_url="sqlite://database/raggr.db", db_url=DATABASE_URL,
modules={ modules={
"models": [ "models": [
"blueprints.users.models", "blueprints.users.models",
@@ -94,6 +99,11 @@ def print_usage():
print("\nExamples:") print("\nExamples:")
print(" python add_user.py add ryan ryan@example.com mypassword123") print(" python add_user.py add ryan ryan@example.com mypassword123")
print(" python add_user.py list") print(" python add_user.py list")
print("\nEnvironment Variables:")
print(" DATABASE_PATH - Path to database file (default: database/raggr.db)")
print(" DATABASE_URL - Full database URL (overrides DATABASE_PATH)")
print("\n Example with custom database:")
print(" DATABASE_PATH=dev.db python add_user.py list")
async def main(): async def main():