meme commit que avant
CI - Security, Lint & Tests / validate (push) Failing after 58s

This commit is contained in:
cedrick2711
2026-09-01 14:17:47 -04:00
parent 85eca9edd4
commit b43c5b1734
8 changed files with 527 additions and 100 deletions
+44
View File
@@ -25,9 +25,53 @@ import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from app.app import create_app # noqa: E402
from app.extensions import db as _db # noqa: E402
from app.extensions import hash_password # noqa: E402
from app.local_postgres import start as start_local_pg # noqa: E402
from app.models import Admin, Coach, Manager, Player # noqa: E402
# ==========================================================================
# Local PostgreSQL (development only)
# ==========================================================================
if os.getenv('LOCAL_PG', '').lower() == 'true':
os.environ['DATABASE_URL'] = start_local_pg()
# ==========================================================================
if __name__ == '__main__':
app = create_app()
# --- Seed the database with default test users (idempotent) ---------
with app.app_context():
if not Admin.query.first():
print('[INFO] Seeding database with default test users ...')
users = [
Admin(username='admin', role='admin', full_name='Admin', email='[email protected]'),
Coach(
username='coach',
role='coach',
full_name='Coach Test',
email='[email protected]',
),
Manager(
username='manager',
role='manager',
full_name='Manager Test',
email='[email protected]',
),
Player(
username='player',
role='player',
full_name='Player Test',
email='[email protected]',
),
]
for u in users:
u.password_hash = hash_password('password')
_db.session.add(u)
_db.session.commit()
print('[INFO] Seeded 4 default users (password for all: password).')
debug_mode = os.getenv('FLASK_DEBUG', 'false').lower() == 'true'
if debug_mode:
app.logger.warning(