first commit

This commit is contained in:
osiris account 2023-03-11 17:12:27 -08:00
commit bb17a2a56e
29 changed files with 1238 additions and 0 deletions

View file

@ -0,0 +1,52 @@
import motor.motor_asyncio
import json
MONGO_DETAILS = "mongodb://localhost:27017"
#client = motor.motor_asyncio.AsyncIOMotorClient(MONGO_DETAILS)
from pymongo import MongoClient
client = MongoClient(MONGO_DETAILS)
database = client.balances
collection = database.get_collection("balances_fuckkk")
print(database.list_collection_names())
def wallet_helper(item) -> dict:
return {
"wallet": item["wallet"],
}
from bson.objectid import ObjectId
async def retrieve_students():
bals = collection.find()
res = []
counter = 0
for i in bals:
res.append(wallet_helper(i))
if counter > 2:
break
counter += 1
return res
def balancer_helper(item) -> dict:
return {
"wallet": item["wallet"],
"balance": item["balance"],
}
# Retrieve a student with a matching ID
async def retrieve_student(wallet: str) -> dict:
student = collection.find_one({"wallet": wallet})
if student:
return balancer_helper(student)