Skip to content

Commit 2e5d5a0

Browse files
committed
🐛 Fix: rename PaymentsAutorechargeDB to PaymentsAutorechargeGetDB for consistency in autorecharge API
1 parent 5fb396b commit 2e5d5a0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

services/web/server/src/simcore_service_webserver/payments/_autorecharge_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from models_library.wallets import WalletID
1212

1313
from ._autorecharge_db import (
14-
PaymentsAutorechargeDB,
14+
PaymentsAutorechargeGetDB,
1515
get_wallet_autorecharge,
1616
replace_wallet_autorecharge,
1717
)
@@ -23,7 +23,7 @@
2323

2424

2525
def _from_db_to_api_model(
26-
db_model: PaymentsAutorechargeDB, min_balance_in_credits: NonNegativeDecimal
26+
db_model: PaymentsAutorechargeGetDB, min_balance_in_credits: NonNegativeDecimal
2727
) -> GetWalletAutoRecharge:
2828
return GetWalletAutoRecharge(
2929
enabled=db_model.enabled,
@@ -36,8 +36,8 @@ def _from_db_to_api_model(
3636

3737
def _from_api_to_db_model(
3838
wallet_id: WalletID, api_model: ReplaceWalletAutoRecharge
39-
) -> PaymentsAutorechargeDB:
40-
return PaymentsAutorechargeDB(
39+
) -> PaymentsAutorechargeGetDB:
40+
return PaymentsAutorechargeGetDB(
4141
wallet_id=wallet_id,
4242
enabled=api_model.enabled,
4343
primary_payment_method_id=api_model.payment_method_id,
@@ -64,7 +64,7 @@ async def get_wallet_payment_autorecharge(
6464
app, user_id=user_id, wallet_id=wallet_id, product_name=product_name
6565
)
6666
settings = get_plugin_settings(app)
67-
got: PaymentsAutorechargeDB | None = await get_wallet_autorecharge(
67+
got: PaymentsAutorechargeGetDB | None = await get_wallet_autorecharge(
6868
app, wallet_id=wallet_id
6969
)
7070
if not got:
@@ -104,7 +104,7 @@ async def replace_wallet_payment_autorecharge(
104104
)
105105

106106
settings = get_plugin_settings(app)
107-
got: PaymentsAutorechargeDB = await replace_wallet_autorecharge(
107+
got: PaymentsAutorechargeGetDB = await replace_wallet_autorecharge(
108108
app,
109109
user_id=user_id,
110110
wallet_id=wallet_id,

services/web/server/src/simcore_service_webserver/payments/_autorecharge_db.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
AutoRechargeID: TypeAlias = PositiveInt
1919

2020

21-
class PaymentsAutorechargeDB(BaseModel):
21+
class PaymentsAutorechargeGetDB(BaseModel):
2222
wallet_id: WalletID
2323
enabled: bool
2424
primary_payment_method_id: PaymentMethodID
@@ -31,21 +31,21 @@ async def get_wallet_autorecharge(
3131
app: web.Application,
3232
*,
3333
wallet_id: WalletID,
34-
) -> PaymentsAutorechargeDB | None:
34+
) -> PaymentsAutorechargeGetDB | None:
3535
async with get_database_engine_legacy(app).acquire() as conn:
3636
stmt = AutoRechargeStmts.get_wallet_autorecharge(wallet_id)
3737
result = await conn.execute(stmt)
3838
row = await result.first()
39-
return PaymentsAutorechargeDB.model_validate(row) if row else None
39+
return PaymentsAutorechargeGetDB.model_validate(row) if row else None
4040

4141

4242
async def replace_wallet_autorecharge(
4343
app: web.Application,
4444
*,
4545
user_id: UserID,
4646
wallet_id: WalletID,
47-
new: PaymentsAutorechargeDB,
48-
) -> PaymentsAutorechargeDB:
47+
new: PaymentsAutorechargeGetDB,
48+
) -> PaymentsAutorechargeGetDB:
4949
"""
5050
Raises:
5151
InvalidPaymentMethodError: if `new` includes some invalid 'primary_payment_method_id'
@@ -73,4 +73,4 @@ async def replace_wallet_autorecharge(
7373
result = await conn.execute(stmt)
7474
row = await result.first()
7575
assert row # nosec
76-
return PaymentsAutorechargeDB.model_validate(row)
76+
return PaymentsAutorechargeGetDB.model_validate(row)

0 commit comments

Comments
 (0)