from connector import Connector from src.matricula.dao import DAOMatricula from server import add_POST, add_GET def add(req, data): matricula = { 'idAluno': data.get('idAluno'), 'idTurma': data.get('idTurma') } dao = DAOMatricula() conn = Connector() req.sendJSON(dao.add(conn, matricula)) add_POST('/matricula/add', add) def list(req, data): dao = DAOMatricula() conn = Connector() req.sendJSON(dao.list(conn)) add_GET('/matricula/list', list) def remove(req, data): id = data.get('id') dao = DAOMatricula() conn = Connector()
from connector import Connector from src.avaliacao.dao import DAOAvaliacao from server import add_POST, add_GET def add(req, data): avaliacao = { 'nome': data.get('nome'), 'nota': data.get('nota'), 'idTurma': data.get('idTurma') } dao = DAOAvaliacao() conn = Connector() req.sendJSON(dao.add(conn, avaliacao)) add_POST('/avaliacao/add', add) def list(req, data): idTurma = data.get('idTurma') dao = DAOAvaliacao() conn = Connector() if idTurma != None: req.sendJSON(dao.listByTurma(conn, idTurma)) else: req.sendJSON(dao.list(conn)) add_GET('/avaliacao/list', list)
from connector import Connector from src.turma.dao import DAOTurma from server import add_POST, add_GET def add(req, data): turma = { 'nome': data.get('nome'), 'idDisciplina': data.get('idDisciplina') } conn = Connector() dao = DAOTurma() req.sendJSON(dao.add(conn, turma)) add_POST('/turma/add', add) def update(req, data): turma = { 'id': data.get('id'), 'nome': data.get('nome'), 'idDisciplina': data.get('idDisciplina') } DAOTurma().update(Connector(), turma) req.sendJSON(True) add_POST('/turma/update', update) def list(req, data): conn = Connector() dao = DAOTurma() req.sendJSON(dao.list(conn)) add_GET('/turma/list', list) def get(req, data):
def add(req, data): nota = { 'valor': data.get('valor'), 'idAluno': data.get('idAluno'), 'idAvaliacao': data.get('idAvaliacao') } conn = Connector() dao = DAONota() req.sendJSON(dao.add(conn, nota)) add_POST('/nota/add', add) def list(req, data): idAvaliacao = data.get('idAvaliacao') conn = Connector() dao = DAONota() if idAvaliacao != None: req.sendJSON(dao.listByAvaliacao(conn, idAvaliacao)) else: req.sendJSON(dao.list(conn))
from connector import Connector from src.curso.dao import DAOCurso from server import add_POST, add_GET def add(req, data): curso = {'nome': data.get('nome')} conn = Connector() dao = DAOCurso() req.sendJSON(dao.add(conn, curso)) add_POST('/curso/add', add) def list(req, data): conn = Connector() dao = DAOCurso() req.sendJSON(dao.list(conn)) add_GET('/curso/list', list) def get(req, data): id = data.get('id') req.sendJSON(DAOCurso().get(Connector(), id)) add_GET('/curso/get', get)
frequencias.append({ 'data': data, 'presente': args.get('frequencia[' + str(i) + '][presente]'), 'idAluno': args.get('frequencia[' + str(i) + '][idAluno]'), 'idTurma': idTurma }) dao.add(conn, frequencias) req.sendJSON(True) add_POST('/frequencia/add', add) def parseData(rows): for row in rows: row['data'] = str(row['data']) return rows def list(req, args): dao = DAOFrequencia() conn = Connector() data = args.get('data') idTurma = args.get('idTurma')
from connector import Connector from src.aluno.dao import DAOAluno from server import add_POST, add_GET def add(req, data): aluno = { 'nome': data.get('nome'), 'matricula': data.get('matricula'), 'email': data.get('email'), 'telefone': data.get('telefone') } req.sendJSON(DAOAluno().add(Connector(), aluno)) add_POST('/aluno/add', add) def list(req, data): dao = DAOAluno() conn = Connector() idCurso = data.get('idCurso') idTurma = data.get('idTurma') idDisciplina = data.get('idDisciplina') if (idCurso != None): req.sendJSON(dao.listByCurso(conn, idCurso)) elif (idTurma != None): req.sendJSON(dao.listByTurma(conn, idTurma)) elif (idDisciplina != None): req.sendJSON(dao.listByDisciplina(conn, idDisciplina)) else:
from connector import Connector from src.disciplina.dao import DAODisciplina from server import add_POST, add_GET def add(req, data): disciplina = {'nome': data.get('nome'), 'idCurso': data.get('idCurso')} conn = Connector() dao = DAODisciplina() req.sendJSON(dao.add(conn, disciplina)) add_POST('/disciplina/add', add) def update(req, data): disciplina = { 'id': data.get('id'), 'nome': data.get('nome'), 'idCurso': data.get('idCurso') } DAODisciplina().update(Connector(), disciplina) req.sendJSON(True) add_POST('/disciplina/update', update) def list(req, data): conn = Connector() dao = DAODisciplina()