feat: keep customer profiles up to date
This commit is contained in:
parent
e7b16dd17f
commit
89f46fff35
7 changed files with 175 additions and 5 deletions
21
models.py
21
models.py
|
|
@ -427,3 +427,24 @@ class DirectMessage(PartialDirectMessage):
|
|||
def from_row(cls, row: Row) -> "DirectMessage":
|
||||
dm = cls(**dict(row))
|
||||
return dm
|
||||
|
||||
|
||||
######################################## CUSTOMERS ########################################
|
||||
|
||||
|
||||
class CustomerProfile(BaseModel):
|
||||
name: Optional[str]
|
||||
about: Optional[str]
|
||||
|
||||
|
||||
class Customer(BaseModel):
|
||||
merchant_id: str
|
||||
public_key: str
|
||||
event_created_at: Optional[int]
|
||||
profile: Optional[CustomerProfile]
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row) -> "Customer":
|
||||
customer = cls(**dict(row))
|
||||
customer.profile = CustomerProfile(**json.loads(row["meta"]))
|
||||
return customer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue