TorbatYar/backend/services/payment/app/repositories/base.py
Mortezakoohjani 9fac160258 feat(payment): ship Torbat Pay MVP phases 14.0-14.5
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>
2026-07-27 17:57:04 +03:30

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()