#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP bdfosseis = mongoOP.OpMongoDB('forestbd', 'fosseis') def createFosseis(dados): return bdfosseis.save(dados) def uploadFosseis(id, dados): return bdfosseis.upload(id, dados) def deleteFosseis(id): return bdfosseis.remove(id) def listFosseis(): return bdfosseis.list() def getFosseis(id): return bdfosseis.findById(id) def addLoc(id, dados): return bdfosseis.patch(id, dados)
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP bdhistorias = mongoOP.OpMongoDB('forestbd', 'historias') def createHistorias(dados): return bdhistorias.save(dados) def uploadHistorias(id, dados): return bdhistorias.upload(id, dados) def deleteHistorias(id): return bdhistorias.remove(id) def listHistorias(): return bdhistorias.list() def getHistorias(id): return bdhistorias.findById(id) def addLoc(id, dados): return bdhistorias.patch(id, dados)
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP bdtree = mongoOP.OpMongoDB('forestbd', 'trees') def createTree(dados): return bdtree.save(dados) def uploadTree(id, dados): return bdtree.upload(id, dados) def deleteTree(id): return bdtree.remove(id) def listTrees(): return bdtree.list() def getTree(id): return bdtree.findById(id) def addLoc(id, dados): return bdtree.patch(id, dados)
#importando o documento Tree # -*- coding: utf-8 -*- from models import mongoOP import pymongo from controllers import team from controllers import match dbuser = mongoOP.OpMongoDB('worldcup2018', 'usuario') # dbuser.collection.create_index([("email", pymongo.ASCENDING)], unique=True) def createUser(dados): if dbuser.findUser(dados['id']) == True: print("tem") else: return dbuser.save(dados) print("nao tem") def saveSimulation(id, dados): return dbuser.saveSimulation(id, dados) def getSimulation(id): return dbuser.getSimulation(id) def uploadUser(id, dados): return dbuser.upload(id, dados)
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP bdinsetos = mongoOP.OpMongoDB('forestbd', 'insetos') def createInsetos(dados): return bdinsetos.save(dados) def uploadInsetos(id, dados): return bdinsetos.upload(id, dados) def deleteInsetos(id): return bdinsetos.remove(id) def listInsetos(): return bdinsetos.list() def getInsetos(id): return bdinsetos.findById(id) def addLoc(id, dados): return bdinsetos.patch(id, dados)
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP from operator import itemgetter from routes import routers dbSimulation = mongoOP.OpMongoDB('worldcup2018', 'simulacao') dbteam = mongoOP.OpMongoDB('worldcup2018', 'selecao') def simulate1(dados): #partidas das oitavas 49 a 56 # response = [{},{},{},{},{},{},{},{}] partidas = [] i = 0 for x in range(49, 57): partida = routers.getIdPartida2(x) partidas.append(partida['data']) partidas[i]['selecao_a'] = "" partidas[i]['selecao_b'] = "" partidas[i]['gols_a'] = "" partidas[i]['gols_b'] = "" i += 1 if ("grupoA" in dados): fullTeamA = dbteam.findTeam(dados['grupoA'][0]['id_selecao'])
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP dbMatch = mongoOP.OpMongoDB('worldcup2018', 'partida') def listMatch(): return dbMatch.listarSelecoes() def createMatch(): pass def listMatchbyId(id, dados): return dbMatch.findMatchById(id)
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP dbteam = mongoOP.OpMongoDB('worldcup2018','selecao') dbMatch = mongoOP.OpMongoDB('worldcup2018','partida') def getGroup(letter, dados): response = {} #ids da partida grupoIdPartida = {"A": [1,2,17,18,33,34], "B": [3,4,19,20,35,36], "C":[5,6,21,22,37,38], "D":[7,8,23,24,39,40], "E":[10,9,25,26,41,42], "F":[12,11,27,28,43,44], "G":[13,14,30,29,45,46], "H":[16,15,31,32,47,48] } jsonTeams = dbteam.findGroup(letter) jsonMatches = [{"rodada1":[]},{"rodada2":[]},{"rodada3":[]}] contador_rodada1 = 0 contador_rodada2 = 0 contador_rodada3 = 0 for id in grupoIdPartida[letter]: match = dbMatch.findMatchById(id) if (match['data']['rodada']==1): jsonMatches[0]['rodada1'].append(match['data'])
#importando o documento Tree # -*- coding: utf-8 -*- from models import mongoOP import pymongo dbuser = mongoOP.OpMongoDB('forestbd', 'users') # dbuser.collection.create_index([("email", pymongo.ASCENDING)], unique=True) def createUser(dados): return dbuser.save(dados) def uploadUser(id, dados): return dbuser.upload(id, dados) def patchUser(id, dados): return dbuser.patch(id, dados) def deleteUser(id): return dbuser.remove(id) def listUser(): return dbuser.list() def getUser(id):
#importando o documento Tree # -*- coding: utf-8 -*- from bson.json_util import dumps from models import mongoOP dbteam = mongoOP.OpMongoDB('worldcup2018','selecao') def createTeam(dados): return dbteam.save(dados) def uploadTeams(id,dados): return dbteam.upload(id, dados) def deleteTeam(id): return dbteam.remove(id) def listTeam(): return dbteam.listSort() def getTeam(id,dados): return dbteam.findTeam(id) # return dbteam.findById(id) def addLoc(id, dados): return dbteam.patch(id, dados) def getGroup(id, dados): return dbteam.findGroup(id)