File size: 1,130 Bytes
01a1238
427638d
01a1238
 
 
 
427638d
 
 
 
 
 
 
 
 
01a1238
 
 
db9d9b2
01a1238
 
 
 
 
 
2046386
01a1238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# App/Messages/Schema.py
from pydantic import BaseModel, UUID4, Field, ConfigDict, condecimal, constr
from datetime import datetime
from typing import Optional


class TransactionSchema(BaseModel):
    transaction_id: str
    amount_received: float
    phone_number: str
    name: str
    date: datetime
    new_balance: float


class PayloadSchema(BaseModel):
    message: str
    phoneNumber: str
    receivedAt: datetime
    simNumber: Optional[int]


class MessageCreate(BaseModel):
    deviceId: Optional[str]
    event: Optional[str]
    id: Optional[str]
    payload: PayloadSchema
    webhookId: Optional[str]


class MessageResponse(BaseModel):
    id: UUID4
    device_id: Optional[str]
    event: Optional[str]
    message_id: Optional[str]
    webhook_id: Optional[str]
    message_content: str
    phone_number: str
    received_at: datetime
    sim_number: Optional[int]
    parsed_data: Optional[dict]  # Include parsed_data in the response
    created_time: datetime
    model_config = ConfigDict(from_attributes=True)

    # class Config:
    #     orm_mode = True
    #     allow_population_by_field_name = True