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})
async def deleteCredentialsByID(request, credential_id): deleteCredentials = db.table('credentials').where( 'id', int(credential_id)).delete() return json({'data': None})
async def getCredentialByID(request, credential_id): credential = db.table('credentials').where('id', int(credential_id)).first() return json({'data': credential})
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})
async def getCredentials(request): credentials = db.table('credentials').get() return json({'data': credentials, 'total': len(credentials)})