benefitsharing.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. from typing import Optional
  2. from datetime import datetime
  3. import uuid
  4. from pydantic import BaseModel, validator
  5. from app.schemas.bank import Bank
  6. from app.schemas.creator import Creator
  7. # Shared properties
  8. class BenefitSharingBase(BaseModel):
  9. amount: float
  10. created_at: datetime
  11. update_at: datetime
  12. bank_id: str
  13. is_paid: bool
  14. # @validator('bank')
  15. # def check_bank(cls, v):
  16. # if v is None:
  17. # return v
  18. # if "https://www.facebook.com" not in v:
  19. # raise ValueError('Please provide a valid facebook link')
  20. # return v
  21. # Properties to receive via API on creation
  22. class BenefitSharingCreate(BenefitSharingBase):
  23. pass
  24. # Properties to receive via API on update
  25. class BenefitSharingUpdate(BenefitSharingBase):
  26. pass
  27. class BenefitSharingInDBBase(BenefitSharingBase):
  28. id: Optional[str] = None
  29. class Config:
  30. orm_mode = True
  31. # Additional properties to return via API
  32. class BenefitSharing(BenefitSharingInDBBase):
  33. pass
  34. # Additional properties stored in DB
  35. class BenefitSharingInDB(BenefitSharingInDBBase):
  36. pass