contract_server.py 976 B

123456789101112131415161718192021222324
  1. from sqlalchemy.ext.asyncio import AsyncSession
  2. from alien_store.repositories.contract_repo import ContractRepository
  3. from alien_store.schemas.request.contract_store import TemplatesCreate
  4. class ContractServer:
  5. def __init__(self, db: AsyncSession):
  6. self.db = db
  7. self.esign_repo = ContractRepository(db)
  8. async def create_template(self, template_data: TemplatesCreate):
  9. await self.esign_repo.create(template_data)
  10. return {
  11. "message": "模板创建成功",
  12. "template_data": template_data
  13. }
  14. async def list_by_store(self, store_id: int):
  15. return await self.esign_repo.get_by_store_id(store_id)
  16. async def list_all_paged(self, page: int, page_size: int = 10):
  17. return await self.esign_repo.get_all_paged(page, page_size)
  18. async def mark_signed_by_phone(self, contact_phone: str, signing_time):
  19. return await self.esign_repo.mark_signed_by_phone(contact_phone, signing_time)