bank.py 957 B

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