Beispiel #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)
Beispiel #2
0
    def delete(self, id):
        agro_response = AgroResponse()
        agricultor = AgricultorService()

        retorno = agricultor.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Beispiel #3
0
    def delete(self, id):
        agro_response = AgroResponse()
        categoria = CategoriaService()

        retorno = categoria.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Beispiel #4
0
    def delete(self, id):
        agro_response = AgroResponse()
        endereco = EnderecoService()

        retorno = endereco.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Beispiel #5
0
    def delete(self, id):
        agro_response = AgroResponse()
        cliente = ClienteService()

        retorno = cliente.deletar(id)
        if retorno:
            return agro_response.status_200(retorno)
Beispiel #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")
Beispiel #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")
Beispiel #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)
Beispiel #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')
Beispiel #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")
Beispiel #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')
    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!")
Beispiel #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")
Beispiel #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')
    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')
Beispiel #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')
Beispiel #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)
    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')
Beispiel #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')
Beispiel #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")
Beispiel #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")
Beispiel #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')
    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')
Beispiel #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')
Beispiel #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")
Beispiel #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')
Beispiel #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)
Beispiel #28
0
 def get(self):
     agro_response = AgroResponse()
     return agro_response.status_200('0.0.1')