def read(length: int = 20, offset: int = 0, dao: GenericSQLDAO = None, **kwargs): filters = dict() entity_attributes = [field.name for field in fields(EntityForTest)] for key, value in kwargs.items(): if key not in entity_attributes: continue filters[key] = value.split(',') \ if len(str(value).split(',')) > 1 \ else value total, results = dao.get_all(length=length, offset=offset, filters=filters if filters else None) return success_response(message="List of entityfortest", data={ "total": total, "results": [dict(result) for result in results] })
def read(length: int = 20, offset: int = 0, dao: GenericSQLDAO = None, **kwargs): for key, value in kwargs.items(): kwargs[key] = value.split(',') \ if len(value.split(',')) > 1 \ else value total, results = dao.get_all(length=length, offset=offset, filters=kwargs if len(kwargs) > 0 else None) return success_response(message="List of contact", data={"total": total, "results": [dict(result) for result in results]})
def probe(dao: GenericSQLDAO = None): total, _ = dao.get_all(length=1, offset=0, filters=None) return success_response(message="API Ready", data={"available": total})
def probe(id_: str = None, dao: GenericSQLDAO = None): total, results = dao.get_all(length=1, offset=0, filters={"contact": id_}) return success_response(message="API Ready", data={"available": total})