Add independent payment-service (port 8012, payment_db) with foundation licensing, BYO-PSP, merchant accounts, idempotent requests, callbacks, and immutable ledger. Co-authored-by: Cursor <cursoragent@cursor.com>
10 lines
610 B
Python
10 lines
610 B
Python
from sqlalchemy import select
|
|
class TenantBaseRepository:
|
|
def __init__(self, session, model): self.session, self.model = session, model
|
|
async def add(self, entity):
|
|
self.session.add(entity); await self.session.flush(); return entity
|
|
async def get(self, tenant_id, entity_id):
|
|
return (await self.session.execute(select(self.model).where(self.model.tenant_id==tenant_id,self.model.id==entity_id))).scalar_one_or_none()
|
|
async def list(self, tenant_id):
|
|
return (await self.session.execute(select(self.model).where(self.model.tenant_id==tenant_id))).scalars().all()
|