feat(app-assets): add file download functionality with pre-signed URLs and enhance asset management

This commit is contained in:
Harry
2026-01-15 17:19:46 +08:00
parent 33f3374ea6
commit 6bb09dc58c
8 changed files with 296 additions and 47 deletions

View File

@ -0,0 +1,68 @@
"""rename_app_assets
Revision ID: d88f3edbd99d
Revises: a1b2c3d4e5f6
Create Date: 2026-01-15 16:49:11.833689
"""
from alembic import op
import models as models
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'd88f3edbd99d'
down_revision = 'a1b2c3d4e5f6'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('app_assets',
sa.Column('id', models.types.StringUUID(), nullable=False),
sa.Column('tenant_id', models.types.StringUUID(), nullable=False),
sa.Column('app_id', models.types.StringUUID(), nullable=False),
sa.Column('version', sa.String(length=255), nullable=False),
sa.Column('asset_tree', models.types.LongText(), nullable=False),
sa.Column('created_by', models.types.StringUUID(), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
sa.Column('updated_by', models.types.StringUUID(), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
sa.PrimaryKeyConstraint('id', name='app_assets_pkey')
)
with op.batch_alter_table('app_assets', schema=None) as batch_op:
batch_op.create_index('app_assets_version_idx', ['tenant_id', 'app_id', 'version'], unique=False)
with op.batch_alter_table('app_asset_drafts', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('app_asset_draft_version_idx'))
op.drop_table('app_asset_drafts')
with op.batch_alter_table('trigger_oauth_tenant_clients', schema=None) as batch_op:
batch_op.alter_column('plugin_id',
existing_type=sa.VARCHAR(length=512),
type_=sa.String(length=255),
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('app_asset_drafts',
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
sa.Column('tenant_id', sa.UUID(), autoincrement=False, nullable=False),
sa.Column('app_id', sa.UUID(), autoincrement=False, nullable=False),
sa.Column('version', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
sa.Column('asset_tree', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column('created_by', sa.UUID(), autoincrement=False, nullable=False),
sa.Column('created_at', postgresql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), autoincrement=False, nullable=False),
sa.Column('updated_by', sa.UUID(), autoincrement=False, nullable=True),
sa.Column('updated_at', postgresql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('app_asset_draft_pkey'))
)
with op.batch_alter_table('app_asset_drafts', schema=None) as batch_op:
batch_op.create_index(batch_op.f('app_asset_draft_version_idx'), ['tenant_id', 'app_id', 'version'], unique=False)
op.drop_table('app_assets')
# ### end Alembic commands ###