Пример #1
0
    def post(self):
        agro_response = AgroResponse()
        login = LoginService()
        dados = json.loads(request.data)

        retorno = login.logar(dados)
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_200(retorno)
Пример #2
0
    def delete(self, id):
        agro_response = AgroResponse()
        agricultor = AgricultorService()

        retorno = agricultor.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Пример #3
0
    def delete(self, id):
        agro_response = AgroResponse()
        categoria = CategoriaService()

        retorno = categoria.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Пример #4
0
    def delete(self, id):
        agro_response = AgroResponse()
        endereco = EnderecoService()

        retorno = endereco.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Пример #5
0
    def delete(self, id):
        agro_response = AgroResponse()
        cliente = ClienteService()

        retorno = cliente.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Пример #6
0
    def delete(self, id):
        agro_response = AgroResponse()
        pedido = PedidoService()

        retorno = pedido.deletar(id)
        if retorno:
            return agro_response.status_200("Pedido deletado com sucesso")
Пример #7
0
    def get(self):
        agro_response = AgroResponse()
        endereco = EnderecoService()

        retorno = endereco.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400("Não foi possível", "encontrar")
Пример #8
0
    def put(self, current_user):
        agro_response = AgroResponse()
        cliente = ClienteService()
        dados = json.loads(request.data)

        retorno = cliente.atualizar(current_user.id, dados)
        if retorno:
            return agro_response.status_200(retorno)
Пример #9
0
    def get(self):
        agro_response = AgroResponse()
        cliente = ClienteService()

        retorno = cliente.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #10
0
    def get(self):
        agro_response = AgroResponse()
        pedido = PedidoService()

        retorno = pedido.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400("Não, encontrado")
Пример #11
0
    def get(self):
        agro_response = AgroResponse()
        agricultor = AgricultorService()

        retorno = agricultor.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #12
0
    def delete(self, id):
        agro_response = AgroResponse()
        forma_pagamento = FormaPagamentoService()

        retorno = forma_pagamento.deletar(id)
        if retorno:
            return agro_response.status_200(
                "Forma de Pagamento deletada com sucesso!")
Пример #13
0
    def get(self):
        agro_response = AgroResponse()
        categoria = CategoriaService()

        retorno = categoria.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400("Não foi possível", "encontrar")
Пример #14
0
    def delete(self, id):
        agro_response = AgroResponse()
        item_venda = ItemVendaService()

        retorno = item_venda.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #15
0
    def get(self):
        agro_response = AgroResponse()
        forma_pagamento = FormaPagamentoService()

        retorno = forma_pagamento.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('Não foi possivel', 'pegar')
Пример #16
0
    def get(self):
        agro_response = AgroResponse()
        item_venda = ItemVendaService()

        retorno = item_venda.listar()
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #17
0
    def put(self, id):
        agro_response = AgroResponse()
        agricultor = AgricultorService()
        dados = json.loads(request.data)

        retorno = agricultor.atualizar(id, dados)
        if retorno:
            return agro_response.status_200(retorno)
Пример #18
0
    def post(self):
        agro_response = AgroResponse()
        forma_pagamento = FormaPagamentoService()
        dados = json.loads(request.data)

        retorno = forma_pagamento.criar(dados)
        if retorno:
            return agro_response.status_200('Forma de pagamento criada!')
        return agro_response.status_400('Não foi possível', 'criar')
Пример #19
0
    def put(self):
        agro_response = AgroResponse()
        categoria = CategoriaService()
        dados = json.loads(request.data)
        retorno = categoria.atualizar(dados)

        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #20
0
    def post(self):
        agro_response = AgroResponse()
        endereco = EnderecoService()
        dados = json.loads(request.data)

        retorno = endereco.criar(dados)
        if retorno:
            return agro_response.status_200("Endereço criado")
        return agro_response.status_400("Falha na criação", "criação falhou")
Пример #21
0
    def post(self):
        agro_response = AgroResponse()
        categoria = CategoriaService()
        dados = json.loads(request.data)

        retorno = categoria.criar(dados)
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400("Falha na criação", "criação falhou")
Пример #22
0
    def put(self):
        agro_response = AgroResponse()
        item_venda = ItemVendaService()
        dados = json.loads(request.data)
        retorno = item_venda.atualizar(dados)

        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #23
0
    def put(self):
        agro_response = AgroResponse()
        forma_pagamento = FormaPagamentoService()
        dados = json.loads(request.data)
        retorno = forma_pagamento.atualizar(dados)

        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #24
0
    def put(self):
        agro_response = AgroResponse()
        pedido = PedidoService()
        dados = json.loads(request.data)
        retorno = pedido.atualizar(dados)

        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400('deu', 'ruim')
Пример #25
0
    def post(self, current_user):
        agro_response = AgroResponse()
        pedido = PedidoService()
        dados = json.loads(request.data)

        retorno = pedido.criar(dados, current_user)
        if retorno:
            return agro_response.status_200(retorno)
        return agro_response.status_400("Não, criado")
Пример #26
0
    def post(self):
        agro_response = AgroResponse()
        agricultor = AgricultorService()
        dados = json.loads(request.data)

        retorno = agricultor.criar(dados)
        if retorno:
            return agro_response.status_200(
                'Um e-mail de confirmação foi enviado pra você')
        return agro_response.status_400('deu', 'ruim')
Пример #27
0
    def get(self, token):
        agro_response = AgroResponse()
        usuario = Usuario()
        resposta = None
        email = usuario.confirmacao_token(token)
        usuario = Usuario.query.filter_by(email=email).first()
        if not email:
            return agro_response.status_200('Link inválido ou expirado!')

        if usuario.confirmado:
            return agro_response.status_200(
                'Conta já confirmada. Faça o login!')

        if usuario.email == email:
            usuario.confirmado = True
            db.session.add(usuario)
            db.session.commit()
            resposta = 'Você confirmou sua conta! Obrigado!'
        return agro_response.status_200(resposta)
Пример #28
0
 def get(self):
     agro_response = AgroResponse()
     return agro_response.status_200('0.0.1')