Пример #1
0
async def modifyCredentialbyID(request, credential_id):
    updateBody = request.json
    updatedCredentialStatus = db.table('credentials').where(
        'id', int(credential_id)).update(updateBody)
    updatedCredential = db.table('credentials').where(
        'id', int(credential_id)).first()
    return json({'data': updatedCredential})
Пример #2
0
async def deleteCredentialsByID(request, credential_id):
    deleteCredentials = db.table('credentials').where(
        'id', int(credential_id)).delete()
    return json({'data': None})
Пример #3
0
async def getCredentialByID(request, credential_id):
    credential = db.table('credentials').where('id',
                                               int(credential_id)).first()
    return json({'data': credential})
Пример #4
0
async def createCredentials(request):
    credentials = request.json
    newCredentialID = db.table('credentials').insert_get_id(credentials)
    newCredential = db.table('credentials').where('id',
                                                  newCredentialID).first()
    return json({'data': newCredential})
Пример #5
0
async def getCredentials(request):
    credentials = db.table('credentials').get()
    return json({'data': credentials, 'total': len(credentials)})