예제 #1
0
 def AdicionarPedidoReserva(self, reserva):
     id_sala = reserva.id_sala
     id_usuario = reserva.id_usuario
     data = reserva.data
     horario = reserva.horario
     sala = Api().selectOneSala(id_sala)
     # print("sala - ",sala)
     if (sala == None):
         return 1
     if (Api().insertPedidoReservaUser(id_sala, id_usuario, data, horario)):
         return 2
     else:
         return 3
예제 #2
0
 def ListarSalas(self):
     salas = ListaSala()
     for x in Api().selectAllSalas():
         (ident, nome, bloco) = x
         sala = salas.list.add()
         sala.id_sala = ident
         sala.nome = nome
         sala.bloco = bloco
     return salas
예제 #3
0
 def ListarPedidoReservasAdmin(self):
     reservas = ListaReserva()
     for x in Api().selectAllPedidoReservas():
         (ident, id_usuario, data, horario, id_sala, nome, bloco) = x
         r = reservas.reservas.add()
         r.id = ident
         r.id_sala = id_sala
         r.id_usuario = id_usuario
         r.data = data
         r.horario = horario
     return reservas
예제 #4
0
 def ListarHistorico(self, id_usuario):
     reservas = ListaReserva()
     for x in Api().selectAllReservasUser(id_usuario):
         (ident, data, horario, id_sala, nome, bloco) = x
         if (dt.strptime(data, "%d/%m/%Y") < dt.today()):
             r = reservas.reservas.add()
             r.id = ident
             r.id_sala = id_sala
             r.id_usuario = id_usuario
             r.data = data
             r.horario = horario
     return reservas
예제 #5
0
 def CancelarPedidoReserva(self, reserva):
     return Api().cancelarPedidoReserva(reserva.id)
예제 #6
0
 def AceitarPedidoReserva(self, reserva):
     return Api().aceitarPedidoReserva(reserva.id)
예제 #7
0
 def CancelarReservaUser(self, reserva):
     return Api().cancelarReservaUser(reserva.id, reserva.id_usuario)
예제 #8
0
 def VerPedidoReserva(self, reserva):
     return Api().selectOnePedidoReservaUser(reserva.id, reserva.id_usuario)
예제 #9
0
import os
from util.util import Printer
from util.rsr import Rsr
from util.api import Api
from flask import Flask, jsonify, render_template, request
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

### Workspace Setup

printer = Printer()
rsr = Rsr()
get_data = Api()


@app.route('/api/<endpoint>/<param>/<val>', methods=['GET'])
def api(endpoint, param, val):
    response = rsr.api(endpoint, param, val)['results']
    return jsonify(response)


@app.route('/api/live/<endpoint>/<param>/<val>', methods=['GET'])
def live(endpoint, param, val):
    response = rsr.live(endpoint, param, val)['results']
    return jsonify(response)


@app.route('/api/datatables/<rsr_id>', methods=['GET', 'POST'])
예제 #10
0
 def AuthAdmin(self, usuario, senha):
     return Api().existsAdmin(usuario, senha)
예제 #11
0
 def CreateAdmin(self, usuario, senha):
     return Api().insertAdmin(usuario, senha)
예제 #12
0
 def CreateUser(self, nome, usuario, senha, cpf, matricula, curso):
     return Api().insertUsuario(nome, usuario, senha, cpf, matricula, curso)
예제 #13
0
 def Auth(self, nome, senha):
     return Api().existsUsuario(nome, senha)