示例#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)