Ejemplo n.º 1
0
 def get(self):
     user_id = get_jwt_identity()
     companyList = [company.json() for company in CompanyModel.find_all()]
     if user_id:
         return {'companyList': companyList}, 200
     return {
         'companyList': [company['name'] for company in companyList],
         'message': 'More data available if you log in.'
     }, 200
Ejemplo n.º 2
0
 def get(self):
     return {
         'companies':
         [format_company_to_json(x) for x in CompanyModel.find_all()]
     }  # map() function returns a list of the results after applying the given function to each item of a given iterable (list, tuple etc.)