Ejemplo n.º 1
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')
Ejemplo n.º 2
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')
Ejemplo n.º 3
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")
Ejemplo n.º 4
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")
Ejemplo n.º 5
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")
Ejemplo n.º 6
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')
Ejemplo n.º 7
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')
Ejemplo n.º 8
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')
Ejemplo n.º 9
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')
Ejemplo n.º 10
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')
Ejemplo n.º 11
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")
Ejemplo n.º 12
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')
Ejemplo n.º 13
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')
Ejemplo n.º 14
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')
Ejemplo n.º 15
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")
Ejemplo n.º 16
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")
Ejemplo n.º 17
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')
Ejemplo n.º 18
0
 def page_not_found_error(error):
     agro_response = AgroResponse()
     mensagem = 'Erro de parâmetro(s) inválido(s).'
     detalhe = [str(error)]
     return agro_response.status_400(mensagem, detalhe)