File size: 663 Bytes
9a6b7dc
897c1d2
9a6b7dc
 
 
 
897c1d2
90cb4f4
 
 
897c1d2
 
9a6b7dc
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import BaseModel
from typing import List, Dict, Optional
from datetime import datetime


class Response(BaseModel):
    config_id: str
    query_v: Dict[str, int]
    query_p0: Dict[str, int]
    query_p1: Dict[str, int]
    comment: Optional[str]
    timestamp: str


class Feedback(BaseModel):
    id: int
    user_id: str
    time_stamp: datetime
    responses: List[Response]

    # Override the method to serialize datetime
    def dict(self, *args, **kwargs):
        feedback_data = super().dict(*args, **kwargs)
        feedback_data['time_stamp'] = self.time_stamp.isoformat()  # Convert datetime to ISO string
        return feedback_data