Add min cheque value and view contract at the end of form flow
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""add minimum for payment method cheque
|
||||
|
||||
Revision ID: 31071e10af15
|
||||
Revises: e777ed5729ce
|
||||
Create Date: 2026-09-07 18:48:08.498571
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
import sqlmodel.sql.sqltypes
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '31071e10af15'
|
||||
down_revision: Union[str, Sequence[str], None] = 'e777ed5729ce'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('paymentmethod', sa.Column('min', sa.Integer(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('paymentmethod', 'min')
|
||||
# ### end Alembic commands ###
|
||||
@@ -42,7 +42,6 @@ def get_one(
|
||||
"""Get one contract"""
|
||||
return session.get(models.Contract, contract_id)
|
||||
|
||||
|
||||
def create_one(
|
||||
session: Session,
|
||||
contract: models.ContractCreate
|
||||
|
||||
@@ -55,6 +55,7 @@ class PaymentMethodBase(SQLModel):
|
||||
name: str
|
||||
details: str
|
||||
max: int | None
|
||||
min: int | None
|
||||
|
||||
|
||||
class PaymentMethod(PaymentMethodBase, table=True):
|
||||
|
||||
@@ -63,12 +63,14 @@ def update_one(
|
||||
if 'payment_methods' in productor_updates:
|
||||
new_productor.payment_methods.clear()
|
||||
for pm in productor_updates['payment_methods']:
|
||||
print(pm)
|
||||
new_productor.payment_methods.append(
|
||||
models.PaymentMethod(
|
||||
name=pm['name'],
|
||||
details=pm['details'],
|
||||
productor_id=id,
|
||||
max=pm['max']
|
||||
max=pm['max'],
|
||||
min=pm['min']
|
||||
)
|
||||
)
|
||||
del productor_updates['payment_methods']
|
||||
|
||||
@@ -80,6 +80,7 @@ class TestUsersService:
|
||||
role_names=['test role']
|
||||
)
|
||||
user_id = users[0].id
|
||||
print(user_id)
|
||||
result = users_service.update_one(session, user_id, user_update)
|
||||
|
||||
assert result.id == user_id
|
||||
|
||||
Reference in New Issue
Block a user