fix
This commit is contained in:
@@ -7,7 +7,8 @@
|
|||||||
"WebFetch(domain:gearboxgo.com)",
|
"WebFetch(domain:gearboxgo.com)",
|
||||||
"WebFetch(domain:primevue.org)",
|
"WebFetch(domain:primevue.org)",
|
||||||
"WebFetch(domain:core.telegram.org)",
|
"WebFetch(domain:core.telegram.org)",
|
||||||
"WebFetch(domain:docs.telegram-mini-apps.com)"
|
"WebFetch(domain:docs.telegram-mini-apps.com)",
|
||||||
|
"Bash(ls:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
.env
Normal file
22
.env
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Database
|
||||||
|
DATABASE_URL=postgresql+asyncpg://sport_platform:VV1q2w3e4r!@31.59.58.220:5432/sport_platform
|
||||||
|
|
||||||
|
# Anthropic
|
||||||
|
ANTHROPIC_API_KEY=sk-ant-...
|
||||||
|
# Gemini
|
||||||
|
GEMINI_API_KEY=AIzaSyAHzDYhgjOqZZnvOnOFRGaSkKu4OAN3kZE
|
||||||
|
GEMINI_MODEL=gemini-3.1-pro-preview
|
||||||
|
|
||||||
|
# App
|
||||||
|
APP_SECRET_KEY=8S2aSrfih33CEHN2j7qAKMZ07wG2CbvyuqwaFgRLy4O
|
||||||
|
DEBUG=true
|
||||||
|
|
||||||
|
# Auth / JWT
|
||||||
|
JWT_SECRET_KEY=Jys4QlZP3ZPyNKKJBhSyPbqsHG1dU327ujYFZEYoyRT
|
||||||
|
|
||||||
|
# Telegram Bot
|
||||||
|
TELEGRAM_BOT_TOKEN=8100161487:AAHHJfNe0Ww12sGQih_osNK9gx1wrpe2ZHQ
|
||||||
|
TELEGRAM_BOT_USERNAME=sportplatformbot
|
||||||
|
|
||||||
|
# Upload
|
||||||
|
UPLOAD_DIR=./uploads
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[alembic]
|
[alembic]
|
||||||
script_location = alembic
|
script_location = backend/alembic
|
||||||
sqlalchemy.url = postgresql+asyncpg://velobrain:velobrain@localhost:5432/velobrain
|
sqlalchemy.url = postgresql+asyncpg://velobrain:velobrain@localhost:5432/velobrain
|
||||||
|
|
||||||
[loggers]
|
[loggers]
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
from logging.config import fileConfig
|
from logging.config import fileConfig
|
||||||
|
|
||||||
|
# Add project root to sys.path so "backend.app..." imports work
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||||
|
|
||||||
from alembic import context
|
from alembic import context
|
||||||
from sqlalchemy import pool
|
from sqlalchemy import pool
|
||||||
from sqlalchemy.ext.asyncio import create_async_engine
|
from sqlalchemy.ext.asyncio import create_async_engine
|
||||||
|
|||||||
162
backend/alembic/versions/928b78044640_initial_schema.py
Normal file
162
backend/alembic/versions/928b78044640_initial_schema.py
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
"""initial schema
|
||||||
|
|
||||||
|
Revision ID: 928b78044640
|
||||||
|
Revises:
|
||||||
|
Create Date: 2026-03-16 12:53:09.720225
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = '928b78044640'
|
||||||
|
down_revision: Union[str, None] = None
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('riders',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('telegram_id', sa.BigInteger(), nullable=True),
|
||||||
|
sa.Column('telegram_username', sa.String(length=100), nullable=True),
|
||||||
|
sa.Column('avatar_url', sa.String(length=500), nullable=True),
|
||||||
|
sa.Column('name', sa.String(length=100), nullable=False),
|
||||||
|
sa.Column('ftp', sa.Float(), nullable=True),
|
||||||
|
sa.Column('lthr', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('weight', sa.Float(), nullable=True),
|
||||||
|
sa.Column('zones_config', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||||
|
sa.Column('goals', sa.String(length=500), nullable=True),
|
||||||
|
sa.Column('experience_level', sa.String(length=50), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||||
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_riders_telegram_id'), 'riders', ['telegram_id'], unique=True)
|
||||||
|
op.create_table('activities',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('rider_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('name', sa.String(length=200), nullable=True),
|
||||||
|
sa.Column('activity_type', sa.String(length=50), nullable=False),
|
||||||
|
sa.Column('date', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('duration', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('distance', sa.Float(), nullable=True),
|
||||||
|
sa.Column('elevation_gain', sa.Float(), nullable=True),
|
||||||
|
sa.Column('file_path', sa.String(length=500), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['rider_id'], ['riders.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('fitness_history',
|
||||||
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
|
sa.Column('rider_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('date', sa.Date(), nullable=False),
|
||||||
|
sa.Column('ctl', sa.Float(), nullable=False),
|
||||||
|
sa.Column('atl', sa.Float(), nullable=False),
|
||||||
|
sa.Column('tsb', sa.Float(), nullable=False),
|
||||||
|
sa.Column('ramp_rate', sa.Float(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['rider_id'], ['riders.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_fitness_history_date'), 'fitness_history', ['date'], unique=False)
|
||||||
|
op.create_table('training_plans',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('rider_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('goal', sa.String(length=200), nullable=False),
|
||||||
|
sa.Column('start_date', sa.Date(), nullable=False),
|
||||||
|
sa.Column('end_date', sa.Date(), nullable=False),
|
||||||
|
sa.Column('phase', sa.String(length=50), nullable=True),
|
||||||
|
sa.Column('weeks_json', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||||
|
sa.Column('description', sa.Text(), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['rider_id'], ['riders.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('activity_metrics',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('activity_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('tss', sa.Float(), nullable=True),
|
||||||
|
sa.Column('normalized_power', sa.Float(), nullable=True),
|
||||||
|
sa.Column('intensity_factor', sa.Float(), nullable=True),
|
||||||
|
sa.Column('variability_index', sa.Float(), nullable=True),
|
||||||
|
sa.Column('avg_power', sa.Float(), nullable=True),
|
||||||
|
sa.Column('max_power', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('avg_hr', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('max_hr', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('avg_cadence', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('avg_speed', sa.Float(), nullable=True),
|
||||||
|
sa.Column('calories', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('activity_id')
|
||||||
|
)
|
||||||
|
op.create_table('data_points',
|
||||||
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
|
sa.Column('activity_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('timestamp', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('power', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('heart_rate', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('cadence', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('speed', sa.Float(), nullable=True),
|
||||||
|
sa.Column('latitude', sa.Float(), nullable=True),
|
||||||
|
sa.Column('longitude', sa.Float(), nullable=True),
|
||||||
|
sa.Column('altitude', sa.Float(), nullable=True),
|
||||||
|
sa.Column('temperature', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_data_points_timestamp'), 'data_points', ['timestamp'], unique=False)
|
||||||
|
op.create_table('diary_entries',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('activity_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('ai_summary', sa.Text(), nullable=True),
|
||||||
|
sa.Column('rider_notes', sa.Text(), nullable=True),
|
||||||
|
sa.Column('mood', sa.String(length=50), nullable=True),
|
||||||
|
sa.Column('rpe', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('sleep_hours', sa.Float(), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('activity_id')
|
||||||
|
)
|
||||||
|
op.create_table('intervals',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('activity_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('start_ts', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('end_ts', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('interval_type', sa.String(length=50), nullable=False),
|
||||||
|
sa.Column('avg_power', sa.Float(), nullable=True),
|
||||||
|
sa.Column('avg_hr', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('duration', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('power_curves',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('activity_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('curve_data', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_table('power_curves')
|
||||||
|
op.drop_table('intervals')
|
||||||
|
op.drop_table('diary_entries')
|
||||||
|
op.drop_index(op.f('ix_data_points_timestamp'), table_name='data_points')
|
||||||
|
op.drop_table('data_points')
|
||||||
|
op.drop_table('activity_metrics')
|
||||||
|
op.drop_table('training_plans')
|
||||||
|
op.drop_index(op.f('ix_fitness_history_date'), table_name='fitness_history')
|
||||||
|
op.drop_table('fitness_history')
|
||||||
|
op.drop_table('activities')
|
||||||
|
op.drop_index(op.f('ix_riders_telegram_id'), table_name='riders')
|
||||||
|
op.drop_table('riders')
|
||||||
|
# ### end Alembic commands ###
|
||||||
1
frontend/.env
Normal file
1
frontend/.env
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VITE_TELEGRAM_BOT_USERNAME=sportplatformbot
|
||||||
Reference in New Issue
Block a user