- Added EveAI Client to project

- Improvements to EntitlementsDomain & Services
- Prechecks in Document domain
- Add audit information to LicenseUsage
This commit is contained in:
Josako
2025-05-17 15:56:14 +02:00
parent b4f7b210e0
commit 5c982fcc2c
260 changed files with 48683 additions and 43 deletions

View File

@@ -0,0 +1,34 @@
"""Add audit fields to LicenseUsage
Revision ID: 845d0428c5fe
Revises: 9f4ea4aff2f5
Create Date: 2025-05-17 13:51:21.696328
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '845d0428c5fe'
down_revision = '9f4ea4aff2f5'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('license_usage', schema=None) as batch_op:
batch_op.add_column(sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True))
batch_op.add_column(sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True))
batch_op.add_column(sa.Column('created_by', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('updated_by', sa.Integer(), nullable=True))
batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public')
batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@@ -0,0 +1,68 @@
"""Improvements to the Entitlements domain in context of LicensePeriod
Revision ID: 9f4ea4aff2f5
Revises: ef0aaf00f26d
Create Date: 2025-05-16 13:51:29.338916
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9f4ea4aff2f5'
down_revision = 'ef0aaf00f26d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('license_change_log',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('license_id', sa.Integer(), nullable=False),
sa.Column('changed_at', sa.DateTime(), nullable=False),
sa.Column('field_name', sa.String(length=100), nullable=False),
sa.Column('old_value', sa.String(length=255), nullable=True),
sa.Column('new_value', sa.String(length=255), nullable=False),
sa.Column('reason', sa.Text(), nullable=True),
sa.Column('created_by', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['created_by'], ['public.user.id'], ),
sa.ForeignKeyConstraint(['license_id'], ['public.license.id'], ),
sa.PrimaryKeyConstraint('id'),
schema='public'
)
with op.batch_alter_table('invoice', schema=None) as batch_op:
batch_op.add_column(sa.Column('tenant_id', sa.Integer(), nullable=False))
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
with op.batch_alter_table('license_period', schema=None) as batch_op:
batch_op.add_column(sa.Column('tenant_id', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('currency', sa.String(length=20), nullable=False))
batch_op.add_column(sa.Column('basic_fee', sa.Float(), nullable=False))
batch_op.add_column(sa.Column('max_storage_mb', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('additional_storage_price', sa.Float(), nullable=False))
batch_op.add_column(sa.Column('additional_storage_bucket', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('included_embedding_mb', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('additional_embedding_price', sa.Numeric(precision=10, scale=4), nullable=False))
batch_op.add_column(sa.Column('additional_embedding_bucket', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('included_interaction_tokens', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('additional_interaction_token_price', sa.Numeric(precision=10, scale=4), nullable=False))
batch_op.add_column(sa.Column('additional_interaction_bucket', sa.Integer(), nullable=False))
batch_op.add_column(sa.Column('additional_storage_allowed', sa.Boolean(), nullable=False))
batch_op.add_column(sa.Column('additional_embedding_allowed', sa.Boolean(), nullable=False))
batch_op.add_column(sa.Column('additional_interaction_allowed', sa.Boolean(), nullable=False))
batch_op.drop_constraint('license_period_license_id_fkey', type_='foreignkey')
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
with op.batch_alter_table('payment', schema=None) as batch_op:
batch_op.add_column(sa.Column('tenant_id', sa.Integer(), nullable=False))
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###