Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ TEST_LISTENER_EMAIL=listener@test.com
TEST_LISTENER_PASSWORD=ListenerPass123!
TEST_LISTENER_FIRST_NAME=Test
TEST_LISTENER_LAST_NAME=Listener


# Email Configuration
EMAIL_PROVIDER=
SENDGRID_API_KEY=
FROM_EMAIL=
VERIFICATION_BASE_URL=

42 changes: 0 additions & 42 deletions backend/alembic/versions/0caba04c2ae1_refresh_token_rotation.py

This file was deleted.

51 changes: 0 additions & 51 deletions backend/alembic/versions/0cf1441527ec_added_refresh_token_model.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Updated Schema
"""Clean initial migration

Revision ID: e18b0c60c1c6
Revision ID: 0da5ab17c70f
Revises:
Create Date: 2025-07-23 16:28:40.730597
Create Date: 2025-08-21 09:53:48.250482

"""
from typing import Sequence, Union
Expand All @@ -12,7 +12,7 @@


# revision identifiers, used by Alembic.
revision: str = 'e18b0c60c1c6'
revision: str = '0da5ab17c70f'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
Expand All @@ -21,19 +21,6 @@
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('bands',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('name', sa.String(length=50), nullable=False),
sa.Column('bio', sa.Text(), nullable=True),
sa.Column('profile_picture', sa.String(length=255), nullable=True),
sa.Column('social_link', sa.JSON(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('is_disabled', sa.Boolean(), nullable=False),
sa.Column('disabled_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name', name='uq_band_name')
)
op.create_index('idx_band_name', 'bands', ['name'], unique=False)
op.create_table('genres',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
Expand All @@ -46,6 +33,27 @@ def upgrade() -> None:
)
op.create_index('idx_genre_name', 'genres', ['name'], unique=False)
op.create_index(op.f('ix_genres_name'), 'genres', ['name'], unique=True)
op.create_table('refresh_tokens',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('token', sa.Text(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('is_revoked', sa.Boolean(), nullable=False),
sa.Column('is_rotated', sa.Boolean(), nullable=False),
sa.Column('rotated_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('previous_token_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('revoked_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index('idx_refresh_token_expires', 'refresh_tokens', ['expires_at'], unique=False)
op.create_index('idx_refresh_token_previous', 'refresh_tokens', ['previous_token_id'], unique=False)
op.create_index('idx_refresh_token_revoked', 'refresh_tokens', ['is_revoked'], unique=False)
op.create_index('idx_refresh_token_rotated', 'refresh_tokens', ['is_rotated'], unique=False)
op.create_index('idx_refresh_token_user', 'refresh_tokens', ['user_id'], unique=False)
op.create_index(op.f('ix_refresh_tokens_previous_token_id'), 'refresh_tokens', ['previous_token_id'], unique=False)
op.create_index(op.f('ix_refresh_tokens_token'), 'refresh_tokens', ['token'], unique=True)
op.create_index(op.f('ix_refresh_tokens_user_id'), 'refresh_tokens', ['user_id'], unique=False)
op.create_table('subscription_plans',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('name', sa.String(length=100), nullable=False),
Expand All @@ -68,6 +76,8 @@ def upgrade() -> None:
sa.Column('password', sa.String(length=255), nullable=False),
sa.Column('role', sa.String(length=100), nullable=False),
sa.Column('email', sa.String(length=100), nullable=False),
sa.Column('email_verified', sa.Boolean(), nullable=True),
sa.Column('email_verified_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('last_login', sa.DateTime(), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=True),
Expand Down Expand Up @@ -109,6 +119,36 @@ def upgrade() -> None:
)
op.create_index('idx_audit_log_action_type', 'audit_logs', ['action_type'], unique=False)
op.create_index('idx_audit_log_target_table', 'audit_logs', ['target_table'], unique=False)
op.create_table('bands',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('name', sa.String(length=50), nullable=False),
sa.Column('bio', sa.Text(), nullable=True),
sa.Column('profile_picture', sa.String(length=255), nullable=True),
sa.Column('social_link', sa.JSON(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('is_disabled', sa.Boolean(), nullable=False),
sa.Column('disabled_at', sa.DateTime(), nullable=True),
sa.Column('created_by_user_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['created_by_user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name', name='uq_band_name')
)
op.create_index('idx_band_name', 'bands', ['name'], unique=False)
op.create_table('email_verification_tokens',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('token', sa.String(length=255), nullable=False),
sa.Column('token_type', sa.String(length=50), nullable=False),
sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('used_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_index('idx_expires_at', 'email_verification_tokens', ['expires_at'], unique=False)
op.create_index('idx_user_token_type', 'email_verification_tokens', ['user_id', 'token_type'], unique=False)
op.create_index(op.f('ix_email_verification_tokens_id'), 'email_verification_tokens', ['id'], unique=False)
op.create_index(op.f('ix_email_verification_tokens_token'), 'email_verification_tokens', ['token'], unique=True)
op.create_table('localizations',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('translation_key', sa.String(length=100), nullable=False),
Expand Down Expand Up @@ -143,9 +183,12 @@ def upgrade() -> None:
sa.Column('name', sa.String(length=100), nullable=False),
sa.Column('description', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('share_token', sa.String(length=64), nullable=True),
sa.Column('allow_collaboration', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(['owner_id'], ['users.id'], name='fk_playlist_owner_id_users'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('owner_id', 'name', name='uq_playlist_owner_name')
sa.UniqueConstraint('owner_id', 'name', name='uq_playlist_owner_name'),
sa.UniqueConstraint('share_token')
)
op.create_index('idx_playlist_owner_id', 'playlists', ['owner_id'], unique=False)
op.create_table('system_configs',
Expand Down Expand Up @@ -281,10 +324,12 @@ def upgrade() -> None:
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('song_id', sa.Integer(), nullable=False),
sa.Column('played_at', sa.DateTime(), nullable=False),
sa.Column('is_cleared', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(['song_id'], ['songs.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_index('idx_history_cleared', 'histories', ['is_cleared'], unique=False)
op.create_index('idx_history_user_song', 'histories', ['user_id', 'song_id'], unique=False)
op.create_table('likes',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
Expand Down Expand Up @@ -318,6 +363,7 @@ def downgrade() -> None:
op.drop_index('idx_likes_user_song', table_name='likes')
op.drop_table('likes')
op.drop_index('idx_history_user_song', table_name='histories')
op.drop_index('idx_history_cleared', table_name='histories')
op.drop_table('histories')
op.drop_index('idx_album_song_album_id', table_name='album_songs')
op.drop_table('album_songs')
Expand Down Expand Up @@ -355,6 +401,13 @@ def downgrade() -> None:
op.drop_table('payments')
op.drop_index('idx_localization_translation_key', table_name='localizations')
op.drop_table('localizations')
op.drop_index(op.f('ix_email_verification_tokens_token'), table_name='email_verification_tokens')
op.drop_index(op.f('ix_email_verification_tokens_id'), table_name='email_verification_tokens')
op.drop_index('idx_user_token_type', table_name='email_verification_tokens')
op.drop_index('idx_expires_at', table_name='email_verification_tokens')
op.drop_table('email_verification_tokens')
op.drop_index('idx_band_name', table_name='bands')
op.drop_table('bands')
op.drop_index('idx_audit_log_target_table', table_name='audit_logs')
op.drop_index('idx_audit_log_action_type', table_name='audit_logs')
op.drop_table('audit_logs')
Expand All @@ -370,9 +423,16 @@ def downgrade() -> None:
op.drop_index('idx_subscription_plans_is_active', table_name='subscription_plans')
op.drop_index('idx_subscription_plans_duration', table_name='subscription_plans')
op.drop_table('subscription_plans')
op.drop_index(op.f('ix_refresh_tokens_user_id'), table_name='refresh_tokens')
op.drop_index(op.f('ix_refresh_tokens_token'), table_name='refresh_tokens')
op.drop_index(op.f('ix_refresh_tokens_previous_token_id'), table_name='refresh_tokens')
op.drop_index('idx_refresh_token_user', table_name='refresh_tokens')
op.drop_index('idx_refresh_token_rotated', table_name='refresh_tokens')
op.drop_index('idx_refresh_token_revoked', table_name='refresh_tokens')
op.drop_index('idx_refresh_token_previous', table_name='refresh_tokens')
op.drop_index('idx_refresh_token_expires', table_name='refresh_tokens')
op.drop_table('refresh_tokens')
op.drop_index(op.f('ix_genres_name'), table_name='genres')
op.drop_index('idx_genre_name', table_name='genres')
op.drop_table('genres')
op.drop_index('idx_band_name', table_name='bands')
op.drop_table('bands')
# ### end Alembic commands ###

This file was deleted.

This file was deleted.

Loading