trackMe-backend/src/server.py
def newTutor(u_id):

    myDb, myCursor = dbConnect()

    """
    Allow an ADMIN to add a new tutor (ADMIN ONLY)

    Raises:
        AccessError: [non-admin permissions]
        InputError: [invalid u_id]
        InputError: [invalid tutor_id]
        InputError: [invalid first or last names]
        InputError: [invalid rate_id]
        InputError: [invalid email]
    """

    data = request.get_json()

    # error checking 
    if not validateUidLength(data["u_id"]):
        raise InputError(description = "u_id is of incorrect length")
    elif not validateTutorIdFormat(data["tutor_id"]):
        raise InputError(description = "tutor_id is of incorrect format")
    elif not validateUserNameFormat(data["first_name"], data["last_name"]):
        raise InputError(description = "first name or last name is of incorrect format")
    elif not validateRateId(data["rate_id"]):
        raise InputError(description = "rate id is of incorrect format")
    elif not validateEmail(data["email"]):
        raise InputError(description = "email is of incorrect format")

    doAddNewTutor(myCursor, myDb, data)

    dbDisconnect(myCursor, myDb)
    return dumps({})

    Allow an ADMIN to add a new tutor (ADMIN ONLY)

    Raises:
        AccessError: [non-admin permissions]
        InputError: [invalid u_id]
        InputError: [invalid tutor_id]
        InputError: [invalid first or last names]
        InputError: [invalid rate_id]
        InputError: [invalid email]
    
Allow an ADMIN to add a new tutor (ADMIN ONLY)
Allow an ADMIN to add a new tutor ( ADMIN ONLY )
def newTutor(u_id):
    myDb, myCursor = dbConnect()
    data = request.get_json()
    if not validateUidLength(data["u_id"]):
        raise InputError(description = "u_id is of incorrect length")
    elif not validateTutorIdFormat(data["tutor_id"]):
        raise InputError(description = "tutor_id is of incorrect format")
    elif not validateUserNameFormat(data["first_name"], data["last_name"]):
        raise InputError(description = "first name or last name is of incorrect format")
    elif not validateRateId(data["rate_id"]):
        raise InputError(description = "rate id is of incorrect format")
    elif not validateEmail(data["email"]):
        raise InputError(description = "email is of incorrect format")
    doAddNewTutor(myCursor, myDb, data)
    dbDisconnect(myCursor, myDb)
    return dumps({})
def newTutor ( u_id ) : myDb , myCursor = dbConnect ( ) data = request . get_json ( ) if not validateUidLength ( data [ "u_id" ] ) : raise InputError ( description = "u_id is of incorrect length" ) elif not validateTutorIdFormat ( data [ "tutor_id" ] ) : raise InputError ( description = "tutor_id is of incorrect format" ) elif not validateUserNameFormat ( data [ "first_name" ] , data [ "last_name" ] ) : raise InputError ( description = "first name or last name is of incorrect format" ) elif not validateRateId ( data [ "rate_id" ] ) : raise InputError ( description = "rate id is of incorrect format" ) elif not validateEmail ( data [ "email" ] ) : raise InputError ( description = "email is of incorrect format" ) doAddNewTutor ( myCursor , myDb , data ) dbDisconnect ( myCursor , myDb ) return dumps ( { } )
Allow an ADMIN to add a new tutor (ADMIN ONLY)
Allow an ADMIN to add a new tutor ( ADMIN ONLY )
"""
    Allow an ADMIN to add a new tutor (ADMIN ONLY)

    Raises:
        AccessError: [non-admin permissions]
        InputError: [invalid u_id]
        InputError: [invalid tutor_id]
        InputError: [invalid first or last names]
        InputError: [invalid rate_id]
        InputError: [invalid email]
    """ # error checking 
None
AccessError
None
InputError
None
InputError
[invalid first or last names]
[ invalid first or last names ]
InputError
None
InputError
None
InputError
u_id