コード例 #1
0
    def get_user(username: str):
        Users = db['users']

        return jsonify(Users.find_one({"_id": username}))
コード例 #2
0
 def updateCourseInfoOfUser(course, filter, role):
     Users = db['users']
     if role == "student":
         Users.update_one({**filter}, {"$push": {"courseEnrolled": course}})
     elif role == "teacher":
         Users.update_one({**filter}, {"$push": {"courseAssigned": course}})
コード例 #3
0
    def check_user(username: str, password: str):
        Users = db['users']

        return Users.find_one({"_id": username, "password": password})
コード例 #4
0
from flask import Flask
from pymongo import MongoClient
from flask_cors import CORS


app = Flask(__name__)
CORS(app=app, support_credentials=True)


client = MongoClient(host='localhost',port=27017)
db = client.AttendenceSystem

## INITIATING COLLECTIONS
from app.Collections.Courses import Courses
from app.Collections.Departments import Departments
from app.Collections.Users import Users
Courses.create()
Departments.create()
Users.create()

from app.Controllers import courseController
from app.Controllers import departmentController
from app.Controllers import userController
from app.Controllers import studentController
from app.Controllers import teacherController