def toDict(data) -> dict:
    def dateToStr(date):
        if date is None:
            return None
        return date.strftime("%Y-%m-%d %H:%M:%S")

    return {
        c.name: (
            (
                getattr(data, c.name)
                if not c.name.endswith("_data")
                else getattr(data, c.name).toDict()
            )
            if not c.name.endswith("_at")
            else dateToStr(getattr(data, c.name))
        )
        for c in data.__table__.columns
    }
