def find(cls, colaborador_id: str = None, cpf: str = None) -> List[Dict[str, str]]: try: where = {} where.update({"_id": f"{colaborador_id.replace(' ', '')}"} if colaborador_id else {}) where.update({"cpf": f"{cpf.replace(' ', '')}"} if cpf else {}) colaboradores = Db.find("colaborador", where) return colaboradores if colaboradores else None except: # TODO EXCEPT raise Exception
def find(cls, ponto_id: str = None, colaborador_id: str = None, data: str = None, mes: str = None) -> List[ Dict[str, str]]: try: where = {} where.update({"_id": f"{ponto_id.replace(' ', '')}"} if ponto_id else {}) where.update({"data": f"{data.replace(' ', '')}"} if data else {}) where.update({"colaborador_id": f"{colaborador_id.replace(' ', '')}"} if colaborador_id else {}) if mes: regex = re.compile(f"\\d\\d\\/{mes.replace(' ', '')}\\/\\d\\d\\d\\d") where.update({"data": regex}) pontos = Db.find("ponto", where, sort_by="data") return pontos if pontos else None except: raise Exception